This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook-apps] Changing chapter title pages


On Fri, Oct 10, 2003 at 12:24:28PM +0200, Wilfred Springer wrote:
> Hi all,
> 
> Using the latest docbook-xsl distribution, I would like to achieve the
> following.
> 
> Instead of having something generated like this:
> 
> +----------------------------+
> |                            |
> |  Chapter 1. Foobar         |
> |  xxxxxxxxxxxxxxxxxxxxxxxx  |
> |  xxxxxxxxxxxxxxxxxxxxxxxx  |
> |  xxxxxxxxxxxxxxxxxxxxxxxx  |
> |  xxxxxxxxxxxxxxxxxxxxxxxx  |
> |  xxxxxxxxxxxxxxxxxxxxxxxx  |
> |  xxxxxxxxxxxxxxxxxxxxxxxx  |
> 
> I want to have it generated like this:
> 
> +----------------------------+
> |                            |
> |  CHAPTER 1.                |
> |                            |
> |  Foobar                    |
> |  xxxxxxxxxxxxxxxxxxxxxxxx  |
> |  xxxxxxxxxxxxxxxxxxxxxxxx  |
> |  xxxxxxxxxxxxxxxxxxxxxxxx  |
> |  xxxxxxxxxxxxxxxxxxxxxxxx  |
> |  xxxxxxxxxxxxxxxxxxxxxxxx  |
> |  xxxxxxxxxxxxxxxxxxxxxxxx  |
> 
> Nevertheless, I still want my references to look something like this:
> 
> "See Chapter 1., Foobar."
> 
> Any suggestions on the approach are welcome.

This requires a customization.
The titlepage mechanism handles the start of chapters.
It is documented at:
http://www.sagehill.net/docbookxsl/HtmlCustomEx.html#HTMLTitlePage

If you look in titlepage.templates.xml, you will see that
currently a chapter title is handled by
a template named 'component.title', which also
applies to appendix, article, dedication, preface,
and bibliography.  To change just chapters,
You can edit your custom titlepage.templates.xml
to use a new template like 'chapter.title' which
you write.  It could look something like this:

<xsl:template name="chapter.title">
  <xsl:param name="node" select="."/>
  <fo:block>
      <xsl:call-template name="gentext">
        <xsl:with-param name="key">Chapter</xsl:with-param>
      </xsl:call-template>
      <xsl:text> </xsl:text>
      <xsl:apply-templates select="$node" mode="label.markup">
        <xsl:with-param name="allow-anchors" select="1"/>
      </xsl:apply-templates>
      <xsl:text>.</xsl:text>
  </fo:block>
  <fo:block>
      <xsl:apply-templates select="$node" mode="title.markup"/>
  </fo:block>
</xsl:template>

The first fo:block outputs the label "Chapter" in the
appropriate language, followed by a space and the chapter
number generated by mode="label.markup".  Then it starts a
new block and outputs the title using mode="title.markup".
You can put spacing and other formatting properties on
the blocks, or in titlepage.templates.xml.

-- 

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

To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]