xsl-list
[Top] [All Lists]

RE: an Xpath question - $tag/$subtag

2003-07-08 01:27:54
At 2003-07-07 14:10 -0400, Anil wrote:
  here is my problem..i have to use 2 variables to reach a 
tag in my 
xml, i tried using

    <xsl:apply-templates select="$tag/$subtag">


Guessing from the names of the variables, I suspect that $tag and
$subtag are variables containing element names as strings, in which case
the answer is

select="*[name()=$tag]/*[name()=$subtag]

(assuming there are no namespace complications).

Note, as we often tell people on this list, variables are not macros.
They represent values, not parts of an XPath expression. You can only
use them in places where you could use a value, or an expression such as
a function call.

Michael Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list