DocBook added HTML table elements beginning with version 4.3 of the DocBook DTD. This means authors who are already familiar with HTML table markup can use tr
, th
, td
, and other HTML table elements inside table
or informaltable
elements within DocBook documents. See Table 28.1, “Comparison of CALS and HTML tables” for a comparison of CALS and HTML table markup.
Since the DocBook table
element means a table with a title, you must add a caption
element instead of a title
element when using HTML markup in a table
element. The stylesheets will use the caption
for the numbered title, as well as in cross references and any list of tables in the front of a book. If you want a table without a title, then use informaltable
with the HTML markup instead.
The stylesheets process tables with HTML markup using templates separate from the CALS table templates. When the stylesheets encounter a table
or informaltable
element, they check to see if it contains a tgroup
element. If so, then it is processed as a CALS table, which requires that element. HTML tables do not permit a tgroup
element. If the table contains tgroup
, then it must use row
and entry
. If it does not contain tgroup
, then it must use tr
, th
, and td
.
The templates for print output from HTML table markup share some of the templates and attribute-sets used for CALS tables, beginning with version 1.68 of the stylesheets. See Table 28.2, “Table styles for print output” for a list. For example, when you have customize the table.cell.properties
and table.cell.block.properties
templates to respond to tabstyle
attributes in CALS tables, then those customizations are also applied to HTML markup tables that use tabstyle
attributes.
One advantage of using HTML table markup shows up when generating HTML output. Many elements are simply copied from the source document to the output, along with any attributes. It is a shallow copy, meaning child elements are not necessarily copied. Of course, the content of td
or th
is processed, not just copied, because it is not HTML markup. The complete list of elements that are copied to HTML output are:
table colgroup col caption thead tbody tr th td
This feature lets you use HTML specific attributes such as cellpadding
or onmouseover
and they are copied to the output. Any HTML-specific attributes that are not supported in FO output will be ignored by the print stylesheet.
DocBook XSL: The Complete Guide - 3rd Edition | PDF version available | Copyright © 2002-2005 Sagehill Enterprises |