Get attribute value by its string name

O

Oleg.Ogurok

Hi there,

In an XSLT stylesheet, I need to get a value of an attribute. The
problem is that I need to generate the name of the attribute on the
fly.
Is it possible to get the value of an attribute knowing its string
represented name?


E.g.


<xsl:attribute name="name">
<xsl:value-of select="concat($FieldPrefix, 'Name')"/>
</xsl:attribute>


The result is the concatenated string, e.g.
<pwm_regardingrulesetid name="MyGivenPrefixName" ...


However, MyGivenPrefixName is an attribute name in the source XML file,

and I need to get its value instead.


I tried the following, which didn't work
<xsl:value-of select="@(concat($FieldPrefix, 'Name'))"/>


Thanks,
-Oleg.
 
R

Richard Tobin

I tried the following, which didn't work
<xsl:value-of select="@(concat($FieldPrefix, 'Name'))"/>

You can't do that; but you can do something like

select="@*[name() = concat($FieldPrefix, 'Name')]"

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top