June 2008
Intermediate to advanced
986 pages
27h 8m
English
true()
Always returns the boolean value true. Remember that the strings
"true" and "false" don’t
have any special significance in XSLT. This function (and the
false() function) allow you
to generate boolean values when you need them.
[1.0] booleantrue()[2.0] xs:booleantrue()
None.
The boolean value true.
[1.0] 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.”
Here’s a brief example that uses the true() function:
<?xml version="1.0"?>
<!-- true.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 true() function:

</xsl:text>
<xsl:text> true() returned </xsl:text>
<xsl:value-of select="true()"/>
<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 true() function: true() returned true!
Read now
Unlock full access