topical media & game development
professional-xml-08-language-iftest2.xsl / xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title></title>
</head>
<body><table>
<tbody>
<tr>
<th align="left">Product</th>
<th>Price</th>
</tr>
<xsl:apply-templates select="//product" />
</tbody>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="product">
<tr>
<td><xsl:value-of select="name" /></td>
<td>
<xsl:if test="price <= 20">
<xsl:attribute name="bgcolor">#E0E0E0</xsl:attribute>
</xsl:if>
<xsl:value-of select="format-number(price, '#.00')" /></td>
</tr>
</xsl:template>
</xsl:stylesheet>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.