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

RE: Navigating through the document using variables

Subject: RE: Navigating through the document using variables
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 31 May 2005 22:59:33 +0100
using variables to navigate
> I have a variable initialized at runtime with the path to some element
> (something like this /elem1/elem2/elem3). Can I use this variable to
> navigate to the elem3 in another variable that is initialized with the
> document like this:
> <xsl:variable name="doc" select="document('./somedocument.xml')"/>
> 

A number of products including Saxon support an xx:evaluate() extension
which allows you to evaluate an XPath expression that's held in a string (or
in a node in a source document), but it's not part of the standard XSLT 1.0
or 2.0 language. It's a very useful extension though!

You have to be careful with the context for the expression: both the static
context (in-scope variables, namespaces) and the dynamic context (context
item and position). You'll almost certainly find that different products
handle these questions differently.

Michael Kay
http://www.saxonica.com/

Current Thread

Back To School Sale!

Save 30% off all Stylus Studio 2008 Products when you purchase from our Online Shop.

Offer ends August 31, 2008.

Coupon Code
TRTY-C4JV-OFF

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-2007 All Rights Reserved.