Name
false()
Always returns the boolean value false
. Remember that the strings “true”
and “false” don’t have any special significance in XSLT; any
string with a length greater than zero is true. This function (and
the true()
function) allow
you to generate boolean values when you need them.
Syntax
[1.0] booleanfalse(
)
[2.0] xs:booleanfalse()
Inputs
None.
Output
The boolean value false
.
Defined in
XPath section 4.3, “Boolean Functions.”
[2.0] XQuery 1.0 and XPath 2.0 Functions and Operators Section 9.1, “Additional Boolean Constructor Functions.”
Example
Here’s a brief example that uses the false()
function:
<?xml version="1.0"?> <!-- false.xsl --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:text>
A test of the false() function:

</xsl:text> <xsl:text> false() returned </xsl:text> <xsl:value-of select="false()"/> <xsl:text>!</xsl:text> </xsl:template> </xsl:stylesheet>
When using this stylesheet against any XML document, it generates this less-than exciting result:
A test of the false() function: false() returned false!
Get XSLT, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.