xsl-list
[Top] [All Lists]

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

2006-07-31 09:27:26
On 7/31/06, David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:

>  how do you go about making it explicit
if you want it really explict you could use

<xsl:variable as="document-node()">
  <xsl:document>
    ... stuff


but note that the main (perhaps) difference between

<xsl:variable name="x">
  <xsl:sequence select="foo"/>
</xsl:sequence>

and

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

isn't so much the implict document node as the implict copying. in the
second case $x references foo nodes in their original trees, whereas in
the first case, the nodes are _copied_ into the temporary tree so it's
the same as if you had used copy-of rather than sequence, so you get new
nodes with new identities, and unless MK is kindly optimising stuff
away, new memory usage.

Thanks, that makes sense (...I think :-)

In this case:

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

There is a document node and three child elements, that are siblings
of one another but that do not have a common parent?  How come in this
case there doesn't have to be a single root node?

--~------------------------------------------------------------------
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>
--~--