htmltbl.xsl 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?xml version="1.0" encoding="ASCII"?>
  2. <!--This file was created automatically by html2xhtml-->
  3. <!--from the HTML stylesheets.-->
  4. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
  5. <!-- ********************************************************************
  6. $Id: htmltbl.xsl 9501 2012-07-16 00:14:50Z bobstayton $
  7. ********************************************************************
  8. This file is part of the XSL DocBook Stylesheet distribution.
  9. See ../README or http://docbook.sf.net/release/xsl/current/ for
  10. copyright and other information.
  11. ******************************************************************** -->
  12. <!-- ==================================================================== -->
  13. <xsl:template match="table" mode="htmlTable">
  14. <xsl:element name="table" namespace="http://www.w3.org/1999/xhtml">
  15. <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
  16. <xsl:call-template name="htmlTable"/>
  17. </xsl:element>
  18. </xsl:template>
  19. <xsl:template match="colgroup" mode="htmlTable">
  20. <xsl:element name="{local-name()}" namespace="http://www.w3.org/1999/xhtml">
  21. <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
  22. <xsl:apply-templates mode="htmlTable"/>
  23. </xsl:element>
  24. </xsl:template>
  25. <xsl:template match="col" mode="htmlTable">
  26. <xsl:element name="{local-name()}" namespace="http://www.w3.org/1999/xhtml">
  27. <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
  28. </xsl:element>
  29. </xsl:template>
  30. <!-- Handled by formal.object.title template -->
  31. <xsl:template match="caption" mode="htmlTable"/>
  32. <xsl:template match="tbody|thead|tfoot|tr" mode="htmlTable">
  33. <xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">
  34. <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
  35. <xsl:apply-templates mode="htmlTable"/>
  36. </xsl:element>
  37. </xsl:template>
  38. <xsl:template match="th|td" mode="htmlTable">
  39. <xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">
  40. <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
  41. <xsl:apply-templates/> <!-- *not* mode=htmlTable -->
  42. </xsl:element>
  43. </xsl:template>
  44. <!-- don't copy through DocBook-specific attributes on HTML table markup -->
  45. <!-- default behavior is to not copy through because there are more
  46. DocBook attributes than HTML attributes -->
  47. <xsl:template mode="htmlTableAtt" match="@*"/>
  48. <!-- copy these through -->
  49. <xsl:template mode="htmlTableAtt" match="@abbr | @align | @axis | @bgcolor | @border | @cellpadding | @cellspacing | @char | @charoff | @class | @dir | @frame | @headers | @height | @lang | @nowrap | @onclick | @ondblclick | @onkeydown | @onkeypress | @onkeyup | @onmousedown | @onmousemove | @onmouseout | @onmouseover | @onmouseup | @rules | @style | @summary | @title | @valign | @valign | @width | @xml:lang">
  50. <xsl:copy-of select="."/>
  51. </xsl:template>
  52. <xsl:template match="@span|@rowspan|@colspan" mode="htmlTableAtt">
  53. <!-- No need to copy through the DTD's default value "1" of the attribute -->
  54. <xsl:if test="number(.) != 1">
  55. <xsl:attribute name="{local-name(.)}">
  56. <xsl:value-of select="."/>
  57. </xsl:attribute>
  58. </xsl:if>
  59. </xsl:template>
  60. <!-- map floatstyle to HTML float values -->
  61. <xsl:template match="@floatstyle" mode="htmlTableAtt">
  62. <xsl:attribute name="style">
  63. <xsl:text>float: </xsl:text>
  64. <xsl:choose>
  65. <xsl:when test="contains(., 'left')">left</xsl:when>
  66. <xsl:when test="contains(., 'right')">right</xsl:when>
  67. <xsl:when test="contains(., 'start')">
  68. <xsl:value-of select="$direction.align.start"/>
  69. </xsl:when>
  70. <xsl:when test="contains(., 'end')">
  71. <xsl:value-of select="$direction.align.end"/>
  72. </xsl:when>
  73. <xsl:when test="contains(., 'inside')">
  74. <xsl:value-of select="$direction.align.start"/>
  75. </xsl:when>
  76. <xsl:when test="contains(., 'outside')">
  77. <xsl:value-of select="$direction.align.end"/>
  78. </xsl:when>
  79. <xsl:when test="contains(., 'before')">none</xsl:when>
  80. <xsl:when test="contains(., 'none')">none</xsl:when>
  81. </xsl:choose>
  82. <xsl:text>;</xsl:text>
  83. </xsl:attribute>
  84. </xsl:template>
  85. </xsl:stylesheet>