Re: cascading evaluation of variables
You can't evaluate a string as an Xpath expression in Xpath (or XSLT) just as you can't evaluate a string "x + 1" In C or java or most other languages, without writing a parser for the language contained in the string. Saxon (and perhaps some other systems) does offer an evaluate() extension function that does provide an XPath parser and evaluation system at run time. the way do do this in pure XSLT is first write out a stylesheet containing the generated Xpath, then execute the second stylesheet. Also, don't do <xsl:variable name="essai"><xsl:value-of select="$path1"/> </xsl:variable> do <xsl:variable name="essai" select="$path1"/> (and similarly your other variable settings) It's a lot less to type and a lot nore efficient to execure. If I read your xpath correctly, for this simple case you don't really need to generate a string and use dynamic evaluation, you can just execute the Xpath directly. I think tour source looks like <something select="foo"/> and you want to select the parent of <foo> in the $sourcefile document, so that would be <xsl:variable name="select" select="@select"/> <xsl:copy-of select="document($sourcefile)//*[name()=$select]/.."/> David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
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