The templates that generate tables in printed output are highly structured in DocBook XSL to facilitate customization. In addition to separate templates handling each table element, there are separate templates to handle different levels of processing for the table itself. These extra layers enable such features a floats, landscape tables, and table titles that are repeated after a page break with a
Table 30.3, “Print table templates” lists the principal templates used for format tables for printed output. The descriptions should help you decide at what level you might apply a customization. These descriptions apply to version 1.70.1 and later of the stylesheets.
Table 30.3. Print table templates
|Top-level template that starts table processing. It calls a template named |
|A short template that determines the table markup type (CALS or HTML markup). If it is a CALS table, it calls a template named |
|This template processes each |
|This template processes the content of the table into an |
|This template processes the result of |
This template processes the result of
This template processes the result of
|The end of this template processes the result of |
While this sequence of templates may seem complicated, its purpose is to separate the various processing functions so they do not interfere with each other. The various layers of table processing are built up from the inside out, with each stage processing the result of the previous stage. This modular style makes for smaller templates that are easier to customize, and makes it easier to find where to apply a customization. The following section provides an example of table customization.
When a long table breaks across a page, it helps the reader if the table title is repeated at the top of the new page. But it helps even more if the title is labeled as "continued" so the reader knows the table is not starting there.
A "continued" label for long tables is not a standard feature of XSL-FO 1.0. It is supported in XSL-FO 1.1 using the
retrieve-table-marker property. Since version 1.1 became a standard only in December 2006, support for its features is gradually being added to XSL-FO processors. You might check your XSL-FO processor documentation to see if that property is supported. If so, then a different customization is needed than the one described here. The DocBook XSL stylesheets will output 1.1 features when more processors support them.
However, if you are using the XEP processor from RenderX, then you can use an extension long provided by that processor. The extension is in the form of an attribute
rx:table-omit-initial-header="true" that is applied to a layout table that wraps around the table content, but is inside the
fo:block that contains the table title too.
This strangely-named attribute's function is to prevent a table header row from appearing on the first page of a table, and allowing it to appear on any subsequent pages if the table is long enough to break across a page boundary. You do not use it on the table's column headings, but rather on a special table header that repeats the table title along with the "continued" label. By omitting it on the first page of the table, you get the behavior you want.
The additional table header is not in the original
fo:table, but in a wrapper table around it. The wrapper table has one column, the width of the entire table, one header cell for the continued title, and one body cell to contain the original
fo:table. When such a table breaks across the page, the new page will display the continued title, a repeat of the original table column headings, and then continue the table rows.
This feature is applied using a customization of the template named
table.layout described in the previous section.
Example 30.7. Table "continued" customization for XEP
<xsl:template name="table.layout"> <xsl:param name="table.content"/> <xsl:choose> <xsl:when test="$xep.extensions = 0 or self::informaltable"> <xsl:copy-of select="$table.content"/> </xsl:when> <xsl:otherwise> <fo:table rx:table-omit-initial-header="true"> <fo:table-header start-indent="0pt"> <fo:table-row> <fo:table-cell> <fo:block xsl:use-attribute-sets="formal.title.properties"> <xsl:apply-templates select="." mode="object.title.markup"/> <fo:inline font-style="italic"> <xsl:text> (continued) </xsl:text> </fo:inline> </fo:block> </fo:table-cell> </fo:table-row> </fo:table-header> <fo:table-body start-indent="0pt"> <fo:table-row> <fo:table-cell> <xsl:copy-of select="$table.content"/> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:attribute-set name="table.properties"> <xsl:attribute name="keep-together.within-column">auto</xsl:attribute> </xsl:attribute-set>
Customize the placeholder template named
The already-processed table is passed in to the template as the
If you are not using XEP, or if this is an
Start the wrapper table and add the extension attribute that is highlighted. Be sure to add the
Add a "continued" label, in this case formatting it with italic.
Copy the original table content into the single body cell of the wrapper table.
For long tables, you might want to set the
|DocBook XSL: The Complete Guide - 4th Edition||PDF version available|
Copyright © 2002-2007 Sagehill Enterprises