>> English << | Français | Deutsch | Magyar | 中文 | Polski ZVON > Tutorials > XSLT Tutorial
>> Page 44 << | Prev | Next | Contents | Element Index

The not function returns true if its argument is false, and false otherwise.

XSLT stylesheet 1

XML Source
<source>

<car id="a234" checked="yes"/>
<car id="a111" checked="yes"/>
<car id="a005"/>

</source>

Output
<P>
  <B style="color:blue">a234</B>
</P>

<P>
  <B style="color:blue">a111</B>
</P>

<P>
  <B style="color:red">a005</B>
</P>

HTML view

a234

a111

a005

XSLT stylesheet
<xsl:stylesheet version = '1.0'
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="car[not(@checked)]">
     <P>
          <B style="color:red">
               <xsl:value-of select="@id"/>
          </B>
     </P>
</xsl:template>

<xsl:template match="car[@checked]">
     <P>
          <B style="color:blue">
               <xsl:value-of select="@id"/>
          </B>
     </P>
</xsl:template>


</xsl:stylesheet>