<?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited by XMLSpy® --> <catalog> <cd> <name id ="4" price = "10" > ABC </name> </cd> <cd> <name id ="2" price = "15" > DEF </name> </cd> <cd> <name id ="1" price = "8" > GHI </name> </cd> <cd> <name id ="3" price = "7" > JKL </name> </cd> </catalog>
XSL file
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited by XMLSpy® --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>name</th> <th>price</th> </tr> <xsl:for-each select="catalog/cd/name"> <xsl:if test="@price < 10"> <tr> <td><xsl:value-of select="@id"/></td> <td><xsl:value-of select="@price"/></td> </tr> </xsl:if> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
i get no output when <xsl:if test="@price < 10">
but when i say
<xsl:if test="@price > 10">
i get required results
Why is that?