home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _A5D68B89A3C04A9A9902522FB089FD41 < prev    next >
Encoding:
Text File  |  2002-10-21  |  3.8 KB  |  127 lines

  1. <!-- 
  2. TEI XSLT stylesheet family version 1.2
  3. RCS: $Date: 2002/10/21 13:44:29 $, $Revision: 1.1.2.1 $, $Author: jdj $
  4.  
  5. XSL stylesheet to format TEI XML documents to HTML or XSL FO
  6.  
  7.  Copyright 1999-2002 Sebastian Rahtz/Oxford University  <sebastian.rahtz@oucs.ox.ac.uk>
  8.  
  9.  Permission is hereby granted, free of charge, to any person obtaining
  10.  a copy of this software and any associated documentation files (the
  11.  ``Software''), to deal in the Software without restriction, including
  12.  without limitation the rights to use, copy, modify, merge, publish,
  13.  distribute, sublicense, and/or sell copies of the Software, and to
  14.  permit persons to whom the Software is furnished to do so, subject to
  15.  the following conditions:
  16.  
  17.  The above copyright notice and this permission notice shall be included
  18.  in all copies or substantial portions of the Software.
  19. --> 
  20. <xsl:stylesheet
  21.   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  22.   version="1.0">
  23.  
  24. <xsl:template match="table[@rend='simple']">
  25.   <table>
  26.  <xsl:for-each select="@*">
  27.   <xsl:if test="name(.)='summary'
  28. or name(.) = 'width'
  29. or name(.) = 'border'
  30. or name(.) = 'frame'
  31. or name(.) = 'rules'
  32. or name(.) = 'cellspacing'
  33. or name(.) = 'cellpadding'">
  34.     <xsl:copy-of select="."/>
  35.  </xsl:if>
  36.  </xsl:for-each>
  37. <xsl:apply-templates/></table>
  38. </xsl:template>
  39.  
  40. <xsl:template match='table'>
  41.  <div>
  42.  <xsl:attribute name="align">
  43.  <xsl:choose>
  44.   <xsl:when test="@align">
  45.       <xsl:value-of select="@align"/>
  46.   </xsl:when>
  47.   <xsl:otherwise>
  48.       <xsl:value-of select="$tableAlign"/>
  49.   </xsl:otherwise>
  50.  </xsl:choose>
  51.  </xsl:attribute>
  52.  <table>
  53.  <xsl:if test="@rend='frame' or @rend='rules'">
  54.   <xsl:attribute name="rules">all</xsl:attribute>
  55.   <xsl:attribute name="border">1</xsl:attribute>
  56.  </xsl:if>
  57.  <xsl:for-each select="@*">
  58.   <xsl:if test="name(.)='summary'
  59. or name(.) = 'width'
  60. or name(.) = 'border'
  61. or name(.) = 'frame'
  62. or name(.) = 'rules'
  63. or name(.) = 'cellspacing'
  64. or name(.) = 'cellpadding'">
  65.     <xsl:copy-of select="."/>
  66.  </xsl:if>
  67.  </xsl:for-each>
  68.  <xsl:apply-templates/>
  69.  </table>
  70.  </div>
  71. </xsl:template>
  72.  
  73. <xsl:template match='row'>
  74.  <tr>
  75. <xsl:if test="@rend and starts-with(@rend,'class:')">
  76.  <xsl:attribute name="class">
  77.     <xsl:value-of select="substring-after(@rend,'class:')"/>
  78.  </xsl:attribute>
  79. </xsl:if>
  80. <xsl:if test="not(@role = 'data') and not(@role='')">
  81.  <xsl:attribute name="class"><xsl:value-of select="@role"/></xsl:attribute>
  82. </xsl:if>
  83.  <xsl:apply-templates/>
  84.  </tr>
  85. </xsl:template>
  86.  
  87. <xsl:template match='cell'>
  88.  <td valign="top">
  89.    <xsl:if test="@id"><a name="{@id}"/></xsl:if>
  90. <xsl:choose>
  91. <xsl:when test="@rend and starts-with(@rend,'width:')">
  92.  <xsl:attribute name="width">
  93.     <xsl:value-of select="substring-after(@rend,'width:')"/>
  94.  </xsl:attribute>
  95. </xsl:when>
  96. <xsl:when test="@rend and starts-with(@rend,'class:')">
  97.  <xsl:attribute name="class">
  98.     <xsl:value-of select="substring-after(@rend,'class:')"/>
  99.  </xsl:attribute>
  100. </xsl:when>
  101. <xsl:when test="@rend">
  102.  <xsl:attribute name="bgcolor"><xsl:value-of select="@rend"/></xsl:attribute>
  103. </xsl:when>
  104. </xsl:choose>
  105. <xsl:if test="@cols">
  106.  <xsl:attribute name="colspan"><xsl:value-of select="@cols"/></xsl:attribute>
  107. </xsl:if>
  108. <xsl:if test="@rows">
  109.  <xsl:attribute name="rowspan"><xsl:value-of select="@rows"/></xsl:attribute>
  110. </xsl:if>
  111. <xsl:choose>
  112.   <xsl:when test="@align">
  113.    <xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute>
  114.   </xsl:when>
  115.   <xsl:when test="not($cellAlign='left')">
  116.    <xsl:attribute name="align"><xsl:value-of select="$cellAlign"/></xsl:attribute>
  117.   </xsl:when>
  118. </xsl:choose>
  119. <xsl:if test="not(@role = 'data') and not(@role='')">
  120.  <xsl:attribute name="class"><xsl:value-of select="@role"/></xsl:attribute>
  121. </xsl:if>
  122.  <xsl:apply-templates/>
  123.  </td>
  124. </xsl:template>
  125.  
  126. </xsl:stylesheet>
  127.