1<?xml version="1.0"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 3 4 <xsl:output method="html" indent="no" doctype-public="-//W3C//DTD HTML 4.0 Transitional"/> 5 6 <!-- FileName: OUTP60 --> 7 <!-- Document: http://www.w3.org/TR/xslt --> 8 <!-- DocVersion: 19991116 --> 9 <!-- Section: 16.2 HTML Output Method --> 10 <!-- Purpose: Do everything inside an HTML element. Note first item in this file. --> 11 12<xsl:template match="/"> 13 <html lang="en"> 14 <head> 15 <title>Sales Results By Division</title> 16 </head> 17 <body> 18 <table border="1"> 19 <tr> 20 <th>Division</th> 21 <th>Revenue</th> 22 <th>Growth</th> 23 <th>Bonus</th> 24 </tr> 25 <xsl:for-each select="sales/division"> 26 <!-- order the result by revenue --> 27 <xsl:sort select="revenue" 28 data-type="number" 29 order="descending"/> 30 <tr> 31 <td> 32 <em><xsl:value-of select="@id"/></em> 33 </td> 34 <td> 35 <xsl:value-of select="revenue"/> 36 </td> 37 <td> 38 <!-- highlight negative growth in red --> 39 <xsl:if test="growth < 0"> 40 <xsl:attribute name="style"> 41 <xsl:text>color:red</xsl:text> 42 </xsl:attribute> 43 </xsl:if> 44 <xsl:value-of select="growth"/> 45 </td> 46 <td> 47 <xsl:value-of select="bonus"/> 48 </td> 49 </tr> 50 </xsl:for-each> 51 </table> 52 </body> 53 </html> 54</xsl:template> 55 56 57 <!-- 58 * Licensed to the Apache Software Foundation (ASF) under one 59 * or more contributor license agreements. See the NOTICE file 60 * distributed with this work for additional information 61 * regarding copyright ownership. The ASF licenses this file 62 * to you under the Apache License, Version 2.0 (the "License"); 63 * you may not use this file except in compliance with the License. 64 * You may obtain a copy of the License at 65 * 66 * http://www.apache.org/licenses/LICENSE-2.0 67 * 68 * Unless required by applicable law or agreed to in writing, software 69 * distributed under the License is distributed on an "AS IS" BASIS, 70 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 71 * See the License for the specific language governing permissions and 72 * limitations under the License. 73 --> 74 75</xsl:stylesheet> 76