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

  1. <xsl:stylesheet version="1.0" 
  2.                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3.  
  4. <!--
  5. *****************************************************************
  6. * John Dunning: 2001-01-26:                                     *
  7. *   Component file for CALS tables                              *
  8. *           transforms CALS tables to HTML tables               *
  9. *****************************************************************
  10. -->
  11.  
  12.     <xsl:template match="TABLE-US">
  13.         <div style="page-break_before-inside: avoid; "> 
  14.             [<xsl:value-of select="@ID"/>]
  15.             <xsl:apply-templates select=".//TABLE"/>
  16.         </div>
  17.     </xsl:template>
  18.  
  19.     <xsl:template match="TABLE">
  20.             <span class="table_head">
  21. <!-- *** todo: get proper heading *** -->
  22.                 <xsl:value-of select="./HEADING | ./TITLE"/>
  23.             </span>
  24.  
  25.         <table width="100%" cellpadding="0" cellspacing="0" border="0">
  26.             <tr><td>
  27.                 <xsl:apply-templates select="TGROUP"/>
  28.             </td></tr>
  29.         </table>
  30.     </xsl:template>
  31.  
  32.     <xsl:template match="TGROUP">
  33.     <!-- *************************************************** -->
  34.     <!--  nesting tables: HTML 4.0, section 11.2.3:          -->
  35.     <!-- "The THEAD, TFOOT, and TBODY sections must contain  -->
  36.     <!--  the same number of columns.                        -->    
  37.     <!-- *************************************************** -->
  38.  
  39.     <table cellpadding="5" cellspacing="0">
  40.         <xsl:attribute name="rules" >
  41.             <xsl:value-of select="ancestor-or-self::TABLE[1]/@FRAME" />
  42.         </xsl:attribute>
  43.         
  44.         <!-- this will hide the box around a table -->
  45.         <!--xsl:if test="ancestor::table[1]/@frame='none'">
  46.             <xsl:attribute name="border">0</xsl:attribute>
  47.         </xsl:if-->
  48.  
  49.         <colgroup>
  50.             <xsl:apply-templates select="COLSPEC" />
  51.         </colgroup>
  52.         <thead>
  53.             <xsl:apply-templates select="THEAD"/>
  54.         </thead>
  55.             <xsl:apply-templates select="TBODY" />
  56.     </table>
  57.     </xsl:template>
  58.  
  59.     <xsl:template match="TBODY">
  60.         <tbody valign="{@VALIGN}">
  61.             <xsl:apply-templates />
  62.         </tbody>
  63.     </xsl:template>
  64.     
  65.     <xsl:template match="THEAD">
  66.         <xsl:apply-templates />
  67.     </xsl:template>
  68.  
  69.     <xsl:template match="COLSPEC">
  70.             <xsl:for-each select="descendant-or-self::COLSPEC">    
  71.                 <col width="{@COLWIDTH}" align="{@ALIGN}"/>
  72.                     <xsl:apply-templates />
  73.             </xsl:for-each>
  74.     </xsl:template>
  75.  
  76.     <xsl:template match="ROW">
  77.         <tr>
  78.             <xsl:apply-templates select="ENTRY"/>
  79.         </tr>
  80.     </xsl:template>
  81.  
  82.     <xsl:template match="ENTRY">
  83.     <xsl:param name="rowname" select="@SPANNAME"/>
  84.         <td class="table_data">
  85.             <xsl:if test="@ALIGN">
  86.                 <xsl:attribute name="ALIGN">
  87.                     <xsl:value-of select="@ALIGN" />
  88.                 </xsl:attribute>
  89.             </xsl:if>
  90.               <xsl:choose>
  91.                 <xsl:when test="@SPANNAME">
  92.                     <xsl:attribute name="colspan">
  93.                         <!-- get values from script, below -->
  94.                         <xsl:value-of select="../../../SPANSPEC[@SPANNAME=$rowname]/@NAMEEND"/>
  95.                     </xsl:attribute>
  96.                 </xsl:when>
  97.                 <xsl:when test="@NAMEEND">
  98.                     <xsl:attribute name="colspan">
  99.                         <xsl:value-of select="@NAMEEND"/>
  100.                     </xsl:attribute>
  101.                 </xsl:when>
  102.             </xsl:choose>
  103.         <!-- ***** insert   between <td> and </td> if no content (preserves width) ***** -->
  104.                 <xsl:if test="not(child::*)">
  105.                    
  106.                 </xsl:if>
  107.                 <xsl:apply-templates />
  108.             </td>
  109.         </xsl:template>
  110.     
  111.         <xsl:template match="text()">
  112.             <xsl:value-of select="."/>
  113.         </xsl:template>
  114. </xsl:stylesheet>