The not function returns true if its argument is false, and false otherwise. : Boolean Functions  « XSLT stylesheet « XML Tutorial






File: Data.xml

<?xml version="1.0" encoding="utf-8"?>
<data>
    <car id="a234" checked="yes"/>
    <car id="a111" checked="yes"/>
    <car id="a005"/>
</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="car[not(@checked)]">
      <paragraph>
        <B style="color:red">
          <xsl:value-of select="@id"/>
        </B>
      </P>
    </xsl:template>
    <xsl:template match="car[@checked]">
      <paragraph>
        <B style="color:blue">
          <xsl:value-of select="@id"/>
        </B>
      </P>
    </xsl:template>
</xsl:stylesheet>

Output:

<?xml version="1.0" encoding="UTF-8"?>
    <paragraph><B style="color:blue">a234</B></P>
    <paragraph><B style="color:blue">a111</B></P>
    <paragraph><B style="color:red">a005</B></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