RE: [xsl] not()'ing a false variable, xalan 2.4.D1

Subject: RE: [xsl] not()'ing a false variable, xalan 2.4.D1
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 8 Nov 2002 09:01:46 -0000
>     <!-- make a false variable entitled 'false-variable' -->
>     <xsl:variable name="false-variable">
>       <xsl:value-of select="false()"/>
>     </xsl:variable>
> 

You are creating a variable whose value is a result-tree-fragment,
specifically, a tree consisting of a document node owning a text node.
The string-value of the text node is obtained by converting the boolean
value false() to a string, so it will be the string "false". When a
result-tree-fragment is converted to a boolean, the result is always
true().

Write <xsl:variable name="false-variable" select="false()"/>

In fact, 99% of the time that you see an <xsl:variable> containing a
single <xsl:value-of> instruction, it would be better to use the select
attribute instead.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread