This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: saxon node-set variable construction
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] saxon node-set variable construction
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Fri, 13 Jul 2001 12:11:00 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> i need to construct a node-set variable. If I copy a node to
> a variable (template
> THREE below) it works fine. If I construct (template FOUR), I cannot
> access the sub-elements as in template THREE. The only difference between
> template
> THREE and FOUR is how the variabel is constructed. Anyone can explain?
The difference is that in THREE the root node of the RTF has a child called
<stuff>
and in FOUR it has a child called <FOUR>, so looking for <stuff> finds
nothing.
Mike Kay
Software AG
>
> <xsl:template match="THREE">
> <xsl:variable name="eRTF" select="." />
> <xsl:variable name="eNode" select="saxon:node-set($eRTF)" />
>
> a<xsl:copy-of select="$eNode" />a
> b<xsl:value-of select="$eNode" />b
> c<xsl:value-of select="$eNode/stuff/@what" />c
> d<xsl:value-of select="$eNode/stuff" />d
>
> </xsl:template>
>
> <xsl:template match="FOUR">
> <xsl:variable name="eRTF">
> <xsl:element name="FOUR">
> <xsl:for-each select="@*">
> <xsl:attribute name="{name()}"><xsl:value-of
> select="."/></xsl:attribute>
> </xsl:for-each>
> <xsl:for-each select="*">
> <xsl:copy-of select="."/>
> </xsl:for-each>
> </xsl:element>
> </xsl:variable>
> <xsl:variable name="eNode" select="saxon:node-set($eRTF)" />
>
> a<xsl:copy-of select="$eNode" />a
> b<xsl:value-of select="$eNode" />b
> c<xsl:value-of select="$eNode/stuff/@what" />c
> d<xsl:value-of select="$eNode/stuff" />d
>
> </xsl:template>
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list