[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: cascading evaluation of variables

Subject: Re: cascading evaluation of variables
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 11 Oct 2004 11:13:32 +0100
java evaluate
You can't evaluate a string as an Xpath expression in Xpath (or XSLT)
just as you can't evaluate a string "x + 1" In C or java or most other
languages, without writing a parser for the language contained in the
string.
Saxon (and perhaps some other systems) does offer an evaluate()
extension function that does provide an XPath parser and evaluation
system at run time.

the way do do this in pure XSLT is first write out a stylesheet
containing the generated Xpath, then execute the second stylesheet.

Also, don't do

<xsl:variable name="essai"><xsl:value-of select="$path1"/>
</xsl:variable>


do

<xsl:variable name="essai" select="$path1"/>


(and similarly your other variable settings)

It's a lot less to type and a lot nore efficient to execure.

If I read your xpath correctly, for this simple case you don't really
need to generate a string and use dynamic evaluation, you can just
execute the Xpath directly.

I think tour source looks like
<something select="foo"/>

and you want to select the parent  of <foo> in the $sourcefile document,
so that would be

<xsl:variable name="select" select="@select"/>
<xsl:copy-of select="document($sourcefile)//*[name()=$select]/.."/>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.