1<html xsl:version="1.0"
2      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3      lang="en">
4    <head>
5        <title>Sales Results By Division</title>
6    </head>
7    <body>
8        <table border="1">
9            <tr>
10                <th>Division</th>
11                <th>Revenue</th>
12                <th>Growth</th>
13                <th>Bonus</th>
14            </tr>
15            <xsl:for-each select="sales/division">
16                <!-- order the result by revenue -->
17                <xsl:sort select="revenue"
18                          data-type="number"
19                          order="descending"/>
20                <tr>
21                    <td>
22                        <em><xsl:value-of select="@id"/></em>
23                    </td>
24                    <td>
25                        <xsl:value-of select="revenue"/>
26                    </td>
27                    <td>
28                        <!-- highlight negative growth in red -->
29                        <xsl:if test="growth &lt; 0">
30                             <xsl:attribute name="style">
31                                 <xsl:text>color:red</xsl:text>
32                             </xsl:attribute>
33                        </xsl:if>
34                        <xsl:value-of select="growth"/>
35                    </td>
36                    <td>
37                        <xsl:value-of select="bonus"/>
38                    </td>
39                </tr>
40            </xsl:for-each>
41        </table>
42    </body>
43</html>
44