xsl-list
[Top] [All Lists]

Re: [xsl] boolean variables

2006-08-09 08:24:11

This is a FAQ if (in XSLT1) you use xsl:variable with content then it
always gennerates a result tree fragment which correspnds to a root node
with a child  a text node with the string value of the content. This
acts like a node set with a single / node, in particular it's non empty
so acts as true().

don't do this

        <xsl:variable name="false">
            <xsl:call-template name="get-false"/>
        </xsl:variable>

  <xsl:template name="get-false">
        <xsl:value-of select="false()"/>
    </xsl:template>


do this

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

the first version is equivalent to

<xsl:variable name="false">false</xsl:variable>

which corresponds to a document with thattext, so is non empty and has
boolean value true().

David


--~------------------------------------------------------------------
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>