Subject: RE: [xsl] Trying to understand root-less or document-node-less nodes From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Mon, 17 Sep 2007 19:09:23 +0100 |
> I stumbled across this ('this' is explained later) when I > realized that > > <xsl:variable name="root"> > <test1 /> > <test2 /> > </xsl:variable> > > can be queried by an xpath using the simple $root/* axis. In other > words: children of $root. And that this felt non-analogous to > the following: > > <xsl:function name="my:rootless"> > <test1 /> > <test2 /> > </xsl:function> Yes, it's not analogous. I would recommend always using an "as" attribute with xsl:variable, especially when you don't use the select attribute. Think of the (above) syntax without an "as" attribute as a legacy shorthand for <xsl:variable name="root" as="document-node()"> <xsl:document> <test1 /> <test2 /> </xsl:document> </xsl:variable> If it weren't for backwards compatibility, I'm sure we would have made xsl:variable behave the same way as xsl:function, that is in this case, to return a sequence of two parentless elements - which is what you get if you write <xsl:variable as="element()*">. Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Trying to understand root, David Carlisle | Thread | [xsl] [Announce:] Version 2008 of t, ANNOUNCE |
RE: [xsl] [XSL] XSL Browser Integra, Scott Trenda | Date | Re: [xsl] [XSL] XSL Browser Integra, Abel Braaksma |
Month |