I am trying to set section and chapter specific headers for my DocBook using the following syntax:
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<book>
<title>My Guide to Bowling</title>
<chapter>
<section header="section header">
<title>Buying the right clothes</title>
<para>I want to buy some shoes</para>
</section>
</chapter>
</book>
Then in my XSL i am doing the following customization to set the right header:
<?xml version='1.0'?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
<xsl:import href="/docbook-xsl-1.79.1/fo/docbook.xsl"/>
<xsl:template name="header.content">
<xsl:param name="pageclass"/>
<xsl:param name="position" select="''"/>
<fo:block>
<xsl:choose><xsl:when test="$pageclass = 'body'">
<xsl:choose><xsl:when test="$position = 'center'">
<xsl:value-of select="ancestor-or-self::*[@header]/@header"/>
</xsl:when></xsl:choose>
</xsl:when></xsl:choose>
</fo:block>
</xsl:template>
</xsl:stylesheet>
This is working for chapters but not sections. How to make it work for sections in the current page?
Try this