Solved

Select node value by variable

Posted on 2004-10-06
2
378 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
2 Comments
 
LVL 19

Accepted Solution

by:
ramazanyich earned 100 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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. 
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now