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


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

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

Subject: Re: [docbook-apps] Costomizing fo stylesheet?

----- Original Message -----
From: "Řyvind Hvamstad" <oyvind@hvamstad.net>
To: <docbook-apps@lists.oasis-open.org>
Sent: Sunday, July 13, 2003 4:14 AM
Subject: [docbook-apps] Costomizing fo stylesheet?

> Hi, I'm trying to customize the chapter of a book and also make the
> section titles indent to the same position as the text. I want the
> chapter layout to look something like this:
> ___________________________________
> |                                  |
> |                        Chapter 7 |
> |__________________________________|
> |                   Chapter title  |
> |__________________________________|
> |                                  |
> |  Section 1                       |
> |  text in the section             |
> |  ..................              |
> |__________________________________|
> I started reading the stylesheets that come with the distribution on
> debian, but I find that the flow is hard to follow. Could anyone give me
> a clue about what templates to override, and also how I can align the
> section titles with the section text?

The chapter titles are handled by the titlepage mechanism and some
The following attribute set customization will center everything on the
"titlepage", which is just the top of the chapter's first page.  If you had
chapter author, for example, it would be centered as well.

<xsl:attribute-set name="chapter.titlepage.recto.style">
  <xsl:attribute name="text-align">center</xsl:attribute>

But the default chapter title style is "Chapter 7. Chapter title" on one
You want separate blocks. For that, you will need to customize
a template.  If you check the titlepage specifications that are
declared in fo/titlepage.templates.xml, you will see that the chapter
title is handled by a named template:

  <t:titlepage t:element="chapter" t:wrapper="fo:block"
    <t:titlepage-content t:side="recto" margin-left="{$title.margin.left}">
      <title t:named-template="component.title"

You could customize the 'component.title' template, found in
fo/component.xsl. It is used for chapters, appendixes, preface,
etc, so you need to make it conditional for only chapters, or
create a new custom template just for chapters and change
the spec file (and regenerate the titlepage stylesheet file from it).

The customization would be inside the existing fo:block, creating
two new blocks.  Start an fo:block,
call the 'gentext' template (found in common/l10n.xsl) to generate the
word "Chapter", apply-templates on the context element
in 'label.markup' mode to generate the number, close the fo:block
and start a new one, then apply-templates in 'title.markup' mode
to generate the title.  This is roughly it:

      <xsl:call-template name="gentext" >
        <xsl:with-param name="key" select="'Chapter'"/>
      <xsl:text> </xsl:text>
      <xsl:apply-templates select="$node" mode="label.markup"/>
      <xsl:apply-templates select="$node" mode="title.markup"/>

The section title indent is controlled by setting this parameter:

<xsl:param name="title.margin.left">0</xsl:param>

Bob Stayton
Sagehill Enterprises

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