- Part I
- Chapter 1
- Chapter 2
- Chapter 3
- Part II
- Chapter 1
- Chapter 2
- Chapter 3
- Part III
- Chapter 1
- Chapter 2
- Chapter 3
The correct behavior would be a single chapter series that goes from 1 to 9. OT issue 1418 indicates that this was fixed in OT 1.7 but I didn’t see any change when I tried it out. Instead I changed my PDF plugin and thought I’d document the change here for anyone else who might need to do it in the future since I wasn’t able to find the answer anywhere.
There are two templates that need to be updated: one for the TOC and one for the chapter first page.
The template for the TOC is below.
<xsl:template match="*[contains(@class, ' bookmap/chapter ')] | *[contains(@class, ' boookmap/bookmap ')]/opentopic:map/*[contains(@class, ' map/topicref ')]" mode="tocPrefix" priority="-1"> <xsl:call-template name="insertVariable"> <xsl:with-param name="theVariableID" select="'Table of Contents Chapter'"/> <xsl:with-param name="theParameters"> <number> <xsl:variable name="id" select="@id" /> <xsl:variable name="topicChapters"> <xsl:copy-of select="$map//*[contains(@class, ' bookmap/chapter ')]" /> </xsl:variable> <xsl:variable name="chapterNumber"> <xsl:number format="1" value="count($topicChapters/*[@id = $id]/preceding-sibling::*) + 1" /> </xsl:variable> <xsl:value-of select="$chapterNumber" /> </number> </xsl:with-param> </xsl:call-template> </xsl:template>
The significant parts here are the $topicChapters
and $chapterNumber
variables.
The template for the chapter first page is insertChapterFirstpageStaticContent
. It’s too long to reproduce in its entirety here, but the code is the same as what’s inside the number
element in the TOC template. The number
element that contains the $topicChapters
and $chapterNumber
variables needs to replace the one inside the xsl:when test="$type = 'chapter'"
block.