This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]