XML technologies / DocBook / Generating FO (PDF) / Formatting headings / Formatting structural elements
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
As shown in Formatting structural elements for HTML, for XSL-FO use the same template named component.title. To obtain the same presentation as in HTML, proceed as follows:
Create a customization file as shown in Creating a customization file for XSL-FO.
Copy the template named
component.titlefrom the filefo/component.xslinto your customization file.Find the following code inside the template:
<xsl:variable name="title">
<xsl:apply-templates select="$node" mode="object.title.markup">
<xsl:with-param name="allow-anchors" select="1"/>
</xsl:apply-templates>
</xsl:variable>Replace the preceding code with the following lines:
<xsl:variable name="title">
<fo:block font-family="{$title.fontset}" text-align="right" keep-together.within-column="always">
<fo:block font-weight="normal" font-size="{$body.font.master * 10.7}pt" padding-end="0pt" margin-right="-12pt" line-height="0.65" space-after="10pt">
<xsl:apply-templates select="$node" mode="label.markup"/>
</fo:block>
<fo:block font-size="{$body.font.master * 2.48}pt">
<xsl:apply-templates select="$node" mode="title.markup"/>
</fo:block>
</fo:block>
</xsl:variable>Line 2: Creates the surrounding block. This sets alignment and font family.
Line 3: Creates the marker. Its font size is calculated from the parameterbody.font.masterand a factor. Vertical alignment is adjusted usingmargin-rightslightly to the right. This adjustment depends on the font.
Line 6: Creates the title, using a slightly smaller font size.
Copyright © 2009 Millin Verlag
You may print the online version for your private use.
Otherwise, this chapter from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Millin Verlag, Siebengebirgsring 36, 53797 Lohmar, info(at)millin.de
back to top