Subject: Re: Does XSL support an eval? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Tue, 02 May 2000 17:59:47 +0200 |
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.
ie.
<xsl:variable name="myPath" select="'/my/XPath/@query'"/> <xsl:for-each select="{$myPath}"> ... </xsl:for-each>
We were under the impression that using the curly braces might achieve this, but haven't had any luck so far.
T:\ftemp>type test.xml <?xml version="1.0"?> <my> <XPath query="first"> </XPath> <XPath query="third"> </XPath> <XPath query="second"> </XPath> </my>
T:\ftemp>type test.xsl <?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<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>
T:\ftemp>xt test.xml test.xsl Value: first Value: third Value: second
-- 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Does XSL support an eval?, David Halsted | Thread | IE 5.0 Mac, FileMaker Pro, & HTML F, Roger W Jacques |
Re: XSL-List guidelines, Matt Sergeant | Date | Puzzled by the XT and MSXML result., Didier PH Martin |
Month |