[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Sibling axis and as="element()"

Subject: Re: Sibling axis and as="element()"
From: "andrew welch" <andrew.j.welch@xxxxxxxxx>
Date: Mon, 31 Jul 2006 16:35:27 +0100
elements not generated with axis
On 7/31/06, David Carlisle <davidc@xxxxxxxxx> wrote:

> Is this the case? Do parentless trees lose their axes? if you aint got a parent you aint got a brother, it's just a matter of biology:-)

If you use xsl:variable with content and no as attribute then (for xslt1
compatibility) an implict document node is created, and any nodes
generated are made children of that document node, so as a consequence
of that they become siblings of each other.

If you use an as attribute then the implict document node is not
generated and the result is a sequence. In your case the sequence is of
newly constructed, parentless nodes so they are not siblings.  In this
case they have no siblings at all, but in other cases they could have
siblings but not in the variable.

If your input looks like


and your variable looks like

<xsl:variable name="x"  as="element()*">
 <xsl:sequence select="/x/a/b"/>

then the $x is the same as if you'd have gone

<xsl:variable name="x" select="/x/a/b"/>

and (as in 1.0) you'd have a sequence of 3 b elements, and they'd all have
siblings which are c elements which are not in the sequence (aka node
set)  bound to the variable.

Thanks for the explanation. Rather than have implicit document node creation how do you go about making it explicit - what should the as attribute be?

<xsl:variable name="foo" as="....">

as="document-node()" fails here.

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.