Formatting revhistory

If you use a revhistory element, you will find that the information is output by default on the title page of every element except book. If you want to output revhistory for book, or not output it for other elements, then you can customize the title page specifications file and regenerate the title page stylesheet module, as described in Chapter 11, Title page customization.

Tip

A quick way to turn off revhistory from output is to define an empty template for it in a customization layer. The following example will turn it off for all elements that contain a revhistory:

<xsl:template match="revhistory" mode="titlepage.mode"/>

When it is output, a revhistory is formatted as a table, with each revision displayed with revnumber, revdate, and revauthor in one row, and revremark in a second row spanned across all columns. The default table format is rather plain looking, though.

XSL-FO output for revhistory

For print output, you can customize the look of a revhistory table using these attribute-sets:

revhistory attribute-setDescription
revhistory.title.propertiesProperties applied to the table title, which is generated from the stylesheet gentext file, using the template with key="RevHistory". Use this attribute-set for the font properties, alignment, and space above the table.
revhistory.table.propertiesProperties applied to the fo:table containing the history. Use this attribute-set for a table border, width, or background color
revhistory.table.cell.propertiesProperties applied to each fo:table-cell. Use this attribute-set for cell borders, and font properties of revision entries.

The following example customizes a revision history to make the title bold and centered, add borders and background colors, and set the font size:

<xsl:attribute-set name="revhistory.title.properties">
  <xsl:attribute name="font-size">12pt</xsl:attribute>
  <xsl:attribute name="font-weight">bold</xsl:attribute>
  <xsl:attribute name="text-align">center</xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="revhistory.table.properties">
  <xsl:attribute name="border">0.5pt solid black</xsl:attribute>
  <xsl:attribute name="background-color">#EEEEEE</xsl:attribute>
  <xsl:attribute name="width">50%</xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="revhistory.table.cell.properties">
  <xsl:attribute name="border">0.5pt solid black</xsl:attribute>
  <xsl:attribute name="font-size">9pt</xsl:attribute>
  <xsl:attribute name="padding">4pt</xsl:attribute>
</xsl:attribute-set>

If you want to further customize the revhistory table, for example to adjust column widths or create single-row entries, then customize the templates in fo/titlepage.xsl that start with:

<xsl:template match="revhistory" mode="titlepage.mode">
...
<xsl:template match="revhistory/revision" mode="titlepage.mode">
...

HTML output for revhistory

For HTML output, the DocBook XSL stylesheets do not provide much help with easy customization. The revhistory is still output as a table, and borders are included by default. The only class attribute is on the div class="revhistory" that contains the whole table.

If you need to customize HTML output, you probably will need to customize the templates in html/titlepage.xsl that start with:

<xsl:template match="revhistory" mode="titlepage.mode">
...
<xsl:template match="revhistory/revision" mode="titlepage.mode">
...

The one option that the stylesheet does provide for HTML output of revhistory is putting it in a separately chunked file. Instead of displaying it on the main titlepage, it displays only a link that connects to the separate HTML file. Set the stylesheet parameter generate.revhistory.link to 1 to get this effect. It works with either the chunking or non-chunking stylesheet.