Hi,
I have the following snipset of code
<xsl:variable name="cId" value="c001" />
<clients>
<c001>Mario</c001>
<c002>Luigi</c002>
</clients>
And Based on variable's value, I need to select the correct element under clients.
For Example. variable cId is assigned with value c001. Is there a way for me to select the value of c001 using XPATH or XSLT?
I can do it this way, but seems like for-loop is a little bit over kill
<xsl:variable name="cId" value="c001" />
<xsl:for-each select="/clients/*">
<xsl:variable name="cNode" select="local-name()"/>
<xsl:if test="$cNode = $cId">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
The code above will return "Mario"
Thanks for all the help.