Subject: Re: [xsl] Putting a nodeset in a variable From: Joerg Heinicke <joerg.heinicke@xxxxxx> Date: Sun, 24 Nov 2002 00:02:49 +0000 |
<xsl:template match="/"> <xsl:for-each select="traps/trap"> <xsl:sort select="./@id"/> <xsl:value-of select="@id"/> </xsl:for-each> </xsl:template>
<xsl:template match="/traps"> <xsl:for-each select="trap[generate-id() = generate-id(key('traps', @id))]"> <xsl:sort select="@id"/> <xsl:value-of select="@id"/> </xsl:for-each> </xsl:template>
Hello,
is it possible to put a nodeset in a variable. What I try to do is the following. I have an xml file which I want to group.
This resulting tree I want to put in a variable so I can use it later on.
E.g. <traps> <trap id="5"/> <trap id="6"/> <trap id="2"/> <trap id="5"/> </traps>
<xsl:variable name="distinctValues"> <traps> <xsl:for-each select="traps/trap"> <xsl:sort select="./@id"/> <xsl:copy-of select="."/> </xsl:for-each> </traps> </xsl:variable>
<xsl:template match="/"> <xsl:for-each select="$distinctValues/trap"> <xsl:value-of select="@id"/> </xsl:for-each> </xsl:template>
When I try to do this I get following error: Expression must evaluate to a node-set.
Can somebody give me a hint if this is possible ?
Kind regards, Ismaël
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Putting a nodeset in a va, Vasu Chakkera | Thread | RE: [xsl] Putting a nodeset in a va, Cams Ismael |
Re: [xsl] XSLT on OSX, Daniel Veillard | Date | [xsl] XSL Iteration... or something, Richard Smith |
Month |