]> git.stg.codes - stg.git/blob - doc/xslt/xhtml-1_1/htmltbl.xsl
Set output encoding to utf-8.
[stg.git] / doc / xslt / xhtml-1_1 / htmltbl.xsl
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 <!-- ********************************************************************
7      $Id: htmltbl.xsl 8477 2009-07-13 11:38:55Z nwalsh $
8      ********************************************************************
9
10      This file is part of the XSL DocBook Stylesheet distribution.
11      See ../README or http://docbook.sf.net/release/xsl/current/ for
12      copyright and other information.
13
14      ******************************************************************** -->
15
16 <!-- ==================================================================== -->
17
18 <xsl:template match="colgroup" mode="htmlTable">
19   <xsl:element name="{local-name()}" namespace="http://www.w3.org/1999/xhtml">
20     <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
21     <xsl:apply-templates mode="htmlTable"/>
22   </xsl:element>
23 </xsl:template>
24
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
31 <xsl:template match="caption" mode="htmlTable">
32   <!-- do not use xsl:copy because of XHTML's needs -->
33   <caption>  
34     <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
35
36     <xsl:apply-templates select=".." mode="object.title.markup">
37       <xsl:with-param name="allow-anchors" select="1"/>
38     </xsl:apply-templates>
39
40   </caption>
41 </xsl:template>
42
43 <xsl:template match="tbody|thead|tfoot|tr" mode="htmlTable">
44   <xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">
45     <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
46     <xsl:apply-templates mode="htmlTable"/>
47   </xsl:element>
48 </xsl:template>
49
50 <xsl:template match="th|td" mode="htmlTable">
51   <xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">
52     <xsl:apply-templates select="@*" mode="htmlTableAtt"/>
53     <xsl:apply-templates/> <!-- *not* mode=htmlTable -->
54   </xsl:element>
55 </xsl:template>
56
57 <!-- don't copy through DocBook-specific attributes on HTML table markup -->
58 <!-- default behavior is to not copy through because there are more
59      DocBook attributes than HTML attributes -->
60 <xsl:template mode="htmlTableAtt" match="@*"/>
61
62 <!-- copy these through -->
63 <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">
64   <xsl:copy-of select="."/>
65 </xsl:template>
66
67 <xsl:template match="@span|@rowspan|@colspan" mode="htmlTableAtt">
68   <!-- No need to copy through the DTD's default value "1" of the attribute -->
69   <xsl:if test="number(.) != 1">
70     <xsl:attribute name="{local-name(.)}">
71       <xsl:value-of select="."/>
72     </xsl:attribute>
73   </xsl:if>
74 </xsl:template>
75
76 <!-- map floatstyle to HTML float values -->
77 <xsl:template match="@floatstyle" mode="htmlTableAtt">
78   <xsl:attribute name="style">
79     <xsl:text>float: </xsl:text>
80     <xsl:choose>
81       <xsl:when test="contains(., 'left')">left</xsl:when>
82       <xsl:when test="contains(., 'right')">right</xsl:when>
83       <xsl:when test="contains(., 'start')">
84         <xsl:value-of select="$direction.align.start"/>
85       </xsl:when>
86       <xsl:when test="contains(., 'end')">
87         <xsl:value-of select="$direction.align.end"/>
88       </xsl:when>
89       <xsl:when test="contains(., 'inside')">
90         <xsl:value-of select="$direction.align.start"/>
91       </xsl:when>
92       <xsl:when test="contains(., 'outside')">
93         <xsl:value-of select="$direction.align.end"/>
94       </xsl:when>
95       <xsl:when test="contains(., 'before')">none</xsl:when>
96       <xsl:when test="contains(., 'none')">none</xsl:when>
97     </xsl:choose>
98     <xsl:text>;</xsl:text>
99   </xsl:attribute>
100 </xsl:template>
101
102 </xsl:stylesheet>