|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Does XSL support an eval?
At 00/05/02 02:23 +1000, JamesW@xxxxxxxxxxxxxxx wrote:
Is there a way in XSL to take an XPath query described in a parameter or variable, and reference this parameter in the select attribute of say, xsl:for-each to iterate through the node set described by the query. You are *so* close that I hope you don't get hurt kicking yourself. Using standard XSLT 1.0 (no extensions) you can assign a node set to a variable using an XPath expression ... unfortunately, you quoted your expression which is assigning a string value to the variable, not a node set. When you assign a node set and you remove the brace brackets you have, it works just fine (see example below). I hope this helps. ................ Ken
T:\ftemp>type test.xsl <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"><xsl:output method="text"/> <xsl:template match="/"> <!--root rule-->
<xsl:variable name="myPath" select="/my/XPath/@query"/>
<xsl:for-each select="$myPath">
<xsl:text>Value: </xsl:text>
<xsl:value-of select="."/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template></xsl:stylesheet> T:\ftemp>xt test.xml test.xsl Value: first Value: third Value: second T:\ftemp> -- G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) Web site: XSL/XML/DSSSL/SGML services, training, libraries, products. Practical Transformation Using XSLT and XPath ISBN 1-894049-04-7 Next instructor-led training: 2000-05-11/12,2000-05-15, - 2000-06-12,2000-06-13,2001-01-27 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








