home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8"?>
- <!-- ===========================================================
- Category: DataFormatting
- Sub-category: Numeric Formatting
- Author: David Silverlight
- HeadGeek@xmlpitstop.com
- Created: 2001-05-16
- Description:-
- This stylsheet demonstrates how various numeric formatting
- masks ('000.00', '$#00%', '###0.00') can be used to display
- numeric data in various output formats.
- ================================================================ -->
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="html" encoding="ISO-8859-1" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN" />
-
- <xsl:template match="/">
- <html>
- <head>
- <title>DataFormatting - Numeric Formatting</title>
- <style type="text/css">
- H1 {COLOR: red; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
- H2 {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- .head {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
- .subhead {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- .text {COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
- TH {COLOR: white; FONT-FAMILY: Arial; background-color: darkblue;}
- TD {COLOR: darkblue; FONT-FAMILY: Arial}
- TR { background-color: beige; }
- BODY { background-color: beige; }
- </style>
- </head>
- <body>
- <h1>Employee Listing</h1>
- <table border="1">
- <tr>
- <th>Emp ID</th>
- <th>Name</th>
- <th>Hourly Rate</th>
- <th>000.00</th>
- <th>$#00%</th>
- <th>###0.00</th>
- <th>#,00;(#,00)</th>
- <th>#,00;#,00CR</th>
- <th>#,###,###</th>
- <th>##.##</th>
- <th>#,##0.00</th>
- </tr>
- <xsl:for-each select="/employees/employee">
- <tr>
- <td>
- <xsl:value-of select="@EmployeeID" />
- </td>
- <td>
- <xsl:value-of select="concat(@FirstName, ' ', @LastName)" />
- </td>
- <td>
- <xsl:value-of select="@HourlyRate" />
- </td>
- <td>
- <xsl:value-of select="format-number(number(@HourlyRate),'000.00')" />
- </td>
- <td>
- <xsl:value-of select="format-number(number(@HourlyRate),'$#00%')" />
- </td>
- <td>
- <xsl:value-of select="format-number(number(@HourlyRate),'###0.00')" />
- </td>
- <td>
- <xsl:value-of select="format-number(number(@HourlyRate),'#,00;(#,00)')" />
- </td>
- <td>
- <xsl:value-of select="format-number(number(@HourlyRate),'#,00;#,00CR')" />
- </td>
- <td>
- <xsl:value-of select="format-number(number(@HourlyRate),'#,###,###')" />
- </td>
- <td>
- <xsl:value-of select="format-number(number(@HourlyRate),'##.##')" />
- </td>
- <td>
- <xsl:value-of select="format-number(number(@HourlyRate),'#,##0.00')" />
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </body>
- </html>
- </xsl:template>
- </xsl:stylesheet>