home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _67B7710988E240CF93AA53C1583726EF < prev    next >
Encoding:
Extensible Markup Language  |  2002-09-13  |  2.8 KB  |  91 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- edited with XML Spy v5 beta 4 U (http://www.xmlspy.com) by Alex Pilz (pilzindustries) -->
  3. <?xmlspysamplexml OrgChartDebug.xml?>
  4. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:n1="http://www.xmlspy.com/schemas/orgchart" xmlns:ipo="http://www.altova.com/IPO" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  5.     <!-- Global Variable Declartions *****************************************-->
  6.     <xsl:variable name="Main_Title" select="string('Employee List')"/>
  7.     <xsl:variable name="Show_Company_Name" select="boolean('true')"/>
  8.     <!-- Root Template ******************************************************-->
  9.     <xsl:template match="n1:OrgChart">
  10.         <html>
  11.             <head>
  12.                 <title> Company 1</title>
  13.             </head>
  14.             <table width="60%">
  15.                 <tbody>
  16.                     <tr>
  17.                         <td>
  18.                             <h1>
  19.                                 <xsl:value-of select="$Main_Title"/>
  20.                             </h1>
  21.                         </td>
  22.                         <td align="left">
  23.                             <b>
  24.                                 (sorted by last name)
  25.                             </b>
  26.                         </td>
  27.                     </tr>
  28.                 </tbody>
  29.             </table>
  30.             <xsl:for-each select="n1:Office">
  31.                 <!-- Local Variable reused -->
  32.                 <xsl:variable name="OfficeName" select="n1:Name"/>
  33.                 <!-- Display the company name if the varaible is true ********* -->
  34.                 <xsl:if test="$Show_Company_Name">
  35.                     <h3>
  36.                         <xsl:value-of select="$OfficeName"/>
  37.                     </h3>
  38.                     <xsl:message>
  39.                         <xsl:text>Company Named Displayed</xsl:text>
  40.                     </xsl:message>
  41.                 </xsl:if>
  42.                 <table width="60%">
  43.                     <tbody>
  44.                         <tr bgcolor="#C0C0C0">
  45.                             <td>
  46.                                 <b>First Name</b>
  47.                             </td>
  48.                             <td>
  49.                                 <b>Last Name</b>
  50.                             </td>
  51.                         </tr>
  52.                         <!-- Sort and Ouput the employees *********************-->
  53.                         <xsl:for-each select="n1:Department/n1:Person">
  54.                             <xsl:sort select="n1:Last"/>
  55.                             <xsl:variable name="Christian-name" select="n1:First"/>
  56.                             <tr>
  57.                                 <td>
  58.                                     <xsl:value-of select="$Christian-name"/>
  59.                                 </td>
  60.                                 <td>
  61.                                     <xsl:call-template name="Surname">
  62.                                         <xsl:with-param name="Family-name" select="n1:Last"/>
  63.                                     </xsl:call-template>
  64.                                 </td>
  65.                             </tr>
  66.                         </xsl:for-each>
  67.                     </tbody>
  68.                 </table>
  69.                 <br/>
  70.                 <!-- Local Variable to count the number of employees in the current office -->
  71.                 <xsl:variable name="Num_Employees" select="count(n1:Department/n1:Person)"/> 
  72.                 The Total Number of employees at, 
  73.                 <xsl:value-of select="$OfficeName"/>
  74.                 are:
  75.                 <b>
  76.                     <xsl:value-of select="$Num_Employees"/>
  77.                 </b>
  78.                 <br/>
  79.             </xsl:for-each>
  80.         </html>
  81.     </xsl:template>
  82.     <!-- Surname Template ********************************************-->
  83.     <xsl:template name="Surname">
  84.         <xsl:param name="Family-name">
  85.             <xsl:value-of select="n1:Last"/>
  86.         </xsl:param>
  87.         <xsl:value-of select="$Family-name"/>
  88.         <br/>
  89.     </xsl:template>
  90. </xsl:stylesheet>
  91.