XSLT and XPath function reference in alphabetical order
(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)
The Boolean value true.
Purpose of use:
Since in XPath no Boolean constants (or literals) true or false exist, the functions fn:true() or fn:false() are used when such a value is required.
Example 1 – application in the test and debugging phase:
The fn:true() function can be used in order to, for example, enforce the processing of parts of stylesheets during the development, as long as it is not yet possible to impose final conditions:
<xsl:when test="fn:true()"> ... do something ... </xsl:when>
In this case, the conditional instruction block is always executed.
Example 2 – passing on Boolean 'true' to a named template:
When calling up a named template, a parameter can be set to true in the following way:
<xsl:call-template name="with_name"> <xsl:with-param name="the_parameter" select="fn:true()"/> </xsl:call-template>
true() => boolean
fn:true() 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