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