I have created an extensive customization of the part titlepage that
gives choices for changing the order of the part toc and partintro, and
whether they occur on the title page recto or verso.
I noticed that when the toc appears on the part titlepage verso, the
page number generated in the book toc was where the toc appeared – so it
would be an even page number, whereas it should be the page where the
title is (i.e. the first page of the titlepage. The ID attribute that
generates the page numbers is by default applied to the coding that
generates the toc. But if someone wants the toc to appear on the verso,
the page number in the book toc will be incorrect. So I had to move the
fo: block containing the ID to be applied to the *title* for those
options (highlighted in the following). Is this a customization that
should be in the standard stylesheets?
-----
<xsl:variablename="parttocorder"xml:id="p5-201">1</xsl:variable>
<xsl:templatename="part.titlepage.before.verso"priority="1">
<xsl:variablename="toc.params">
<xsl:call-templatename="find.path.params">
<xsl:with-paramname="table"
select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:iftest="contains($toc.params, 'toc')">
<xsl:call-templatename="division.toc">
<xsl:with-paramname="toc.context"select="."/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:templatematch="d:part"mode="part.titlepage.mode">
<xsl:paramname="additional.content"/>
<xsl:variablename="id">
<xsl:call-templatename="object.id"/>
</xsl:variable>
<xsl:variablename="titlepage-master-reference">
<xsl:call-templatename="select.pagemaster">
<xsl:with-paramname="pageclass"select="'titlepage'"/>
</xsl:call-template>
</xsl:variable>
<fo:page-sequencehyphenate="{$hyphenate}"
master-reference="{$titlepage-master-reference}">
<xsl:attributename="language">
<xsl:call-templatename="l10n.language"/>
</xsl:attribute>
<xsl:attributename="format">
<xsl:call-templatename="page.number.format">
<xsl:with-paramname="master-reference"
select="$titlepage-master-reference"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attributename="initial-page-number">
<xsl:call-templatename="initial.page.number">
<xsl:with-paramname="master-reference"
select="$titlepage-master-reference"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attributename="force-page-count">
<xsl:call-templatename="force.page.count">
<xsl:with-paramname="master-reference"
select="$titlepage-master-reference"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attributename="hyphenation-character">
<xsl:call-templatename="gentext">
<xsl:with-paramname="key"select="'hyphenation-character'"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attributename="hyphenation-push-character-count">
<xsl:call-templatename="gentext">
<xsl:with-paramname="key"select="'hyphenation-push-character-count'"/>
</xsl:call-template>
</xsl:attribute>
<xsl:attributename="hyphenation-remain-character-count">
<xsl:call-templatename="gentext">
<xsl:with-paramname="key"select="'hyphenation-remain-character-count'"/>
</xsl:call-template>
</xsl:attribute>
<xsl:apply-templatesselect="."mode="running.head.mode">
<xsl:with-paramname="master-reference"select="$titlepage-master-reference"/>
</xsl:apply-templates>
<xsl:apply-templatesselect="."mode="running.foot.mode">
<xsl:with-paramname="master-reference"select="$titlepage-master-reference"/>
</xsl:apply-templates>
<fo:flowflow-name="xsl-region-body">
<xsl:call-templatename="set.flow.properties">
<xsl:with-paramname="element"select="local-name(.)"/>
<xsl:with-paramname="master-reference"
select="$titlepage-master-reference"/>
</xsl:call-template>
<xsl:choose>
<xsl:whentest="$parttocorder = '1'">
<fo:blockid="{$id}">
<xsl:call-templatename="part.titlepage"/>
</fo:block>
<xsl:copy-ofselect="$additional.content"/>
</xsl:when>
<xsl:whentest="$parttocorder = '2'">
<xsl:call-templatename="part.titlepage.recto"/>
<xsl:copy-ofselect="$additional.content"/>
<fo:blockid="{$id}">
<xsl:call-templatename="part.titlepage"/>
</fo:block>
</xsl:when>
<xsl:whentest="$parttocorder = '3'">
<fo:blockid="{$id}">
<xsl:call-templatename="part.titlepage"/>
</fo:block>
<fo:blockbreak-after="page"/>
<xsl:copy-ofselect="$additional.content"/>
</xsl:when>
<xsl:whentest="$parttocorder = '4'">
<fo:blockid="{$id}">
<xsl:call-templatename="part.titlepage.recto"/>
</fo:block>
<xsl:copy-ofselect="$additional.content"/>
<fo:blockbreak-after="page"/>
<xsl:call-templatename="part.titlepage"/>
</xsl:when>
<xsl:whentest="$parttocorder = '5'">
<fo:blockid="{$id}">
<xsl:call-templatename="part.titlepage.recto"/>
</fo:block>
<fo:blockbreak-after="page"/>
<xsl:call-templatename="part.titlepage"/>
<xsl:copy-ofselect="$additional.content"/>
</xsl:when>
<xsl:whentest="$parttocorder = '6'">
<fo:blockid="{$id}">
<xsl:call-templatename="part.titlepage.recto"/>
</fo:block>
<fo:blockbreak-after="page"/>
<xsl:copy-ofselect="$additional.content"/>
<xsl:call-templatename="part.titlepage"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-templatename="part.titlepage.recto"/>
<fo:blockid="{$id}">
<xsl:call-templatename="part.titlepage"/>
</fo:block>
<xsl:copy-ofselect="$additional.content"/>
</xsl:otherwise>
</xsl:choose>
</fo:flow>
</fo:page-sequence>
</xsl:template>
<xsl:templatename="part.titlepage">
<fo:blockxmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:variablename="recto.content">
<xsl:call-templatename="part.titlepage.before.recto"/>
<xsl:iftest="$parttocorder = '1' or $parttocorder = '3'">
<xsl:call-templatename="part.titlepage.recto"/>
</xsl:if>
<xsl:iftest="$parttocorder = '2' or $parttocorder = '4'">
</xsl:if>
</xsl:variable>
<xsl:variablename="recto.elements.count">
<xsl:choose>
<xsl:whentest="function-available('exsl:node-set')"><xsl:value-ofselect="count(exsl:node-set($recto.content)/*)"/></xsl:when>
<xsl:whentest="contains(system-property('xsl:vendor'), 'Apache Software
Foundation')">
<xsl:value-ofselect="count(exsl:node-set($recto.content)/*)"/></xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:iftest="(normalize-space($recto.content) != '') or
($recto.elements.count > 0)">
<fo:block><xsl:copy-ofselect="$recto.content"/></fo:block>
</xsl:if>
<xsl:variablename="verso.content">
<xsl:call-templatename="part.titlepage.before.verso"/>
<xsl:call-templatename="part.titlepage.verso"/>
</xsl:variable>
<xsl:variablename="verso.elements.count">
<xsl:choose>
<xsl:whentest="function-available('exsl:node-set')"><xsl:value-ofselect="count(exsl:node-set($verso.content)/*)"/></xsl:when>
<xsl:whentest="contains(system-property('xsl:vendor'), 'Apache Software
Foundation')">
<xsl:value-ofselect="count(exsl:node-set($verso.content)/*)"/></xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:iftest="(normalize-space($verso.content) != '') or
($verso.elements.count > 0)">
<fo:block><xsl:copy-ofselect="$verso.content"/></fo:block>
</xsl:if>
<xsl:call-templatename="part.titlepage.separator"/>
</fo:block>
</xsl:template>
<xsl:templatename="generate.part.toc">
</xsl:template>
--
*Dave Gardiner*