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

Re: node test in patern from string()

Subject: Re: node test in patern from string()
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 16 Aug 1999 21:35:03 -0400
test patern
At 99/08/16 14:34 -0400, Jon Smirl wrote:
Can anyone help me with how to use a string variable as part of a pattern?
The following is illegal but it shows what I want to do.

  <xsl:call-template name="buildEnum">
   <xsl:with-param name="enum" select="string('region')"/>
  </xsl:template>

  <xsl:template name="buildEnum">
  <xsl:param name="enum"/>
  <xsl:variable name="enums"
select="document('../common/enum.xml')/enums/$enum"/>
  </xsl:template>

The XT error occurs on the variable definition at the $enum - "expected node
test".

If the variable isn't a node set, then it cannot be used directly as a location step in a location path in this fashion, therefore, the XT behaviour is correct.


String variables are allowed in *predicates*, so you could select all element children and then filter based on the element type name:

  <xsl:variable name="enums"
select="document('../common/enum.xml')/enums/*[local-name(.)=$enum]"/>

I hope this helps.

........... Ken

--
G. Ken Holman                    mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
Website:  XSL/XML/DSSSL/SGML services, training, libraries, products.
Practical Transformation Using XSLT and XPath      ISBN 1-894049-01-2
Next instructor-led training:                     MT'99 1999-12-05/06


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.