Re: [xsl] storing XPath Expression in a variabel, and using it in a document function

Subject: Re: [xsl] storing XPath Expression in a variabel, and using it in a document function
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Wed, 21 Jun 2006 17:17:48 +0530
Hi Linde,
 You cannot do this with pure XSLT 1.0. But some products (for e.g.
Xalan and Saxon) have an extension function xx:evaluate() for dynamic
XPath evaluation.

Regards,
Mukul

On 6/21/06, Linde Lxver <lindelover@xxxxxxxxxxx> wrote:
Hi!
This is a snippet from my xml source file:

<file collection="ieee" name="ex/2003/x1055">
<element path="/article[position()=1]/bdy[position()=1]" exhaustivity="?"/>
<element path="/article[position()=1]/bdy[position()=1]/sec[position()=4]"
exhaustivity="?"/>

I want to use the information in the name and path attribute to retrieve
elements among a set of xml files. For that I'll use the document()
function
like this:

<xsl:variable name="document" select="@name')"/>
<xsl:variable name="path" select="@path"/>
<xsl:variable name="docPath" select="concat('xml/', $name, '.xml')"/>
<xsl:apply-templates select="document($docPath)/$path">

Apparantly this is not working as the variable $path is not a node set. Do
you know a way to make this possible? I read about the exslt dynamic
evaluation, but I weren't able to make it work. Is that the correct way of
solving this problem?

Regards

Linde

Current Thread