srini.venigalla
srini.venigalla

Reputation: 5145

EXSLT String Tokenizer Context

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?

Upvotes: 3

Views: 149

Answers (1)

Dimitre Novatchev
Dimitre Novatchev

Reputation: 243459

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>

Upvotes: 4

Related Questions