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

RE: substitute variable value into xpath expression -

Subject: RE: substitute variable value into xpath expression - problem
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 11 Apr 2005 15:29:10 +0100
xpath variable value
Variables represent run-time values, not compile-time strings that can be
textually substituted into an XPath expression. Use 

  msxml:node-set(..)/*[name()=$XML_PARENT]/*[name()=$XML_CHILD]

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

> -----Original Message-----
> From: Hardy Merrill [mailto:HMerrill@xxxxxxxxxxxxxxxx] 
> Sent: 11 April 2005 15:19
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  substitute variable value into xpath 
> expression - problem
> 
> This is using MSXSL4.
> 
> near the top of the stylesheet
> *------------------------------------
> <xsl:variable name="XML_PARENT" select="'training_types'" />
> <xsl:variable name="XML_CHILD" select="'training_type'" />
> 
> down in the body
> *--------------------
> <xsl:for-each 
> select="msxsl:node-set($TRAINING_TYPE_XMLDOC)/$XML_PARENT/$XML_CHILD">
> 
> The TRAINING_TYPE_XMLDOC is fine - it's the XML_PARENT and 
> XSL_CHILD that I'm having trouble with.  All I'm really 
> trying to do is substitute in the literal values of the 
> XSL_PARENT and XSL_CHILD into the XPath select.  Here is the 
> error I'm getting:
> 
> *------------------
> NodeTest expected here. 
> msxsl:node-set($TRAINING_TYPE_XMLDOC)/-->$<--XML_PARENT/$XML_CHILD 
> *------------------
> 
> I'm sure it's something stupid I'm doing/not doing - please 
> let me know what it is.
> 
> Thanks.
> 
> Hardy Merrill

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.