OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Subject: Re: DOCBOOK: separating sections from chapter titles / toc

On Sat, Nov 30, 2002 at 03:39:16AM +0100, Tobias Grimm wrote:
> Hi!
> I managed to put a table of contents at the beginning of each chapter
> by setting the following parameter:
> <xsl:param name="generate.toc">
> book/chapter  toc,title
> </xsl:param>
> So far, so good... now the output from docbook+xsl -> fo -> pdf looks
> like this:
> ------------------
> Chapter 1. Chapter
> Table of Contents
>   1.1 Section 1
> 1.1. Section 1
> Blafasel...
> ------------------
> What I would like to have now, is that the first section
> (and only the first!) starts on a new page.
> If you have any hints for me, please let me know.
> And now, it starts to get much more complicated. In the next step, I
> would like to have something like a chapter summarization, that
> follows each chapter's toc on a new page before the first section
> starts. How can something like this be done?
> And at last: Chapters should start always on uneven pages and chapter
> summarizations too. So if i.e. the last section of chapter 1 ends at
> page 11, a blank page has to be added before the next chapter starts
> with page 13. And if the title-page of chapter two and it's toc fit
> on one page, this means, another blank page has to be inserted,
> before the chapter summarization on page 15.
> I think, this is not quit easy to accomplish, but maybe it's possible?
> What do you think?

Yes, it is possible.  First, getting the chapters to begin
on odd pages can be done by setting the 'double.sided'
parameter to 1.  Then chapters will start on an odd-numbered

To get the summary text before the first section, you just
need to put para elements and such in your document after
the chapter <title> and before the first <sect1>.

Then you will want to look at the titlepage
customization machinery that is in the XSL stylesheets.
Basically, you edit a titlepage specification file in
XML, and then use a special XSL stylesheet to generate
a customized titlepage XSL stylesheet file, which you then include
in a stylesheet customization layer.  The general process
is documented here:


In your copy of the spec file titlepage.templates.xml, look
for <t:titlepage element="sect1">.  Change
the empty template <t:titlepage-before side="recto"> to:

  <t:titlepage-before side="recto">
    <xsl:param name="node" select="."/>
    <xsl:if test="not($node/preceding-sibling::sect1)">
      <fo:block break-before="page"/>

This will put only your first sect1 on a new page, the way
you wanted, by checking to see if there are no preceding
siblings that are sect1.  When this is processed into a
stylesheet file, this template it is run before all the
other sect1 titlepage templates, and in this case it
inserts an empty fo:block element with a page break
property.  If you are using <section> instead of sect1, you
will also have to check for ancestor <section> elements.

The titlepage machinery won't help with the page break
after the TOC, because the TOC is not part of the titlepages.
To get the summary text to break onto a new odd page after
the TOC, add these two templates to your stylesheet
customization layer:

<xsl:template match="chapter/*[1]">
  <xsl:call-template name="toc.separator"/>

<xsl:template name="toc.separator">
    <fo:block break-before="odd-page"/>

The first template matches on the first child of <chapter>
regardless of what it is, and calls the toc.separator
template.  That template inserts a page break that
forces to an odd page number.


Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
The SCO Group                               fax:   (831) 429-1887
                                            email: bobs@sco.com

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]

Powered by eList eXpress LLC