xsl-list
[Top] [All Lists]

Re: xsl:for-each result

2005-03-04 10:43:30

 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
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>