Functions true() and false() are useful, when some conditions are tested during programming : Boolean Functions  « XSLT stylesheet « XML Tutorial






File: Data.xml

<?xml version="1.0" encoding="utf-8"?>
<data>
    <number>0</number>
    <number>1</number>
</data>

File: Transform.xslt

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="number">
      <paragraph>
        <xsl:if test="true()">
          <xsl:text>true </xsl:text>
        </xsl:if>
        <xsl:if test="not(false())">
          <xsl:text>not false</xsl:text>
        </xsl:if>
      </P>
    </xsl:template>
</xsl:stylesheet>

Output:

<?xml version="1.0" encoding="UTF-8"?>
    <paragraph>true not false</P>
    <paragraph>true not false</P>








5.38.Boolean Functions
5.38.1.Boolean Functions
5.38.2.Use strings as arguments of boolean() function.
5.38.3.compares "0" as a string and as a number
5.38.4.uses node-sets as arguments for boolean() function
5.38.5.The not function returns true if its argument is false, and false otherwise.
5.38.6.Functions true() and false() are useful, when some conditions are tested during programming