Hi Dave,
I might suggest a different
approach that requires less customization. In this approach,
the first chapter creates a page-sequence, and all chapter
content is placed in that single page-sequence, with just
forced page breaks in between. That lets you use the standard
'body' page-master without modification. It would still put a
blank even page at the end of the last chapter, though. Here
is what I tried:
<xsl:template
match="d:chapter[not(preceding-sibling::d:chapter)]">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable
name="master-reference">
<xsl:call-template name="select.pagemaster"/>
</xsl:variable>
<xsl:call-template
name="page.sequence">
<xsl:with-param name="master-reference"
select="$master-reference"/>
<xsl:with-param name="content">
<!-- This chapter's
content -->
<fo:block id="{$id}"
xsl:use-attribute-sets="component.titlepage.properties">
<xsl:call-template name="chapter.titlepage"/>
</fo:block>
<xsl:variable
name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table"
select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')">
<xsl:call-template name="component.toc">
<xsl:with-param name="toc.title.p"
select="contains($toc.params,
'title')"/>
</xsl:call-template>
<xsl:call-template
name="component.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
<!-- and subsequent
chapters included in this page sequence -->
<xsl:apply-templates
select="following-sibling::d:chapter"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- include subsequent
chapters in first chapter's page-sequence -->
<xsl:template
match="d:chapter[preceding-sibling::d:chapter]">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<fo:block break-before="page"/>
<fo:block id="{$id}"
xsl:use-attribute-sets="component.titlepage.properties">
<xsl:call-template name="chapter.titlepage"/>
</fo:block>
<xsl:variable
name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table"
select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="contains($toc.params, 'toc')">
<xsl:call-template name="component.toc">
<xsl:with-param name="toc.title.p"
select="contains($toc.params,
'title')"/>
</xsl:call-template>
<xsl:call-template name="component.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
----- Original Message -----
Sent: Thursday, April 05,
2012 4:06 AM
Subject: [docbook-apps]
Deleting blank pages in chapters
I’ve been trying to delete blank pages in
chapters so that the first chapter starts on an odd page and
subsequent chapters start on even or odd. After having
incorporated several customisations from information in other
postings on the topic, the closest I get is being able to
generate the correct ‘odd-then-even’ page sequence and have no
blank pages between chapters, but the first page starts on page 15 (i.e. it
follows on from the prelims page count) and the page numbers
disappear from the footer.
I have firstly specified a variable
“chaptersrunon” which gives the options of generating the
usual page sequence, plus the ‘no-blanks’ page sequence (“0” –
all chapters start on odd page; “1” – chapters after chapter 1
start on even or odd page with no blanks). I have added a
page-sequence-master called “bodycustom” to template
‘user.pagemasters’ and am calling that in template
select.user.pagemaster, depending on the value of
“chaptersrunon”. I have also set the “bodycustom” page
sequence in template ‘initial.page.number’ and template
‘force.page.count’.
I’ve experimented with the “bodycustom”
page sequence by commenting out some of the
conditional-page-master-reference lines, and by removing
certain elements from the template ‘initial.page.number’ in <xsl:when test="starts-with($master-reference,'bodycustom')">
as I thought that the preface might have been interfering with
the page numbering for the first chapter. I have attached my
entire customisation (which includes removing blanks from the
TOC and LOTs – that works nicely).
Thanks,
--
Dave Gardiner
---------------------------------------------------------------------
To unsubscribe, e-mail:
docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail:
docbook-apps-help@lists.oasis-open.org