Project

General

Profile

1 26607 alessia.ba
<?xml version="1.0"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
                version="1.0">
4
5
<!-- ********************************************************************
6
     $Id: htmltbl.xsl 8477 2009-07-13 11:38:55Z nwalsh $
7
     ********************************************************************
8
9
     This file is part of the XSL DocBook Stylesheet distribution.
10
     See ../README or http://docbook.sf.net/release/xsl/current/ for
11
     copyright and other information.
12
13
     ******************************************************************** -->
14
15
<!-- ==================================================================== -->
16
17
<xsl:template match="colgroup" mode="htmlTable">
18
  <xsl:element name="{local-name()}" namespace="">
19
    <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
20
    <xsl:apply-templates mode="htmlTable"/>
21
  </xsl:element>
22
</xsl:template>
23
24
<xsl:template match="col" mode="htmlTable">
25
  <xsl:element name="{local-name()}" namespace="">
26
    <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
27
  </xsl:element>
28
</xsl:template>
29
30
<xsl:template match="caption" mode="htmlTable">
31
  <!-- do not use xsl:copy because of XHTML's needs -->
32
  <caption>
33
    <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
34
35
    <xsl:apply-templates select=".." mode="object.title.markup">
36
      <xsl:with-param name="allow-anchors" select="1"/>
37
    </xsl:apply-templates>
38
39
  </caption>
40
</xsl:template>
41
42
<xsl:template match="tbody|thead|tfoot|tr" mode="htmlTable">
43
  <xsl:element name="{local-name(.)}">
44
    <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
45
    <xsl:apply-templates mode="htmlTable"/>
46
  </xsl:element>
47
</xsl:template>
48
49
<xsl:template match="th|td" mode="htmlTable">
50
  <xsl:element name="{local-name(.)}">
51
    <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
52
    <xsl:apply-templates/> <!-- *not* mode=htmlTable -->
53
  </xsl:element>
54
</xsl:template>
55
56
<!-- don't copy through DocBook-specific attributes on HTML table markup -->
57
<!-- default behavior is to not copy through because there are more
58
     DocBook attributes than HTML attributes -->
59
<xsl:template mode="htmlTableAtt" match="@*"/>
60
61
<!-- copy these through -->
62
<xsl:template mode="htmlTableAtt"
63
              match="@abbr
64
                   | @align
65
                   | @axis
66
                   | @bgcolor
67
                   | @border
68
                   | @cellpadding
69
                   | @cellspacing
70
                   | @char
71
                   | @charoff
72
                   | @class
73
                   | @dir
74
                   | @frame
75
                   | @headers
76
                   | @height
77
                   | @lang
78
                   | @nowrap
79
                   | @onclick
80
                   | @ondblclick
81
                   | @onkeydown
82
                   | @onkeypress
83
                   | @onkeyup
84
                   | @onmousedown
85
                   | @onmousemove
86
                   | @onmouseout
87
                   | @onmouseover
88
                   | @onmouseup
89
                   | @rules
90
                   | @style
91
                   | @summary
92
                   | @title
93
                   | @valign
94
                   | @valign
95
                   | @width
96
                   | @xml:lang">
97
  <xsl:copy-of select="."/>
98
</xsl:template>
99
100
<xsl:template match="@span|@rowspan|@colspan" mode="htmlTableAtt">
101
  <!-- No need to copy through the DTD's default value "1" of the attribute -->
102
  <xsl:if test="number(.) != 1">
103
    <xsl:attribute name="{local-name(.)}">
104
      <xsl:value-of select="."/>
105
    </xsl:attribute>
106
  </xsl:if>
107
</xsl:template>
108
109
<!-- map floatstyle to HTML float values -->
110
<xsl:template match="@floatstyle" mode="htmlTableAtt">
111
  <xsl:attribute name="style">
112
    <xsl:text>float: </xsl:text>
113
    <xsl:choose>
114
      <xsl:when test="contains(., 'left')">left</xsl:when>
115
      <xsl:when test="contains(., 'right')">right</xsl:when>
116
      <xsl:when test="contains(., 'start')">
117
        <xsl:value-of select="$direction.align.start"/>
118
      </xsl:when>
119
      <xsl:when test="contains(., 'end')">
120
        <xsl:value-of select="$direction.align.end"/>
121
      </xsl:when>
122
      <xsl:when test="contains(., 'inside')">
123
        <xsl:value-of select="$direction.align.start"/>
124
      </xsl:when>
125
      <xsl:when test="contains(., 'outside')">
126
        <xsl:value-of select="$direction.align.end"/>
127
      </xsl:when>
128
      <xsl:when test="contains(., 'before')">none</xsl:when>
129
      <xsl:when test="contains(., 'none')">none</xsl:when>
130
    </xsl:choose>
131
    <xsl:text>;</xsl:text>
132
  </xsl:attribute>
133
</xsl:template>
134
135
</xsl:stylesheet>