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 / F19362_EmpElemTextboxPush2.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-10-04  |  4.7 KB  |  130 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- ===========================================================
  3.   Category:       HTML
  4.   Sub-category:   TextBox
  5.   Author:         David Silverlight
  6.                   HeadGeek@xmlpitstop.com
  7.   Created:        2001-05-16
  8.   Description:-
  9.     This series of textboxes is generated using the pull method
  10.     of extracting xml elements. A template is defined for each
  11.     element allowing us to customize the attributes, rather than
  12.     using the values in the XML document.  Also note that we are
  13.     using the 'Push' method to transform data from our xml
  14.     document. The Push method is an approach where templates are
  15.     used extensively.  Using the "Push" method, we are
  16.     essentially defining templates for each of our xml elements
  17.     and "Pushing" our xml data towards it.
  18. ================================================================ -->
  19. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  20.   <xsl:output method="html" />
  21.  
  22.   <xsl:template match="/">
  23.     <html>
  24.       <head>
  25.         <style type="text/css">
  26.         H1 {COLOR: red; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  27.         H2 {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  28.         .head {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  29.         .subhead {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  30.         .text {COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  31.         TH {COLOR: white; FONT-FAMILY: Arial; background-color: darkblue;}
  32.         TD {COLOR: darkblue; FONT-FAMILY: Arial}
  33.         TR { background-color: beige; }
  34.         BODY { background-color: beige; }
  35.         </style>
  36.       </head>
  37.       <body>
  38.         <h1>Generating a text box from xml (Push method)</h1>
  39.         <xsl:apply-templates />
  40.       </body>
  41.     </html>
  42.   </xsl:template>
  43.  
  44.   <xsl:template match="employees">
  45.     <xsl:apply-templates />
  46.   </xsl:template>
  47.  
  48.   <xsl:template match="employee">
  49.     <xsl:apply-templates />
  50.   </xsl:template>
  51.  
  52.   <!-- Generate Input text box for "employeename" -->
  53.   <xsl:template match="employeename">Employee Name:
  54.     <xsl:element name="Input">
  55.       <!-- Set the Size of the textbox -->
  56.       <xsl:attribute name="size">30</xsl:attribute>
  57.       <!-- Set the Size of the textbox -->
  58.       <xsl:attribute name="maxlength">30</xsl:attribute>
  59.       <!-- Set the value of the text box -->
  60.       <xsl:attribute name="value">
  61.         <xsl:value-of select="text()" />
  62.       </xsl:attribute>
  63.       <br />
  64.     </xsl:element>
  65.   </xsl:template>
  66.  
  67.   <!-- Generate Input text box for "hourlyrate" -->
  68.   <xsl:template match="hourlyrate">
  69.     Hourly Rate:
  70.     <xsl:element name="Input">
  71.       <!-- Set the Size of the textbox -->
  72.       <xsl:attribute name="size">12</xsl:attribute>
  73.       <!-- Set the Size of the textbox -->
  74.       <xsl:attribute name="maxlength">12</xsl:attribute>
  75.       <!-- Set the value of the text box -->
  76.       <xsl:attribute name="value">
  77.         <xsl:value-of select="text()" />
  78.       </xsl:attribute>
  79.       <br />
  80.     </xsl:element>
  81.   </xsl:template>
  82.  
  83.   <!-- Generate Input text box for "department" -->
  84.   <xsl:template match="department">
  85.     Department:
  86.     <xsl:element name="Input">
  87.       <!-- Set the Size of the textbox -->
  88.       <xsl:attribute name="size">35</xsl:attribute>
  89.       <!-- Set the Size of the textbox -->
  90.       <xsl:attribute name="maxlength">35</xsl:attribute>
  91.       <!-- Set the value of the text box -->
  92.       <xsl:attribute name="value">
  93.         <xsl:value-of select="text()" />
  94.       </xsl:attribute>
  95.       <br />
  96.     </xsl:element>
  97.   </xsl:template>
  98.  
  99.   <!-- Generate Input text box for "nativelanguage" -->
  100.   <xsl:template match="nativelanguage">
  101.     Spoken Language
  102.     <xsl:element name="Input">
  103.       <!-- Set the Size of the textbox -->
  104.       <xsl:attribute name="size">15</xsl:attribute>
  105.       <!-- Set the Size of the textbox -->
  106.       <xsl:attribute name="maxlength">15</xsl:attribute>
  107.       <!-- Set the value of the text box -->
  108.       <xsl:attribute name="value">
  109.         <xsl:value-of select="text()" />
  110.       </xsl:attribute>
  111.       <br />
  112.     </xsl:element>
  113.   </xsl:template>
  114.  
  115.   <!-- Generate Input text box for "primarylanguage" -->
  116.   <xsl:template match="primarylanguage">
  117.     Programming Language
  118.     <xsl:element name="Input">
  119.       <!-- Set the Size of the textbox -->
  120.       <xsl:attribute name="size">20</xsl:attribute>
  121.       <!-- Set the Size of the textbox -->
  122.       <xsl:attribute name="maxlength">20</xsl:attribute>
  123.       <!-- Set the value of the text box -->
  124.       <xsl:attribute name="value">
  125.         <xsl:value-of select="text()" />
  126.       </xsl:attribute>
  127.       <br />
  128.     </xsl:element>
  129.   </xsl:template>
  130. </xsl:stylesheet>