Wouldn't the context always be the context of the parameter being passed
in so "/" would never resolve to the source xml?
--------------------------------------------
Hi, Karl,
Well, when you write:
<xsl:param name="something" select="whatever"/>
you are creating a default value for the parameter. The whatever will only
apply if no value is passed for the parameter. At that point, the only
available context is the source document, so / picks up the root node of
the source document.
I did some quick testing. With the following source document:
<?xml version="1.0" encoding="UTF-8"?>
<x>ABCD</x>
and the following stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="no" indent="yes"/>
<xsl:param name="in" select="/"/>
<xsl:template match="/">
<x>
<xsl:value-of select="$in"/>
</x>
</xsl:template>
</xsl:stylesheet>
I got the following output when I specified in="hello" as a parameter:
<?xml version="1.0" encoding="UTF-8"?>
<x>hello</x>
And the following output when I left off the parameter:
<?xml version="1.0" encoding="UTF-8"?>
<x>ABCD</x>
Tested with Saxon 8.4.
I don't use unions (|) much, so I am not sure of its behavior in this
situation.
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
Karl Stubsjoen <kstubs(_at_)gmail(_dot_)com>
05/13/2005 01:35 PM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
cc
Subject
Re: [xsl] A parameter current context or context passed
/ is the document root. So I think you want just select="current()" (or
even just select=".").
I would think I want "/" or "." Wouldn't the context always be the
context of the parameter being passed in so "/" would never resolve to
the source xml?
Not sure what "/" over "." would gain in this case.
I have tested my param, and it seems to work fine. I don't get the |
"pipe". Is that an OR operator in this case? Or is it more like a
switch?
On 5/13/05, JBryant(_at_)s-s-t(_dot_)com <JBryant(_at_)s-s-t(_dot_)com> wrote:
Hi, Karl,
/ is the document root. So I think you want just select="current()" (or
even just select=".").
Untested, so I might be off.
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
Karl Stubsjoen <kstubs(_at_)gmail(_dot_)com>
05/13/2005 12:48 PM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
cc
Subject
[xsl] A parameter current context or context passed
This should be an easy one...
I have the following paramter:
<xsl:param name="current" select="/ | current()"/>
As the name implies it should be the current context unless otherwise
specified. Have I written this correct?
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--