[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Evaluating XPath expressions found in the source document
Subject: Re: [xsl] Evaluating XPath expressions found in the source document From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Thu, 16 Aug 2001 11:03:58 +0100 |
Hi James, > If the source document that I am processing contains XPath > expressions, how do I write a stylesheet that will process them? The easiest way is to use an extension function to dynamically evaluate strings as XPath expressions. What type of dynamic evaluation is available to you depends on your processor. Saxon and Xalan-J both have evaluate() extension functions in their respective namespaces. In MSXML, it's fairly straight forward to write your own extension function for evaluating location paths but I haven't seen one for other expressions. But if you want a pure XSLT solution, you need a two-stage process in which you construct a stylesheet from your XML document, and then run that generated stylesheet. So for example, in your stylesheet you'd have: <xsl:element name="xsl:value-of"> <xsl:attribute name="select"> <xsl:value-of select="rootTag" /> </xsl:attribute> </xsl:element> which would create the following in the stylesheet that you generate: <xsl:value-of select="concat('A', 'B')" /> You can then run this generated stylesheet to get the result that you're after. Of course you could always write an XPath parser and evaluator in XSLT, but that's likely to take a fair amount of work :) Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Evaluating XPath expressi, Jeni Tennison | Thread | Re: Re: [xsl] Evaluating XPath expr, Mark Galbreath |
Re: [xsl] Evaluating XPath expressi, Jeni Tennison | Date | Re: [xsl] multiple output files in , jay |
Month |