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

Re: Variable Substitution In A Select Statement

Subject: Re: Variable Substitution In A Select Statement
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Tue, 24 May 2011 15:16:14 +0200
Re:  Variable Substitution In A Select Statement
Raymond Lillibridge wrote:
xsl-list Members,

Using Saxon-PE 9.3.0.5J from Saxonica (XSLT 2.0):

The following template matches on the specified @id in $FileA. Just what I need.

<xsl:apply-templates select="$FileA/book/level1[2]/level2[4]/section[2]/@id" />

However, if I have a variable, $Axpath_new, valued at "book/level1[2]/level 2[4]/section[2]", the following template returns nothing:

<xsl:apply-templates select ="$FileA/$Axpath_new/@id" />

Testing a multitude of methods, I could never get a variable to work in the select statement.
After much studying about how to make the template work properly, I read that I could try using the extension function node-set().  Further research stated that my free version of Saxon9 doesn't include those extensions but the Saxon9pe version does.  So, I purchased a copy of Saxon9pe and installed it yesterday.  (Also, I believe I read that if I was using XSLT 2.0, I wouldn't need to use the node-set() function.)

Any way, it seems like such a simple thing but I'm at a loss, and I'm asking for your kind assistance.

Well node-set is an extension function that is not needed at all in XSLT 2.0.
You need evaluate instead
<xsl:apply-templates xmlns:saxon="http://saxon.sf.net/" select ="$FileA/saxon:evaluate($Axpath_new)/@id" />





--


	Martin Honnen --- MVP Data Platform Development
	http://msmvps.com/blogs/martin_honnen/

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.