Docbook: Chapter number and word "Chapter" in header
docbook, xml, xsl-fo, xslt
Solution
Try the following (trying because I am not too familiar with DocBook):
Add
<xsl:apply-templates select="." mode="object.title.markup"/>
to the `header.content` template. This should insert the "chapter title with chapter number label". See the Docbook documentation reference here.
<xsl:template name="header.content">
<xsl:param name="pageclass" select="''"/>
<xsl:param name="sequence" select="''"/>
<xsl:param name="position" select="''"/>
<xsl:param name="gentext-key" select="''"/>
<fo:block>
<!-- sequence can be odd, even, first, blank -->
<!-- position can be left, center, right -->
<xsl:choose>
<xsl:when test="$sequence = 'blank'">
<!-- nothing -->
</xsl:when>
<xsl:when test="$position='left'">
<xsl:call-template name="draft.text"/>
<xsl:text>Chapter </xsl:text>
<xsl:apply-templates select="." mode="object.title.markup"/>
</xsl:text> </xsl:text>
</xsl:when>
</xsl:choose>
<xsl:when test="$position='right'">
<fo:page-number/>
</xsl:when>
</fo:block>
</xsl:template>
But note that there might be a difference between `title.markup` and `titleabbrev.markup`.
Problem
I'm writing documentation in DocBook and want to publish it in PDF with headers and footers. For this purpose I have this style: ``` <xsl:template name="header.content"> <xsl:param name="pageclass" select="''"/> <xsl:param name="sequence" select="''"/> <xsl:param name="position" select="''"/> <xsl:param name="gentext-key" select="''"/> <fo:block> <!-- sequence can be odd, even, first, blank --> <!-- position can be left, center, right --> <xsl:choose> <xsl:when test="$sequence = 'blank'"> <!-- nothing --> </xsl:when> <xsl:when test="$position='left'"> <xsl:call-template name="draft.text"/> <xsl:apply-templates select="." mode="titleabbrev.markup"/> </xsl:when> </xsl:choose> <xsl:when test="$position='right'"> <fo:page-number/> </xsl:when> </fo:block> </xsl:template> ``` With this piece of code, I get the the following header: ``` My first chapter blah-blah 1 ``` I want to get this: ``` Chapter 1: My first chapter blah-blah 1 ``` What templates should I call to create such autotext?