Hi Gabriela,
Yes, I've done this kind of half title page before. The book template calls
an empty placeholder template named 'front.cover' before any other content.
If you add such a template to your customization layer, it will appear
before the title page. That template needs to call the template named
'page.sequence' to generate an fo:page-sequence for the extra content.
Since you are already doing double sided, the new page sequence will
automatically generate the blank verso page.
You put the content of the page-sequence in the 'content' param for the
template. Below is an example that puts just the title and subtitle on the
extra title page. Those xsl:apply-templates were copied from
fo/titlepage.templates.xsl, from the template named 'book.titlepage.recto'
which generates the normal title page. If you have customized your title
page and generated new title page templates, you will want to copy those
instead.
The page numbering templates also need an update so you get sequential roman
numerals through them all.
If possible, I would suggest you upgrade your FOP to the latest version,
though. And the DocBook stylesheets are currently at 1.77.1, with a new
release coming soon.
<xsl:template name="front.cover">
<xsl:call-template name="page.sequence">
<xsl:with-param name="master-reference">titlepage</xsl:with-param>
<xsl:with-param name="content">
<xsl:choose>
<xsl:when test="bookinfo/title">
<xsl:apply-templates mode="book.titlepage.recto.auto.mode"
select="bookinfo/title"/>
</xsl:when>
<xsl:when test="info/title">
<xsl:apply-templates mode="book.titlepage.recto.auto.mode"
select="info/title"/>
</xsl:when>
<xsl:when test="title">
<xsl:apply-templates mode="book.titlepage.recto.auto.mode"
select="title"/>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="bookinfo/subtitle">
<xsl:apply-templates mode="book.titlepage.recto.auto.mode"
select="bookinfo/subtitle"/>
</xsl:when>
<xsl:when test="info/subtitle">
<xsl:apply-templates mode="book.titlepage.recto.auto.mode"
select="info/subtitle"/>
</xsl:when>
<xsl:when test="subtitle">
<xsl:apply-templates mode="book.titlepage.recto.auto.mode"
select="subtitle"/>
</xsl:when>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- Set book titlepage page number format to i -->
<xsl:template name="page.number.format">
<xsl:param name="element" select="local-name(.)"/>
<xsl:param name="master-reference" select="''"/>
<xsl:choose>
<xsl:when test="$element = 'toc' and self::book">i</xsl:when>
<xsl:when test="$element = 'book'">i</xsl:when>
<xsl:when test="$element = 'preface'">i</xsl:when>
<xsl:when test="$element = 'dedication'">i</xsl:when>
<xsl:when test="$element = 'acknowledgements'">i</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- format invisible title page numbers in roman numerals for PDF
display -->
<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::acknowledgements 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="$element = 'toc'">auto-odd</xsl:when>
<xsl:when test="$element = 'book'">auto-odd</xsl:when>
<!-- preface typically continues TOC roman numerals -->
<!-- Change page.number.format if not -->
<xsl:when test="$element = 'dedication'">auto-odd</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>
<!-- 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>
</xsl:stylesheet>
Bob Stayton
Sagehill Enterprises
[email protected]
From: Gabriela Simonka
Sent: Thursday, December 06, 2012 7:28 AM
To: [email protected]
Subject: [docbook] Including two title pages in a PDF file and page
numbering
Hello,
We are printing two documents that are part of our software help system. We
are having an issue with customizing the front matter for our needs.
Right now we have one title page with the publication/revision information
on the 'verso', followed by the generated table of contents. The page
numbering begins with the titlepage (even though it's not printed, which is
fine), so that the table of contents is page 3.
What we would like is to add another simple title page as is found in most
published books. How does one do this?
We would also like to change the page numbering format so that the front
matter, beginning with the first title page is in roman numerals and then is
reset with the the first page of the manual. We would also like first page
of the manual to begin on the right.
To summarize, this is what we're looking for:
Titlepage(1) recto i (right)
(blank) verso ii (left)
Titlepage(2) recto iii (right)
(pub/rev info) verso iv (left)
Table of contents recto v (right)
Introduction recto 1 (right)
The documents are articles and not books. We are using DocBook 4, with
docbook-xsl 1.73.2 and fop-0.93. I have consulted the chapters in the
DocBook XSL: The Complete Guide but I have not been able to apply anything
successfully. Can an article have front matter just like a book?
Any guidance would be greatly appreciated.
-Gabriela
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]