EXSLT String Tokenizer Context

156 Views Asked by At

What is the current node context inside an EXSLT Tokenizer for-each loop? I do not seem to be able to query any nodes in the documents. example:

<xsl:for-each select="str:tokenize($renderList,',')">
   <xsl:variable name ="tag" select="."/>
   <xsl:value-of select = "//tag[@name = $tag]"/>
</xsl:for-each>

If I hardcode <xsl:value-of select = "//tag[@name = 'A']"/> out side the for-each loop, the query works.

What is the context node inside the loop?

1

There are 1 best solutions below

0
On BEST ANSWER

The problem is that in the xsl:for-each the current document isn't the original source XML document.

This should work:

<xsl:variable name="vDoc" select="/"/>
<xsl:for-each select="str:tokenize($renderList,',')">
    <xsl:variable name ="tag" select="."/>
    <xsl:value-of select = "$vDoc//tag[@name = $tag]"/>
</xsl:for-each>