home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _929E4FA619AB45E696E142F88AF7F981 < prev    next >
Encoding:
Extensible Markup Language  |  2002-08-26  |  4.8 KB  |  122 lines

  1. <xsl:stylesheet version="1.0" 
  2.                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  3.                 xmlns:doc="urn:schemas-uspto-gov:document"
  4.                 exclude-result-prefixes="doc">
  5.  
  6. <doc:summary doc:public="yes" >
  7.     <doc:title>Component stylesheet for CALS Tables</doc:title>
  8.     <doc:filename>cals.xsl</doc:filename>
  9.     <doc:version>1.0</doc:version>
  10.     <doc:doctype>numerous</doc:doctype>
  11.     <doc:doctype-date>N/A</doc:doctype-date>
  12.     <doc:dateCreated>2001-01-26</doc:dateCreated>
  13.     <doc:lastModified>2001-02-16</doc:lastModified>
  14.     <doc:description>
  15.         Template rules for transforming CALS tables to HTML tables are contained here. 
  16.     </doc:description>
  17. </doc:summary>
  18.  
  19. <!--
  20. ************************************************************
  21. * John Dunning: 2001-01-26:                                *
  22. *  Component file for CALS tables                          *
  23. *    transforms CALS tables to HTML tables                 *
  24. ************************************************************
  25. -->
  26.  
  27.     <xsl:template match="table-cwu">
  28.         <div style="page-break-inside: avoid; "> 
  29.             [<xsl:value-of select="@id"/>]
  30.             <xsl:apply-templates select="table | Table"/>
  31.         </div>
  32.     </xsl:template>
  33.  
  34.     <xsl:template match="table | Table">
  35.             <span class="table_head">
  36.                 <xsl:value-of select="./heading"/>
  37.             </span>
  38.  
  39.         <table width="100%" cellpadding="0" cellspacing="0" border="0">
  40.             <tr><td>
  41.                 <xsl:apply-templates select="tgroup | TGroup"/>
  42.             </td></tr>
  43.         </table>
  44.     </xsl:template>
  45.  
  46.     <xsl:template match="tgroup | TGroup" doc:public="yes" doc:description="This template nests tables within each other, since CALS allows multiple <tgroup>s within one <table> and HTML does not; each <tgroup> from the source document becomes a new table.  See
  47.           HTML 4.0, section 11.2.3: "The THEAD, TFOOT, and TBODY sections must contain the same number of columns".">
  48.  
  49.     <table cellpadding="0" cellspacing="0">
  50.     
  51.         <xsl:attribute name="rules" >
  52.             <xsl:value-of select="ancestor-or-self::table[1]/@frame | ancestor-or-self::Table[1]/@frame" />
  53.         </xsl:attribute>
  54.         
  55.         <!-- this will hide the box around a table -->
  56.         <!--xsl:if test="ancestor::table[1]/@frame='none'">
  57.             <xsl:attribute name="border">0</xsl:attribute>
  58.         </xsl:if-->
  59.  
  60.         <colgroup>
  61.             <xsl:apply-templates select="colspec" />
  62.         </colgroup>
  63.         <thead>
  64.             <xsl:apply-templates select="thead"/>
  65.         </thead>
  66.             <xsl:apply-templates select="tbody | TBody" />
  67.     </table>
  68.     </xsl:template>
  69.  
  70.     <xsl:template match="tbody | TBody">
  71.         <tbody valign="{@valign}">
  72.             <xsl:apply-templates />
  73.         </tbody>
  74.     </xsl:template>
  75.     
  76.     <xsl:template match="thead">
  77.         <xsl:apply-templates />
  78.     </xsl:template>
  79.  
  80.     <xsl:template match="colspec">
  81.             <xsl:for-each select="descendant-or-self::colspec">    
  82.                 <col width="{@colwidth}" align="{@align}"/>
  83.                     <xsl:apply-templates />
  84.             </xsl:for-each>
  85.     </xsl:template>
  86.  
  87.     <xsl:template match="row | Row">
  88.         <tr>
  89.             <xsl:apply-templates select="entry | Entry"/>
  90.         </tr>
  91.     </xsl:template>
  92.  
  93. <xsl:template match="entry | Entry" doc:public="yes" doc:description="This template performs an evaluation to test
  94.                                         whether <spanspec> or the "nameend" attribute was used and span table data accordingly">
  95. <xsl:param name="rowname" select="@spanname" doc:public="yes" doc:description="the @spanname of the <entry>; used in evaluation to lookup @nameend of <spanspec>"/>
  96.         <td class="table_data">
  97.             <xsl:if test="@align">
  98.                 <xsl:attribute name="align">
  99.                     <xsl:value-of select="@align" />
  100.                 </xsl:attribute>
  101.             </xsl:if>
  102.               <xsl:choose>
  103.                 <xsl:when test="@spanname">
  104.                     <xsl:attribute name="colspan">
  105.                         <xsl:value-of select="../../../spanspec[@spanname=$rowname]/@nameend"/>
  106.                     </xsl:attribute>
  107.                 </xsl:when>
  108.                 <xsl:when test="@nameend">
  109.                     <xsl:attribute name="colspan">
  110.                         <xsl:value-of select="@nameend"/>
  111.                     </xsl:attribute>
  112.                 </xsl:when>
  113.             </xsl:choose>
  114.     
  115.         <!-- ***** insert   between <td> and </td> if no content (preserves width) ***** -->
  116.                 <xsl:if test="not(child::*)">
  117.                    
  118.                 </xsl:if>
  119.                 <xsl:apply-templates />
  120.             </td>
  121.         </xsl:template>
  122. </xsl:stylesheet>