Re: [xsl] xpath query in an attribute

Subject: Re: [xsl] xpath query in an attribute
From: Oleg Tkachenko <olegt@xxxxxxxxxxxxx>
Date: Wed, 24 Oct 2001 16:59:02 +0200
Balazs Scheidler wrote:

Hi,

I'm new to XSL, and I'm not sure whether I did something wrong or xalan (the
xslt engine I use is buggy).

So I want to run an XPath query I extracted from an attribute in the XML
document.

Here's what I did:

    <xsl:variable name="query" select="@select"/>
    <xsl:value-of select="$query"/>

The first statement extracts the select attribute from the current node, and
the second _should_ run the query in $query, and return the accompanying
node-set. The problem is that it doesn't, it displays the value of the query
itself.

My question is: how to execute string variables as XPath queries? Any help
welcome.
First of all variable 'query' will actualy hold result of evaluating XPath

expression "@select" but not this expression itself. Read more about variables in xslt.

And second - pure XSLT doesn't

support dynamic XPath expression. If you really want to run that stuff you should probably to use xalan:evaluate() extension function.


-- Oleg Tkachenko Multiconn International, Israel


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread