1 | <?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 9501 2012-07-16 00:14:50Z bobstayton $
|
---|
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="table" mode="htmlTable">
|
---|
18 | <xsl:element name="table" namespace="">
|
---|
19 | <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
|
---|
20 | <xsl:call-template name="htmlTable"/>
|
---|
21 | </xsl:element>
|
---|
22 | </xsl:template>
|
---|
23 |
|
---|
24 | <xsl:template match="colgroup" mode="htmlTable">
|
---|
25 | <xsl:element name="{local-name()}" namespace="">
|
---|
26 | <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
|
---|
27 | <xsl:apply-templates mode="htmlTable"/>
|
---|
28 | </xsl:element>
|
---|
29 | </xsl:template>
|
---|
30 |
|
---|
31 | <xsl:template match="col" mode="htmlTable">
|
---|
32 | <xsl:element name="{local-name()}" namespace="">
|
---|
33 | <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
|
---|
34 | </xsl:element>
|
---|
35 | </xsl:template>
|
---|
36 |
|
---|
37 | <!-- Handled by formal.object.title template -->
|
---|
38 | <xsl:template match="caption" mode="htmlTable"/>
|
---|
39 |
|
---|
40 | <xsl:template match="tbody|thead|tfoot|tr" mode="htmlTable">
|
---|
41 | <xsl:element name="{local-name(.)}">
|
---|
42 | <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
|
---|
43 | <xsl:apply-templates mode="htmlTable"/>
|
---|
44 | </xsl:element>
|
---|
45 | </xsl:template>
|
---|
46 |
|
---|
47 | <xsl:template match="th|td" mode="htmlTable">
|
---|
48 | <xsl:element name="{local-name(.)}">
|
---|
49 | <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
|
---|
50 | <xsl:apply-templates/> <!-- *not* mode=htmlTable -->
|
---|
51 | </xsl:element>
|
---|
52 | </xsl:template>
|
---|
53 |
|
---|
54 | <!-- don't copy through DocBook-specific attributes on HTML table markup -->
|
---|
55 | <!-- default behavior is to not copy through because there are more
|
---|
56 | DocBook attributes than HTML attributes -->
|
---|
57 | <xsl:template mode="htmlTableAtt" match="@*"/>
|
---|
58 |
|
---|
59 | <!-- copy these through -->
|
---|
60 | <xsl:template mode="htmlTableAtt"
|
---|
61 | match="@abbr
|
---|
62 | | @align
|
---|
63 | | @axis
|
---|
64 | | @bgcolor
|
---|
65 | | @border
|
---|
66 | | @cellpadding
|
---|
67 | | @cellspacing
|
---|
68 | | @char
|
---|
69 | | @charoff
|
---|
70 | | @class
|
---|
71 | | @dir
|
---|
72 | | @frame
|
---|
73 | | @headers
|
---|
74 | | @height
|
---|
75 | | @lang
|
---|
76 | | @nowrap
|
---|
77 | | @onclick
|
---|
78 | | @ondblclick
|
---|
79 | | @onkeydown
|
---|
80 | | @onkeypress
|
---|
81 | | @onkeyup
|
---|
82 | | @onmousedown
|
---|
83 | | @onmousemove
|
---|
84 | | @onmouseout
|
---|
85 | | @onmouseover
|
---|
86 | | @onmouseup
|
---|
87 | | @rules
|
---|
88 | | @style
|
---|
89 | | @summary
|
---|
90 | | @title
|
---|
91 | | @valign
|
---|
92 | | @valign
|
---|
93 | | @width
|
---|
94 | | @xml:lang">
|
---|
95 | <xsl:copy-of select="."/>
|
---|
96 | </xsl:template>
|
---|
97 |
|
---|
98 | <xsl:template match="@span|@rowspan|@colspan" mode="htmlTableAtt">
|
---|
99 | <!-- No need to copy through the DTD's default value "1" of the attribute -->
|
---|
100 | <xsl:if test="number(.) != 1">
|
---|
101 | <xsl:attribute name="{local-name(.)}">
|
---|
102 | <xsl:value-of select="."/>
|
---|
103 | </xsl:attribute>
|
---|
104 | </xsl:if>
|
---|
105 | </xsl:template>
|
---|
106 |
|
---|
107 | <!-- map floatstyle to HTML float values -->
|
---|
108 | <xsl:template match="@floatstyle" mode="htmlTableAtt">
|
---|
109 | <xsl:attribute name="style">
|
---|
110 | <xsl:text>float: </xsl:text>
|
---|
111 | <xsl:choose>
|
---|
112 | <xsl:when test="contains(., 'left')">left</xsl:when>
|
---|
113 | <xsl:when test="contains(., 'right')">right</xsl:when>
|
---|
114 | <xsl:when test="contains(., 'start')">
|
---|
115 | <xsl:value-of select="$direction.align.start"/>
|
---|
116 | </xsl:when>
|
---|
117 | <xsl:when test="contains(., 'end')">
|
---|
118 | <xsl:value-of select="$direction.align.end"/>
|
---|
119 | </xsl:when>
|
---|
120 | <xsl:when test="contains(., 'inside')">
|
---|
121 | <xsl:value-of select="$direction.align.start"/>
|
---|
122 | </xsl:when>
|
---|
123 | <xsl:when test="contains(., 'outside')">
|
---|
124 | <xsl:value-of select="$direction.align.end"/>
|
---|
125 | </xsl:when>
|
---|
126 | <xsl:when test="contains(., 'before')">none</xsl:when>
|
---|
127 | <xsl:when test="contains(., 'none')">none</xsl:when>
|
---|
128 | </xsl:choose>
|
---|
129 | <xsl:text>;</xsl:text>
|
---|
130 | </xsl:attribute>
|
---|
131 | </xsl:template>
|
---|
132 |
|
---|
133 | </xsl:stylesheet>
|
---|