This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: [docbook-apps] Not break chapters
- From: "Bob Stayton" <bobs at sagehill dot net>
- To: "Bill Lawrence" <scribe at matrixplus dot com>, <docbook-apps at lists dot oasis-open dot org>
- Date: Wed, 26 May 2004 10:06:45 -0700
- Subject: Re: [docbook-apps] Not break chapters
- References: <023f01c4433b$2ce2a980$10bea8c0@local.matrixplus.com>
Yes, you can do this by customizing the chapter template without altering
the page masters.
If you look at the match="chapter" template in fo/component.xsl, you'll see
that it creates an fo:page-sequence for each chapter. To prevent that you
will need to customize that template so only the first chapter generates the
page-sequence element, and all other chapters are processed within the same
page-sequence (but not generating their own nested page-sequence which is
not permitted).
At the end of the "chapter" template, add this xsl:for-each statement to
process all the non-first chapters with a named template:
<xsl:apply-templates/>
<xsl:for-each select="/book/chapter[position() != 1]">
<xsl:call-template name="chapter.continued"/>
</xsl:for-each>
</fo:flow>
</fo:page-sequence>
</xsl:template>
Then create a template named "chapter.continued" that has the same internal
steps as the chapter template, but removing the page-sequence and its
attributes and changing fo:flow to fo:block:
<xsl:template name="chapter.continued">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<fo:block>
<fo:block id="{$id}">
<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:call-template name="component.toc.separator"/>
</xsl:if>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
Finally, to prevent the non-first chapters from being processed again by the
chapter template, add this null template:
<xsl:template match="chapter[preceding-sibling::chapter]">
</xsl:template>
You may also need to look at fixing up the PDF bookmarks, depending on the
FO processor you are using.
Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net
----- Original Message -----
From: "Bill Lawrence" <scribe@matrixplus.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Wednesday, May 26, 2004 9:04 AM
Subject: [docbook-apps] Not break chapters
> I'm building a booklet that's a bit tight on space, and it would be
> really handy if I could stop forcing chapter title pages to a recto
> page. Is there a simple way to do this without making huge
> modifications to the FO page masters?
>
> Thanks in advance,
>
> Bill Lawrence
> Senior Technical Writer
> Matrix Solutions
>
>
>
> To unsubscribe from this list, send a post to
docbook-apps-unsubscribe@lists.oasis-open.org, or visit
http://www.oasis-open.org/mlmanage/.
>
>
>
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.