This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xpath query in an attribute
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] xpath query in an attribute
- From: Oleg Tkachenko <olegt at multiconn dot com>
- Date: Wed, 24 Oct 2001 16:59:02 +0200
- Organization: Multiconn International
- References: <20011024163201.A12982@balabit.hu>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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