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>
   <!-- double-sided output -->
   <xsl:when test="$double.sided != 0">end-on-even</xsl:when>
   <!-- single-sided output -->
   <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="''"/>

 <!-- Select the first content that the stylesheet places
      after the TOC -->
 <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>
   <!-- double-sided output -->
   <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>
       <!-- preface typically continues TOC roman numerals -->
       <!-- Change page.number.format if not -->
       <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>

   <!-- single-sided output -->
   <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
[email protected]


----- Original Message ----- From: "Bergfrid Skaara" <[email protected]>
To: <[email protected]>
Sent: Wednesday, March 25, 2009 6:43 AM
Subject: [docbook-apps] how to omit blank pages in the front matter?


I get blank verso pages in doublesided PDF output (with FOP) after
list of figures, list of tables, and preface. I would like to prune
out all blank pages for paper efficiency.

I do not get page breaks  after the titlepage and after the table of
contents. I'm the titlepage spec template, the t:titlepage-separator
elements are empty, as are the before and after actions. I'm guessing
that this has something to do with the t:titlepage-content block
specifies content for the t:side="recto" with the verso side being
empty. But cutting out the empty verso blocks will probably only mess
things up further since there is no way to know the length of these
lists in advance and thus unknown if it will actually go on a verso or
recto page. Does this call for custom page masters?

Any suggestions?



Best regards,
Bergfrid Skaara

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to