XML technologies / DocBook / Generating FO (PDF) / Formatting headings / Customizing with attribute sets

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

The easiest way to customize headings is to populate attribute sets. The DocBook FO stylesheets distinguish between left-hand (verso) and right-hand (recto) pages. The attribute sets for an element are therefore named ELEMENT ELEMENT.titlepage.recto.style and ELEMENT.titlepage.verso.style, depending on the side on which the heading appears.

For example, the following attribute sets are defined for a book title (file fo/titlepage.xsl):

Example: Attribute sets for a book title on left- and right-hand pages

<xsl:attribute-set name="book.titlepage.recto.style">
    <xsl:attribute name="font-family">
        <xsl:value-of select="$title.fontset"/>
    </xsl:attribute>
    <xsl:attribute name="font-weight">bold</xsl:attribute>
    <xsl:attribute name="font-size">12pt</xsl:attribute>
    <xsl:attribute name="text-align">center</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="book.titlepage.verso.style">
    <xsl:attribute name="font-size">10pt</xsl:attribute>
</xsl:attribute-set>

This distinction is necessary for a book title: it appears in a larger font on the title page and a smaller font in the imprint. Where the distinction is unnecessary, the attribute sets are empty. The following code doubles the book title’s font size on the right-hand page:

<xsl:attribute-set name="book.titlepage.recto.style">
    <xsl:attribute name="font-size">24pt</xsl:attribute>
</xsl:attribute-set>

All other attributes retain their original definitions.

  

back to top