Re: [xsl] xsl:for-each result

Subject: Re: [xsl] xsl:for-each result
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 4 Mar 2005 17:43:30 GMT
>  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.


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:

Current Thread