Mega Code Archive

 
Categories / XML Tutorial / XSLT StyleSheet
 

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

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>