[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Sibling axis and as="element()"


Subject: RE: [xsl] Sibling axis and as="element()"
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 1 Aug 2006 11:07:18 +0100

> Given this XML:
> 
> <xsl:variable name="foo" as="element(foo)+">
>   <foo/>
>   <foo/>
>   <foo/>
> </xsl:variable>
> 
> I seem to remember David C mentioning something about using 
> as="element()" means the elements are no longer siblings... 
> but I can't find anything about it now.
> 

It's not a question of being "no longer" siblings. You've simply created
three element nodes. You haven't attached them to any parent, therefore they
are not siblings, and never were. If you want to make them siblings, use

<xsl:variable name="foo" as="document-node()">
  <xsl:document>
    <foo/><foo/><foo/>
  </xsl:document>
</xsl:variable>

or use the old syntax, which you can regard as an abbreviation for the
above:

<xsl:variable name="foo">
   <foo/><foo/><foo/>
</xsl:variable>

Michael Kay
http://www.saxonica.com/


Current Thread