Page 1 of 1
Adding title to PDF output
Posted: Fri Oct 14, 2011 7:40 pm
by yoyopoc
Hi,
Using Docbook5 book and currently have section title showing in PDF header for pages, trying to find a way of adding the <part> title to all pages. I'm a complete newbie but a good learner:)
Re: Adding title to PDF output
Posted: Mon Oct 17, 2011 12:41 pm
by Radu
Hi,
You need good knowledge of XSLT and XPath in order to make customizations in the Docbook stylesheets.
Also this manual is a very good resource:
http://sagehill.net/docbookxsl/CustomizingPart.html
I'll try to give you some hints, but it's also a good idea to register and ask customization questions on the Docbook Apps users list which is very active.
We are using DITA for our user manual so I might not give you the best possible way.
So in the stylesheet:
OXYGEN_INSTALL_DIR/frameworks/docbook/xsl/fo/pagesetup.xsl
there is an XSLT template called
header.table which is used to render the content in the header which gets repeated on each page.
This template calls a template called
header.content which has in it code like:
Code: Select all
<xsl:when test="($sequence='odd' or $sequence='even') and $position='center'">
<xsl:if test="$pageclass != 'titlepage'">
<xsl:choose>
<xsl:when test="ancestor::d:book and ($double.sided != 0)">
<fo:retrieve-marker retrieve-class-name="section.head.marker"
retrieve-position="first-including-carryover"
retrieve-boundary="page-sequence"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:when>
That apply templates then matches templates located in the stylesheet:
OXYGEN_INSTALL_DIR/frameworks/docbook/xsl/common/titles.xsl
You can use our XSLT debugger to see from which location in the stylesheet the header content is computed in the output XSL-FO and maybe attempt some modifications.
Regards,
Radu