This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Converting a string to node test
- To: Xavier Cazin <cazinx at online dot fr>
- Subject: Re: [xsl] Converting a string to node test
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Sat, 21 Apr 2001 16:04:33 +0100
- CC: xsl-list at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <87bspqd1le.fsf_-_@online.fr>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Xavier,
> <!-- This line works -->
> <xsl:copy-of select="$x[@my-attrib-name=$z]/node()"/>
> <!-- This line doesn't, nor any line of that kind I've tried... -->
> <xsl:copy-of select="$x[@$y=$z]/node()"/>
Here, you're trying to evaluate a string (held in the $y variable) as
(part of) an XPath. You can't do that without an extension function
like saxon:evaluate() to do the evaluation.
However, you can compare the name of an attribute to the string. So
you can use the following to find the attribute with the name given by
the $y variable:
@*[local-name() = $y]
And therefore use:
<xsl:copy-of select="$x[@*[local-name() = $y] = $z]/node()" />
I hope that helps,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list