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

Re: [xsl] xalan:nodeset


Subject: Re: [xsl] xalan:nodeset
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Sun, 26 Nov 2006 13:56:32 +0100

Nima Kaviani wrote:
I have the following XML file:
[snip]
and I have used the following construct to store some of the elements
in a variable based on an equality between the values of the
attributes:

<xsl:param name="contextID" select="policy:context/@rdf:resource"/>
<xsl:variable name="contexts">
<xsl:copy-of select="//constraint:SimpleConstriant[@rdf:ID = $contextID]"/>
</xsl:variable>


apparantly the variable "contexts" has stored the relevant information
but when I try to read it, using for-each or whatever else, nothing is
displayed. so the code below is not working:

<xsl:for-each select="xalan:nodeset($contexts)">
    <xsl:value-of select="constraint:SimpleConstriant/@rdf:ID"/>
</xsl:for-each>

while <xsl:copy-of select="xalan:nodeset$contexts)"/> shows that the
desired values are stored in the variable.

Selecting from a RTF-converted-nodeset can be tricky, however it looks like that the context elements in the for-each are already the constraint:SimpleConstriant elements, and you can just select the necessary attribute.

The real question is: why do you actually create the "contexts"
variable as RTF? You should be able to do the following, without
the nodeset() extension:

 <xsl:param name="contextID" select="policy:context/@rdf:resource"/>
 <xsl:variable name="contexts"//constraint:SimpleConstriant[@rdf:ID
                    = $contextID]"/>

 <xsl:for-each select="$contexts">
     <xsl:value-of select="@rdf:ID"/>
 </xsl:for-each>


J.Pietschmann



Current Thread
Keywords
xml