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: pagenumbers in TOC


Gert,

This is a docbook-apps question.

I had problems with this myself. In the stylesheets, the id for components 
(chapters/appendix) are associated with a page-sequence. FOP don't like 
bookmars in other places, than in blocks. Ths can be don in the 
stylesheets, but it is much easier to post-process the fo result sheet. 
The enclosed sheet is can be use in saxon, but it is also working in 
Xalan.

Regards

Jens


-------------------------
 fo-post-for-fop.xsl
------------------------- 

<?xml version="1.0"?>

<!--

This stylesheet is created for post-processing of FO result-trees intended for 
delivery to FOP 0.20.4. This should temporary solve problems caused by wrong 
or unimplemented features in FOP.

When using Saxon, this stylesheet can be automatically processed by adding the 
attribute saxon:next-in-chain to the xsl:output element of your own 
stylesheet.

E.g.

  <xsl:output method="xml" indent="no"  
              saxon:next-in-chain="fo-post-for-fop.xsl"/>
              
N.B. Remember to attach the namespace declaration 
xmlns:saxon="http://icl.com/saxon"; to your stylesheet element

Copyright (c) 2002, Jens Stavnstrup/DDRE <js@ddre.dk>

-->



<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:fo="http://www.w3.org/1999/XSL/Format";
                xmlns:fox="http://xml.apache.org/fop/entensions";
                xmlns:saxon="http://icl.com/saxon";
                version='1.0'
                exclude-result-prefixes="xsl saxon">


<!-- Copy everything -->

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*"/>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

<!-- ....................................................................

     Problem:  When generating page-numberes. FOP does not consider id's  
               defined in fo:page-sequences, but expect these to be in 
               fo:blocks. This disables pagenumber generation for Components 
               (Chapters/Appendix), Index, Preface, Bibliography and 
               Titlepage.

     Solution: Enclose children of page-sequence in a fo:block and set the 
               attribute id to the value of the page-sequence.
               
               Also remove the page-sequence id, to avoid duplicate ID errors. (Actually done in above template)

     N.B. A better match would be against the pattern
     
         fo:static-content[@flow-name='xsl-region-before-first']
     
     but this assumes, you have define this region for all your 
     page-sequence-masters
     .................................................................... -->


<xsl:template match="fo:flow[@flow-name='xsl-region-body']">
<!--
<xsl:template match="fo:static-content[@flow-name = 
                           'xsl-region-before-first']">
-->
  <xsl:copy>
    <xsl:apply-templates select="@*"/>
    <xsl:if test="ancestor::fo:page-sequence/@id">
      <fo:block id="{ancestor::fo:page-sequence/@id}"/>
    </xsl:if>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>


<!-- Put your own templates here -->


</xsl:stylesheet>


-------------------------

On Thu, 22 Aug 2002, Gert Bultman (Xi) wrote:

> Hi All,
> 
> I'm sure this is a very easy question, probably a FAQ, but I can't figure out the answer by myself. 
> 
> My standard docbook stylesheets do no generate pagenumbers for 'Chapters' in the TOC. Sections do have pagenumbers after the dots/leaders.
> 
> 1 Chapter One .....................................
>   1.1 Section One ................................ 1
>   1.2 Section Two ................................ 2
> 1 Chapter Two ......................................
> 
> What parameter do I set/change to get pagenumbers after the Chapter lines as well?
> 
> Thanks for any and all help. 
> Gert Bultman
> Xi
> 
> 

Regards,

Jens

------------------------------------------------------------------------
Jens Stavnstrup                            Phone :
Danish Defence Research Establishment         Voice : + 45 - 39 15 17 97
Ryvangs Alle 1 - P.O. Box 2715                Fax   : + 45 - 39 29 15 33
DK - 2100 Copenhagen O.                    E-Mail (Internet) :
Denmark                                       js@ddre.dk
------------------------------------------------------------------------





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