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] Custom footers with chapter and section numbers (using FOP)

You need to customize the template that defines the content of markers with 
class name 'section.head.marker'. You can customize this template from 

<xsl:template name="section.heading">
  <xsl:param name="level" select="1"/>
  <xsl:param name="marker" select="1"/>
  <xsl:param name="title"/>
  <xsl:param name="marker.title"/>

  <fo:block xsl:use-attribute-sets="section.title.properties">
    <xsl:if test="$marker != 0">
      <fo:marker marker-class-name="section.head.marker">
        <xsl:copy-of select="$marker.title"/>

Instead of copying the $marker.title passed to it as the "marker.title" 
parameter, you can generate something else.  Using mode="title.markup" 
generates a title, and using mode="label.markup" generates a number label 
(for an element that has a number).  Since a section number includes the 
chapter number (usually), that should work for you.

      <fo:marker marker-class-name="section.head.marker">
        <xsl:apply-templates select=".." mode="label.markup"/>
        <xsl:text>. </xsl:text>
        <xsl:apply-templates select=".." mode="title.markup"/>

Note that the select attribute selects the parent element using "..", which 
is necessary since the context element for this template is title, but you 
want to apply templates to the section element itself.

Bob Stayton
Sagehill Enterprises
DocBook Consulting

----- Original Message ----- 
From: <doug@hcsw.org>
To: <docbook-apps@lists.oasis-open.org>
Cc: <fyodor@insecure.org>
Sent: Saturday, November 17, 2007 1:30 PM
Subject: [docbook-apps] Custom footers with chapter and section numbers 
(using FOP)

> Hello docbook-apps!
> I'm trying to customise the headers and footers
> of a docbook book. I am using Apache FOP 0.93. I
> have the footer looking almost perfect thanks
> especially to this very helpful page:
> http://www.sagehill.net/docbookxsl/PrintHeaders.html
> But there is one thing I just can't figure out how to
> do! In my style sheet I have this code to insert the
> section name into the footer:
> <!-- Section name: -->
> <fo:retrieve-marker retrieve-class-name="section.head.marker"
>                    retrieve-position="first-including-carryover"
>                    retrieve-boundary="page-sequence"/>
> But I would also like to include the chapter and section
> numbers so that instead of "section name" it contains
> "N.M. section name" where N is the chapter number and
> M is the section number. I am using <chapter> and <sect1>
> if that makes any difference.
> Any code to do this or even pointers to the right places
> in a manual (or example books that do this) would be very
> much appreciated!
> Thanks,
> Doug
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org

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