Re: Selecting from a node-set using variable path
This works: <xsl:variable name="t1" select="$myNodeSet//a/b/c"/>
How do I filter down my node-set based upon some variable location path?
For simple cases there are pure XPath solutions, however, in your case you'll have to use an extension function to invoke a runtime XPath interpreter, for example <xsl:variable name="myPath">/a/b/c</xsl:variable> <xsl:variable name="t3" select="xx:evaluate(concat('$myNodeset/',$myPath))"/> The inner concat evaluates to the string $myNodeset//a/b/c which in turn is evaluated as XPath expression.
Um, well, IIRC MSXML does not have exactly such an extension function, but you can use a bit of JScript code to emulate this. The EXSLT project at sourceforge should have such code.
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