home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F17248_EmployeeStringFuncs.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-10-04  |  3.5 KB  |  88 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- ===========================================================
  3.   Styelsheet:     EmployeeStringFuncs.xsl
  4.   Category:       DataFormatting
  5.   Sub-category:   String Formatting Functions
  6.   Author:         David Silverlight
  7.                   HeadGeek@xmlpitstop.com
  8.   Created:        2001-05-16
  9.   Description:-
  10.     This stylsheet demonstrates how various string functions
  11.     (string-length, substring-before, substring-after, concat)
  12.     can be used to extract specific portions of your string data.
  13.     An example is also provided on how to perform upper and
  14.     lower casing conversions.
  15. ================================================================ -->
  16. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="http://mycompany.com/mynamespace" version="1.0">
  17.     <xsl:output method="html" encoding="ISO-8859-1" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"/>
  18.   <xsl:template match="/">
  19.     <html>
  20.       <head>
  21.                 <title>DataFormatting - String Formatting Functions</title>
  22.                 <style type="text/css">
  23.                     H1 {COLOR: red; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  24.                     H2 {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  25.                     .head {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  26.                     .subhead {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  27.                     .text {COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  28.                     TH {COLOR: white; FONT-FAMILY: Arial; background-color: darkblue;}
  29.                     TD {COLOR: darkblue; FONT-FAMILY: Arial}
  30.                     TR { background-color: beige; }
  31.                     BODY { background-color: beige; }
  32.                 </style>
  33.       </head>
  34.       <body>
  35.         <h1>Employee Listing</h1>
  36.         <table border="1">
  37.           <tr>
  38.             <th>Select</th>
  39.             <th>Select</th>
  40.             <th>Select</th>
  41.             <th>string-length</th>
  42.             <th>substring-before 'n'</th>
  43.             <th>substring-after 'n'</th>
  44.             <th>concat</th>
  45.             <th>contains 'i'</th>
  46.             <th>'uppercase'</th>
  47.             <th>'lowercase'</th>
  48.           </tr>
  49.  
  50.           <xsl:for-each select="/employees/employee">
  51.             <tr>
  52.               <td>
  53.                 <xsl:value-of select="@EmployeeID" />
  54.               </td>
  55.               <td>
  56.                 <xsl:value-of select="@FirstName" />
  57.               </td>
  58.               <td>
  59.                 <xsl:value-of select="@LastName" />
  60.               </td>
  61.               <td>
  62.                 <xsl:value-of select="string-length(@FirstName)" />
  63.               </td>
  64.               <td>
  65.                 <xsl:value-of select="substring-before(@FirstName, 'n')" />
  66.               </td>
  67.               <td>
  68.                 <xsl:value-of select="substring-after(@FirstName, 'n')" />
  69.               </td>
  70.               <td>
  71.                 <xsl:value-of select="concat(@FirstName, ' ', @LastName)" />
  72.               </td>
  73.               <td>
  74.                 <xsl:value-of select="contains(@FirstName, 'i')" />
  75.               </td>
  76.               <td>
  77.                   <xsl:value-of select="translate(@LastName,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
  78.               </td>
  79.               <td>
  80.                   <xsl:value-of select="translate(@FirstName,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
  81.               </td>
  82.             </tr>
  83.           </xsl:for-each>
  84.         </table>
  85.       </body>
  86.     </html>
  87.   </xsl:template>
  88. </xsl:stylesheet>