Founder and Lead Developer of Macrotone Consulting Ltd.

DocBook XML tables


We have been studying  the DocBook DTD and in particular the table specifications.  There are two separate and distinct formats supported, the originals CALS format and the ‘newer’ HTML format since DocBook version 4.3. CALS is an SGML standard developed by the U.S. military, and their set of table tags was one of the first to be developed that included complex features for tables.

Some confusion was encountered since one source claimed that both table formats could not be used in the same document, whilst another source claimed that the two forms cannot be mixed within  the same definition, which makes more sense.

Later, because of widespread familiarity with HTML tables, DocBook added HTML table elements. Now you can use tr and td instead of row and entry in a table.  They cannot be mixed within one table. Also, the content of each table cell has to be valid DocBook, so you cannot usually just cut and paste an HTML table into your DocBook document. But the DTD does permit a document to contain both CALS tables and HTML tables. The tgroup element is the distinguishing characteristic between them. A CALS table requires a tgroup, and an HTML table does not permit one.

The formats are sufficiently similar that it is worth mentioning them here.  The following table neatly summarises the differences.

Purpose HTML Element CALS Element Comments
Container for table elements. table, informal­table table, informal­table The CALS table element requires a title, an HTML table element requires a caption. An informaltable accepts neither.
Table title caption title Use informaltable for an HTML table without a caption.
Wrapper for table section Not available tgroup HTML tables do not support subsections of a table with different column specifications. CALS requires at least one tgroup.
Column specifications col, colgroup colspec, spanspec The CALS spanspec element specifies horizontal spanning (joining) of cells.
Wrapper for header rows thead thead  
Wrapper for body rows tbody tbody  
Wrapper for footer rows tfoot tfoot In both HTML and CALS, tfoot must appear before tbody.
Row tr row All open tr tags must have a closing tag.
Cell td, th entry All open td tags must have a closing tag.
Nested table informaltable inside a td entrytbl inside a row Nested HTML tables permitted since version 4.4 of the DTD.


The table format is not what I would call very pretty and we are investigating how one can use different CSS classes to make them ‘prettier’.

Joomla and JTableNested
Using XXE as an XML editor
 

By accepting you will be accessing a service provided by a third-party external to https://macrotoneconsulting.co.uk/

Go To Top

The Macrotone Consulting Web site would like to use cookies to store information on your computer, to improve our website. Cookies used for the essential operation of the site have already been set. To find out more about the cookies we use and how to delete them, see our Privacy Policy.

I accept cookies from this site.