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 / F19802_RadioPush1.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-10-04  |  2.5 KB  |  66 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- ===========================================================
  3.   Category:       HTML
  4.   Sub-category:   RadioButtons
  5.   Author:         David Silverlight
  6.                   HeadGeek@xmlpitstop.com
  7.   Created:        2001-05-16
  8.   Description:-
  9.     This stylsheet demonstrates how to create radio buttons from
  10.     an xml document. Also note that we are using the "Push"
  11.     method to transform data from our xml document.  The Push
  12.     method is an approach where templates are used extensively.
  13.     Using the "Push" method, we are essentially defining
  14.     templates for each of our xml elements and "Pushing" our xml
  15.     data towards it.  This stylsheet demonstrates how to create
  16.     radio buttons from an xml document.  Also note that we are
  17.     using the Pull method to extract data from our xml document.
  18.     The pull method is an approach where the use of templates is
  19.     minimized and data is accessed by 'pulling' it from our xml
  20.     document
  21. ================================================================ -->
  22. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  23.   <xsl:output method="html" />
  24.  
  25.   <xsl:template match="/">
  26.     <html>
  27.       <head>
  28.         <style type="text/css">
  29.         H1 {COLOR: red; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  30.         H2 {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  31.         .head {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 14pt;}
  32.         .subhead {COLOR: darkblue; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  33.         .text {COLOR: black; FONT-FAMILY: Arial; FONT-SIZE: 12pt;}
  34.         TH {COLOR: white; FONT-FAMILY: Arial; background-color: darkblue;}
  35.         TD {COLOR: darkblue; FONT-FAMILY: Arial}
  36.         TR { background-color: beige; }
  37.         BODY { background-color: beige; }
  38.         </style>
  39.       </head>
  40.       <body>
  41.         <h1>Generating Radio Buttons from XML Data (Push Method)</h1>
  42.         <xsl:apply-templates />
  43.       </body>
  44.     </html>
  45.   </xsl:template>
  46.  
  47.   <xsl:template match="UserOptions">
  48.     <xsl:apply-templates />
  49.   </xsl:template>
  50.  
  51.   <xsl:template match="option">
  52.     <xsl:value-of select="@title" />
  53.     <input type="radio">
  54.       <xsl:attribute name="Name">
  55.         <xsl:value-of select="@groupname" />
  56.       </xsl:attribute>
  57.       <xsl:attribute name="ID">
  58.         <xsl:value-of select="@groupname" />
  59.       </xsl:attribute>
  60.       <xsl:if test="@default = 'true'">
  61.         <xsl:attribute name="checked" />
  62.       </xsl:if>
  63.     </input>
  64.   </xsl:template>
  65. </xsl:stylesheet>
  66.