[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Converting a string to node test

Subject: Re: Converting a string to node test
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sat, 21 Apr 2001 16:04:33 +0100
xpath string to node
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 Tennison

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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.