|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Setting variable based on passed in parameter
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
________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








