Hi,
The good news is that you do not need to do custom page masters to control
this. Each page-sequence determines its own starting page number and
whether it generates a blank page at the end to force an even number of
pages (for double sided output). The preface, toc, and each of the "List
Of" are in their own page sequence, and in double.sided output that means
they end on an even page which forces those blank pages if necessary. In
DocBook XSL, there are two templates that customize this behavior, and you
have to do both because in XSL-FO page numbers do not always have to be
sequential.
The template named 'force.page.count' in fo/pagesetup.xsl is used to specify
the attribute value for the force-page-count property. It is called for each
page-sequence. When that property is 'end-on-even' it forces a blank page if
necessary. If it is 'no-force', then no blank page. You want to set your
front matter page-sequences to use 'no-force'.
The template named 'initial.page.number' is used to specify the attribute
value for the initial-page-number property on each page sequence. When set
to 'auto-odd', it starts the page-sequence on the next odd number. If set
to 'auto', then it starts on the next available page number (even or odd).
The default value for double.sided output is 'auto-odd', so if you don't
change this template too, you will find that you are skipping page numbers
in your output because the blank page is not generated but 'auto-odd' is
still on.
Both templates are fed two params: the name of the page master and the
element for which the page-sequence is being generated. The TOC and List Of
page sequences use page master name 'lot', and preface and other front
matter use 'front'. You use those in an xsl:choose to customize behavior.
This customization does what you want, I think. I left
force-page-count="end-on-even" for preface so whatever comes after it (like
a chapter) will start on an odd page, assuming you are using double-sided
output. I use 'starts-with' in the test for the $master-reference value so
it works with both 'front' and 'front-draft' page masters.
<xsl:template name="force.page.count">
<xsl:param name="element" select="local-name(.)"/>
<xsl:param name="master-reference" select="''"/>
<xsl:choose>
<xsl:when test="starts-with($master-reference,
'lot')">no-force</xsl:when>
<xsl:when test="$element = 'preface'">end-on-even</xsl:when>
<xsl:when test="starts-with($master-reference,
'front')">no-force</xsl:when>
<xsl:when test="$double.sided != 0">end-on-even</xsl:when>
<xsl:otherwise>no-force</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="initial.page.number">
<xsl:param name="element" select="local-name(.)"/>
<xsl:param name="master-reference" select="''"/>
<xsl:variable name="first.book.content"
select="ancestor::book/*[
not(self::title or
self::subtitle or
self::titleabbrev or
self::bookinfo or
self::info or
self::dedication or
self::preface or
self::toc or
self::lot)][1]"/>
<xsl:choose>
<xsl:when test="$double.sided != 0">
<xsl:choose>
<xsl:when test="starts-with($master-reference,
'lot')">auto</xsl:when>
<xsl:when test="starts-with($master-reference,
'front')">auto</xsl:when>
<xsl:when test="$element = 'preface'">auto</xsl:when>
<xsl:when test="$element = 'toc'">auto</xsl:when>
<xsl:when test="$element = 'book'">1</xsl:when>
<xsl:when test="$element = 'preface'">auto-odd</xsl:when>
<xsl:when test="($element = 'dedication' or $element = 'article')
and not(preceding::chapter
or preceding::preface
or preceding::appendix
or preceding::article
or preceding::dedication
or parent::part
or parent::reference)">1</xsl:when>
<xsl:when test="generate-id($first.book.content) =
generate-id(.)">1</xsl:when>
<xsl:otherwise>auto-odd</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$element = 'toc'">auto</xsl:when>
<xsl:when test="$element = 'book'">1</xsl:when>
<xsl:when test="$element = 'preface'">auto</xsl:when>
<xsl:when test="($element = 'dedication' or $element = 'article') and
not(preceding::chapter
or preceding::preface
or preceding::appendix
or preceding::article
or preceding::dedication
or parent::part
or parent::reference)">1</xsl:when>
<xsl:when test="generate-id($first.book.content) =
generate-id(.)">1</xsl:when>
<xsl:otherwise>auto</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net