This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: FOP bookmarks vs PassiveTex bookmarks
- From: Jens Stavnstrup <js at ddre dot dk>
- To: Tilly Bayard-Richard <Tilly dot Bayard-Richard at Jaluna dot COM>
- Cc: docbook-apps at lists dot oasis-open dot org
- Date: Mon, 20 Jan 2003 11:27:17 +0100 (CET)
- Subject: Re: DOCBOOK-APPS: FOP bookmarks vs PassiveTex bookmarks
- Reply-to: Jens Stavnstrup <js at ddre dot dk>
Tilly,
Your problem is caused by the fact, that FOP does accept page-id from
page-sequences, which Norm generate (This is obvious a FOP bug). You could
modify Norm's styleshets, but in my experience most FOP bugs can much
easier be solved by postprocessing the XSL-FO code. I don't know, how this
is done in xsltproc, but I am sure it can be done.
Enclosed is part of my stylesheet, which fixes this:
Regards
Jens
<?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
If you are using Xalan, you can use the Xalan pipeDocument extension. See also
http://xml.apache.org/xalan2/docs/extensionslib.html
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">
<!-- Default template use to copy everything -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!-- ....................................................................
Problem: Since DocBook 1.53.0 Norm uses the basic conformance level
property "initial-page-number" to force components to break on
odd-pages instead of the previously used extended conformance
level property "force-page-count".
Solution: Use the extended property force-page-count
.................................................................... -->
<xsl:template match="fo:page-sequence[@initial-page-number]">
<xsl:copy>
<xsl:if test="@initial-page-number != 'auto-odd'">
<xsl:apply-templates select="@initial-page-number"/>
</xsl:if>
<xsl:apply-templates
select="@*[name() != 'initial-page-number' and name() != 'id']"/>
<xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
<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. This will also create correct PDF bookmarks for
chapters and appendixes.
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 Mon, 20 Jan 2003, Tilly Bayard-Richard wrote:
> Bonjour,
>
> I am using docbook-xsl-1.59.1, xsltproc, FOP 0.20.4.
>
> I am starting to look at FOP to produce PDF to avoid the PassiveTex limitations
> with tables.
>
> I am quite pleased with the results (for tables), but very surprised to see that
> the bookmarks I get with FOP do not behave the same (for the same book) than
> PassiveTex bookmarks.
>
> I have a test book which produces the following bookmarks in the acroread
> bookmarks window:
>
> My Test Book
> Chapter 1. Chapter One
> 1.1 Section One in Chapter One
> Chapter 2. Chapter Two
> 2.1 Section One in Chapter Two
> 2.2 Section Two in Chapter Two
>
> With PassiveTex:
>
> First, I clik on the bookmark [2.2] and the page containing section 2.2
> pops up in the main acroread window.
> Then I click back on [My Test Book], and the book title page comes up.
> This is the expected behaviour (for me). I am able to navigate the book
> structure in the acroread bookmarks window.
>
> With FOP:
>
> When I clik on the bookmark [2.2], the page containing section 2.2 pops
> up in the main acroread window.
> Then I click on [My Test Book], and... nothing happens!
> Nothing also if I click on [Chapter 1].
> Cliking on bookmarks [1.1] and [1.2] produce the expected result.
>
> The problem seems to be that the book level and chapter level bookmarks
> are "dead". Only the section level (and below) bookmarks are "alive".
>
> I hope (but I am not sure) that my problem description is clear...
>
> I am willing to follow the "DocBook Mailing List Guidelines", therefore there is
> no PDF files attached to this mail. Unfortunately, I do not have a public web
> site or ftp site at hand to provide urls. Sorry.
>
> Merci,
>
> Tilly
>
> --------------------
> Tilly Bayard-Richard Jaluna
> Tel: +33 (0)1 39 44 74 65 6 avenue Gustave Eiffel
> Fax: +33 (0)1 30 57 00 66 F-78180 MONTIGNY LE BX
> France
> email: tilly.bayard-richard@jaluna.com
> web: www.jaluna.com
>
>
>