RE: [xsl] an Xpath question - $tag/$subtag

Subject: RE: [xsl] an Xpath question - $tag/$subtag
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 8 Jul 2003 09:27:54 +0100
> 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


Current Thread