?
Solved

Select node value by variable

Posted on 2004-10-06
2
Medium Priority
?
388 Views
Last Modified: 2010-05-18
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.
0
Comment
Question by:wunyu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
ramazanyich earned 400 total points
ID: 12241120
use
<xsl:value-of select="child::*[name()=$FieldName]"/>
instead of
<xsl:value-of select="Org-RCAD">
0
 

Author Comment

by:wunyu
ID: 12242043
Thanks for the quick solution.  It worked!!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question