Subject: Re: [xsl]cascading evaluation of variables From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 11 Oct 2004 11:13:32 +0100 |
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 ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl]cascading evaluation of variab, Janvier Majirus FANS | Thread | [xsl] Ignoring Redundancy, michella |
[xsl]cascading evaluation of variab, Janvier Majirus FANS | Date | Re: [xsl] Limiting the number of RS, Werner, Wolfgang |
Month |