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

Re: Setting variable based on passed in parameter

Subject: Re: Setting variable based on passed in parameter
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 30 Nov 2004 16:24:14 GMT
setting variable
  I'm trying to assign a variable a node-set that depends on a parameter
  passed into the stylesheet.


  <xsl:variable name="initialResult">
      <xsl:choose>


If you use xsl:variable with content rather than a select attribute the
result is always a result tree fragment and never a node set.

Most XSLT processors have an xx:node-set() extension function that will
coerce the result tree fragment to a node set (of one node, a / node of
a new tree contating the nodes you have generated) actually in this case
you have used value-of so you have only a single string value so your
node set would have no element nodes just a root node containing a text node
with this string. xsl:value-of when supplied a node set always discards
all but the first node, and returns the string value of the first.


Both brances of your choose selected the same thing but I suppose that's
a cutnpaste error?

however I don't think you want to generate new nodes, just select nodes
in the source, so:


 <xsl:variable name="initialResult" select="
/one[$valueSearch='false']/two[three/four[contains(text(),$nodeValue)]]
|
/one[$valueSearch!='false']/two[three/four[contains(text(),$nodeValue)]]

"/>

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.