home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8"?>
- <!-- ===========================================================
- Category: OneToManyMany
- Author: David Silverlight
- HeadGeek@xmlpitstop.com
- Created: 2001-05-16
- Description:-
- This stylsheet demonstrates a 1-M-M relationship of Company
- to Category to Employees. Also note that we are using the
- Pull method to extract data from our xml document. The pull
- method is an approach where the use of templates is
- minimized and data is accessed ny 'pulling' it from our xml
- document
- ================================================================ -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="html" />
-
- <xsl:template match="/">
- <html>
- <head>
- <title>Stylesheet Example</title>
- <style type="text/css"><![CDATA[
- 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 bgcolor="beige">
- <font face="arial">
- <h1>Company Employee per Category listing for Infoteria</h1>
- <xsl:for-each select="/Company/Category">
- <span class="subhead">Category</span>
- <font face="arial" size="3" color="Black">
- <xsl:value-of select="@Name" />
- </font>
- <br />
- <br />
- <span class="subhead">Employee Listing</span>
- <br />
- <table border="1">
- <tr>
- <th>Name</th>
- <th>Position</th>
- <th>Email</th>
- </tr>
- <xsl:for-each select="Employee">
- <tr>
- <td>
- <xsl:value-of select="FirstName" />
- <xsl:value-of select="LastName" />
- </td>
- <td>
- <xsl:value-of select="Position" />
- </td>
- <td>
- <xsl:value-of select="Email" />
- </td>
- </tr>
- </xsl:for-each>
- </table>
- Total Employees:
- <xsl:value-of select="count(Employee)" />
- <br />
- <br />
- </xsl:for-each>
- <br />
- </font>
- </body>
- </html>
- </xsl:template>
- </xsl:stylesheet>
-