[xsl] A Problem with Variables and Xpath

Subject: [xsl] A Problem with Variables and Xpath
From: Christian.Sisti@xxxxxxxxxxx
Date: Mon, 25 Jul 2011 15:13:29 +0000
Hi All!

It is possible to gather the value of an attribute using variable in
Xpath? How?

I have a variable like this:

<xsl:variable name="foo">something</xsl:variable>

and I am trying to set an attribute in this way:

<disney>
  <xsl:attribute name="mickey">
   <xsl:value-of select="./$foo"/>
  </xsl:attribute>
</disney>

where $foo is the name of an attribute of the source document.

The (wrong) output is:

<disney mickey="something">
</disney>

while the desired one is:

<disney mickey="valueof(something)">
</disney>

Thanks for help!

Christian

P.S.
I am using XSLT and Xpath 2.0

Current Thread