2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:d="http://docbook.org/ns/docbook"
4 xmlns:exsl="http://exslt.org/common"
5 exclude-result-prefixes="exsl d"
8 <!-- ********************************************************************
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://cdn.docbook.org/release/xsl/current/ for
12 copyright and other information.
14 ******************************************************************** -->
16 <xsl:import href="http://cdn.docbook.org/release/xsl/current/html/docbook.xsl"/>
17 <xsl:param name="tbl.font.title">B</xsl:param>
18 <xsl:param name="tbl.font.headings">B</xsl:param>
20 <!-- import the templates that match on non-namespace HTML
21 elements and produce tbl markup. They
22 are separated so the namespace prefix is not added to them. -->
23 <xsl:include href="tbl.xsl"/>
25 <xsl:param name="tbl.running.header.from.thead" select="0"/>
26 <xsl:param name="tbl.column.separator.char">:</xsl:param>
28 <!-- ==================================================================== -->
30 <!-- * This stylesheet transforms DocBook and HTML table source into -->
31 <!-- * tbl(1) markup. -->
33 <!-- * For details on tbl(1) and its markup syntaxt, see M. E. Lesk,-->
34 <!-- * "Tbl - A Program to Format Tables": -->
36 <!-- * http://cm.bell-labs.com/7thEdMan/vol2/tbl -->
37 <!-- * http://cm.bell-labs.com/cm/cs/doc/76/tbl.ps.gz -->
38 <!-- * http://www.snake.net/software/troffcvt/tbl.html -->
40 <xsl:template match="d:table|d:informaltable" mode="to.tbl">
41 <!--* the "source" param is an optional param; it can be any -->
42 <!--* string you want to use that gives some indication of the -->
43 <!--* source context for a table; it gets passed down to the named -->
44 <!--* templates that do the actual table processing; this -->
45 <!--* stylesheet currently uses the "source" information for -->
46 <!--* logging purposes -->
47 <xsl:param name="source"/>
48 <xsl:param name="title">
49 <xsl:if test="local-name(.) = 'table'">
50 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
53 <!-- * ============================================================== -->
54 <!-- * Set global table parameters -->
55 <!-- * ============================================================== -->
56 <!-- * First, set a few parameters based on attributes specified in -->
57 <!-- * the table source. -->
58 <xsl:param name="allbox">
59 <xsl:if test="not(@frame = 'none') and not(@border = '0')">
60 <!-- * By default, put a box around table and between all cells, -->
61 <!-- * unless frame="none" or border="0" -->
62 <xsl:text>allbox </xsl:text>
65 <xsl:param name="center">
66 <!-- * If align="center", center the table. Otherwise, tbl(1) -->
67 <!-- * left-aligns it by default; note that there is no support -->
68 <!-- * in tbl(1) for specifying right alignment. -->
69 <xsl:if test="@align = 'center' or d:tgroup/@align = 'center'">
70 <xsl:text>center </xsl:text>
73 <xsl:param name="expand">
74 <!-- * If pgwide="1" or width="100%", then "expand" the table by -->
75 <!-- * making it "as wide as the current line length" (to quote -->
76 <!-- * the tbl(1) guide). -->
77 <xsl:if test="@pgwide = '1' or @width = '100%'">
78 <xsl:text>expand </xsl:text>
82 <!-- * ============================================================== -->
83 <!-- * Convert table to HTML -->
84 <!-- * ============================================================== -->
85 <!-- * Process the table by applying the HTML templates from the -->
86 <!-- * DocBook XSL stylesheets to the whole thing; because we don't -->
87 <!-- * override any of the <row>, <entry>, <tr>, <td>, etc. templates, -->
88 <!-- * the templates in the HTML stylesheets (which we import) are -->
89 <!-- * used to process those. -->
90 <xsl:param name="html-table-output">
92 <xsl:when test=".//d:tr">
93 <!-- * If this table has a TR child, it means that it's an -->
94 <!-- * HTML table in the DocBook source, instead of a CALS -->
95 <!-- * table. So we just copy it as-is, while wrapping it -->
96 <!-- * in an element with same name as its original parent. -->
97 <xsl:for-each select="descendant-or-self::d:table|descendant-or-self::d:informaltable">
98 <xsl:element name="{local-name(..)}">
100 <xsl:apply-templates mode="strip.namespace" select="*"/>
106 <!-- * Otherwise, this is a CALS table in the DocBook source, -->
107 <!-- * so we need to apply the templates in the HTML -->
108 <!-- * stylesheets to transform it into HTML before we do -->
109 <!-- * any further processing of it. -->
110 <xsl:apply-templates/>
114 <xsl:param name="contents" select="exsl:node-set($html-table-output)"/>
116 <xsl:call-template name="htmltotbl">
117 <xsl:with-param name="source" select="$source"/>
118 <xsl:with-param name="title" select="$title"/>
119 <xsl:with-param name="contents" select="$contents"/>
120 <xsl:with-param name="allbox" select="$allbox"/>
121 <xsl:with-param name="expand" select="$expand"/>
122 <xsl:with-param name="center" select="$center"/>