false() Function | |
Always returns the boolean value false. Remember that the strings "true" and "false" don't have any special significance in XSLT. This function (and the true() function) allow you to generate boolean values directly when you need them. | |
Inputs | |
None. |
|
Output | |
The boolean value false. |
|
Defined in | |
XPath section 4.3, Boolean Functions. |
|
Example | |
Here's a brief example that uses the false() function: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:variable name="newline"> <xsl:text> </xsl:text> </xsl:variable> <xsl:template match="/"> <xsl:value-of select="$newline"/> <xsl:text>A test of the false() function:</xsl:text> <xsl:value-of select="$newline"/> <xsl:value-of select="$newline"/> <xsl:choose> <xsl:when test="false()"> <xsl:text> "false()" returned true!</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text> "false()" returned false!</xsl:text> </xsl:otherwise> </xsl:choose> </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! |