[xsl] Re : [xsl] How to handle dynamic XPath

Subject: [xsl] Re : [xsl] How to handle dynamic XPath
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Sun, 12 Apr 2009 19:52:19 +0000 (GMT)
fred@xxxxxxxxxxxxx wrote:

  Hi,

> <xsl:with-param name="instance.path"
> select="concat($instance.path,'/',$element.prefix,':',@name)"
> />

  You cannot evaluate an XPath expression supplied as a string in plain XSLT.
You can use extensions though for that purpose (of your own or existing one.)
I haven't looked deeply into your problem, but I'd say I'd rather user
either:

  1/ maintaining a pointer in the instance and selecting its correct
child(ren) using local-name() and namespace-uri() for each step;

  2/ or using a meta-stylesheet: your stylesheet generates another XSLT
stylesheet that contains the XPath expressions (you "compile" the schema to
the equivalent stylesheet) and you apply this stylesheet to the instance in a
second execution.

  Regards,

--
Florent Georges
http://www.fgeorges.org/

Current Thread