Hello!
With "half-double-sided" I mean that sometimes the pages switch between
double-sided output(with odd and even pages) and single-sided output.
But this issue only arises without the user.pagemaster! The main problem
is that not every chapter wraps to the next page.
Here are the complete customized templates:
<xsl:template name="force.page.count">
<xsl:param name="element" select="local-name(.)"/>
<xsl:param name="master-reference" select="''"/>
<xsl:choose>
<xsl:when test="$element != 'chapter'">auto</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="$element = 'chapter'">auto</xsl:when>
<xsl:when test="$element = 'toc'">auto-odd</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</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>
<xsl:template name="user.pagemasters">
<fo:page-sequence-master master-name="body-chapter">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="blank"
blank-or-not-blank="blank"/>
<fo:conditional-page-master-reference
master-reference="body-odd"
odd-or-even="odd"/>
<fo:conditional-page-master-reference odd-or-even="even">
<xsl:attribute name="master-reference">
<xsl:choose>
<xsl:when test="$double.sided != 0">body-even</xsl:when>
<xsl:otherwise>body-odd</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</fo:conditional-page-master-reference>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</xsl:template>
<xsl:template name="select.user.pagemaster">
<xsl:param name="element"/>
<xsl:param name="pageclass"/>
<xsl:param name="default-pagemaster"/>
<xsl:choose>
<xsl:when test="$element = 'chapter'">
<xsl:value-of select="'body-chapter'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$default-pagemaster"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Greetings,
Mathias
Von: Bob Stayton [mailto:[email protected]]
Gesendet: Mittwoch, 07. Oktober 2009 22:01
An: Mathias Schindler; DocBook Apps
Betreff: Re: [docbook-apps] Don't break chapter's to recto pages
Hi,
I'm not clear what you mean by "half-double-sided". Can you provide a
short example that illustrates the problem, and complete examples of
your two customized templates?
Bob Stayton
Sagehill Enterprises
[email protected]
----- Original Message -----
From: Mathias Schindler <mailto:[email protected]>
To: DocBook Apps <mailto:[email protected]>
Sent: Monday, October 05, 2009 6:00 AM
Subject: [docbook-apps] Don't break chapter's to recto pages
Hi!
I have a problem concerning the page breaks of <chapter>
elements in double-sided PDF output!
The case is that I want <part>s, <toc>, <preface>, <index> and
<colophon> to break to the next recto page, while chapters and
appendices should only break to the next page (regardless if recto or
verso).
First I tried to modify the "force.page.count"- and
"initial.page.number"-templates as follows:
force.page.count(only changed content)::
<xsl:choose>
<xsl:when test="$element != 'chapter'">auto</xsl:when>
<xsl:when test="$double.sided != 0">end-on-even</xsl:when>
<xsl:otherwise>no-force</xsl:otherwise>
</xsl:choose>
initial.page.number(only changed content):
<xsl:when test="$double.sided != 0">
<xsl:choose>
<xsl:when test="$element =
'chapter'">auto</xsl:when>
...
Unfortunately this ended up in displaying me a
"half-double-sided" and "half-single-sided" document. Furthermore, not
every chapter wants to wrap to a verso page...
I also tried to add a custom user-pagemaster:
<xsl:template name="user.pagemasters">
<fo:page-sequence-master master-name="body-chapter">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference
master-reference="blank"
blank-or-not-blank="blank"/>
<fo:conditional-page-master-reference
master-reference="body-odd"
odd-or-even="odd"/>
<fo:conditional-page-master-reference
odd-or-even="even">
<xsl:attribute name="master-reference">
<xsl:choose>
<xsl:when test="$double.sided !=
0">body-even</xsl:when>
<xsl:otherwise>body-odd</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</fo:conditional-page-master-reference>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</xsl:template>
<xsl:template name="select.user.pagemaster">
<xsl:param name="element"/>
<xsl:param name="pageclass"/>
<xsl:param name="default-pagemaster"/>
<xsl:choose>
<xsl:when test="$element = 'chapter'">
<xsl:value-of select="'body-chapter'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$default-pagemaster"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
After that it works almost perfect - almost. The double-sided
output is fine but again not every chapter breaks to a verso page. I
sometimes have one blank page in front of a chapter and sometimes not.
Can anyone help me?
Thanks in advance,
Mathias Schindler