Select node value by variable

I have this code:

<xsl:template name="cad">
      <xsl:param name="CadType"> RCAD </xsl:param>
      <xsl:variable name="FieldName" select="concat('Org-', $CadType)"/>
      <xsl:value-of select="$FieldName">
                <xsl:value-of select="Org-RCAD">
</xsl:template>

<xsl:value-of select="$FieldName"> will give me "Org-RCAD"
whereas <xsl:value-of select="Org-RCAD"> will give me the value in the node <Org-RCAD>value</Org-RCAD>, which is what I want.

How can I pass in a node name through a variable and get the node's value out?  Thanks.
wunyuAsked:
Who is Participating?
 
ramazanyichConnect With a Mentor Commented:
use
<xsl:value-of select="child::*[name()=$FieldName]"/>
instead of
<xsl:value-of select="Org-RCAD">
0
 
wunyuAuthor Commented:
Thanks for the quick solution.  It worked!!!
0
All Courses

From novice to tech pro — start learning today.