|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: xsl:for-each result
> I'm binding the result of for-each to a variable like this:
>
> <xsl:variable name="title-suffix">
> <xsl:for-each select="relation_list/relation[@class='REP']">
> <xsl:call-template name="title-suffix">
> <xsl:with-param name="relation" select="."/>
> </xsl:call-template>
> </xsl:for-each>
> </xsl:variable>
>
> My problem arises when no nodes match the select expression and so the
> title-suffix template isn't called. Shouldn't the
> title-suffix variable
> be bound to an empty sequence, whose effective boolean value is false?
No, it's bound to an empty tree: a document node with no children, whose
effective boolean value is true.
You're using 2.0 here. In 2.0 this kind of thing is done much more easily
using functions. Something like:
<xsl:variable name="title-suffix"
select="for $x in relation_list/relation[@class='REP']
return title-suffix($x)"/>
Michael Kay
http://www.saxonica.com/
|
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








