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

Re: xsl:for-each result

Subject: Re: xsl:for-each result
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 4 Mar 2005 17:43:30 GMT
result tree fragment boolean value
>  Shouldn't the title-suffix variable
> be bound to an empty sequence, whose effective boolean value is false?

No (the wording of that is the only indication that you might be using
xslt2) I'll give the XSLT1 answer first (which is a faq)

using a variable with no select attribute and non empty content it
always generates a result tree fragment which contains at least a root
node below that any nodes that are generated by the content.

So it always corresponds to a node set with exactly one value (/)
so count(xx:node-set($x)) is always one and it always counts as true()
as it is equivalent to a non empty node set.

In xslt 2 the above is true still if you replace "result tree fragment"
by sequence, "root node" by "document node" and delete reference to the
node-set extension.

However in xslt2 you have the option of adding as="element()*" (for
example) to the variable binding in which case the generated sequence of
elements will be returned directly as the result of the variable not all
made children of an implied document node. 

then it will coerce to false if empty.

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.