XSLT and XPath function reference in alphabetical order

(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z



Boolean functions


XPath 1.0

Return value:

The Boolean value false.



No arguments.

Purpose of use:

Since there are no Boolean constants (or literals) true and false in XPath, the functions fn:true() and fn:false() are used when such a construct is required.

Example – usage in the test and debugging phase:

The fn:false() function can be used in order to, for example, prevent the processing of parts of stylesheets during the development as long as it is not yet possible to formulate definite conditions.

<xsl:when test="fn:false()">
   <!-- suppressed template section -->

The contained instruction block is suppressed. This is quasi tantamount to commenting out this xsl:when block. The function can and should sometime be replaced by a more useful condition.

Better than commenting out:
It may be easier to exclude a xsl:if or xsl:when block with the help of fn:false() as the value of the test attribute value than to comment it out. In case there are comments within the block, these have to be removed at first because otherwise a forbidden nesting of comments would occur.

Function definition:

XPath 1.0:

false() => boolean

XPath 2.0:

fn:false() as xs:boolean


<< back next >>




Copyright © Galileo Press, Bonn 2008
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSLT 2.0 & XPath 2.0" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.

Galileo Press, Rheinwerkallee 4, 53227 Bonn, Germany