xsl-list
[Top] [All Lists]

Re: [xsl] xalan:nodeset

2006-11-26 05:56:50
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[(_at_)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[(_at_)rdf:ID
                    = $contextID]"/>

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


J.Pietschmann

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

<Prev in Thread] Current Thread [Next in Thread>