RE: [xsl] Using a variable to get the value of an element

Subject: RE: [xsl] Using a variable to get the value of an element
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Mon, 28 Jan 2002 10:03:16 -0000
> I need the value of an element, but the name of that element is stored
> in a variable - see below:
>
> Where I say <xsl:apply-templates select="$hello" /> I
> actually want the
> value of the element whose name is stored in the variable
> hello, not the
> value of the variable.

Try:

<xsl:apply-templates select="*[name()=$hello]"/>

But remember that this will match on the QName of the element, not its
expanded name, i.e. you will have problems if different prefixes are used
for the same namespace.

Mike Kay


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


Current Thread