Weird TOC indentation in PDF document?

Here should go questions about transforming XML with XSLT and FOP.
floubi
Posts: 10
Joined: Sun Sep 25, 2005 8:09 pm

Weird TOC indentation in PDF document?

Post by floubi » Thu Oct 06, 2005 11:05 pm

Hello,

The Oxygen Docbook indentation for the table of contents in PDF documents seems to be wrong:

chapter
sect1
sect2
sect2
sect1
sect2
sect2
chapter
sect1
...

So basically the chapters are indented and the sections are flat... I was expecting:
chapter
sect1
sect2
sect2
sect1
sect2
sect2
chapter
sect1
....

as explained in http://www.sagehill.net/docbookxsl/index.html

I have managed to configure other things such as font size of titles by making a customization layer etc. What could be the problem?

Stephanie

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache » Fri Oct 07, 2005 2:05 pm

Hello,

Set the generate.toc parameter in your customization layer. For example:

Code: Select all

<xsl:param name="generate.toc">
appendix title
article toc,title
book toc,title
chapter title
part title
sect1 title
sect2 title
sect3 title
sect4 title
</xsl:param>
Regards,
Sorin

floubi
Posts: 10
Joined: Sun Sep 25, 2005 8:09 pm

Post by floubi » Fri Oct 07, 2005 4:08 pm

Hi sorin, I have tried your suggestion but it doesn't seem to have made any difference to the indentation. Just to clarify, I am talking about the main TOC for the whole book.

According to Bob Stayton - http://www.sagehill.net/docbookxsl/Prin ... TocEntries :

"These templates are located in the fo/autotoc.xsl stylesheet file. They are not good candidates for customization because they are pretty complex. The complexity comes from the recursive nature of processing all the elements in the document in the toc mode. Each mode="toc" template generates the entry for its element, and then checks to see if the element has children that should appear in the TOC. If so, then it increments the indent by the amount of the parameter toc.indent.width and applies templates in toc mode to process the children."

Why is the indentation not working as described above?

Steph

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache » Fri Oct 07, 2005 4:31 pm

Hi,
floubi wrote:I have tried your suggestion but it doesn't seem to have made any difference to the indentation.
Create a simple book document using the template DocBook 4.4 Book from the list displayed by File -> New from Templates, add some sect2 and para elements and add the generate.toc parameter in a customization layer. Apply the customization layer and the indentation should be right in the PDF. If indentation is not right specify your platform, <oXygen/> version, JVM version and post a sample of your customization layer.
floubi wrote:Just to clarify, I am talking about the main TOC for the whole book.
I talk about the same TOC. In the value of generate.toc I used the toc item for book elements:

Code: Select all

book      toc,title
Regards,
Sorin

floubi
Posts: 10
Joined: Sun Sep 25, 2005 8:09 pm

Post by floubi » Fri Oct 07, 2005 8:06 pm

Hi again,

OK, I have followed your insrructions, generated the PDF first without a customisation layer, using the out-of-the-box DocBook PDF transformation scenario. I get

I. First part
1. Chapter Title
Section1 Title
test sect2

So basically the first part is indented, everything else is flat.

I then added the following very simple customisation layer:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:import
href="file:/C:/Program%20Files/Oxygen%206.2/frameworks/docbook/xsl/fo/docbook.
xsl"/>
<xsl:param name="generate.toc">
appendix title
article toc,title
book toc,title
chapter title
part title
sect1 title
sect2 title
sect3 title
sect4 title
</xsl:param>
</xsl:stylesheet>
and got exactly the same thing.

With 2 parts I get:
I. First part
1. Chapter Title
Section1 Title
test sect2
2. Second part
1. Chapter Title
Section1 Title
test sect2

Which seems to mean that only the top level is ever indented.

I am trialing the latest version of Oxygen (version 6.2 build 2005091711). Platform is Windows XP, JVM version is 1.4.2_03.

Thanks
Steph

floubi
Posts: 10
Joined: Sun Sep 25, 2005 8:09 pm

Post by floubi » Fri Oct 07, 2005 8:09 pm

Sorry re-reading my message I just saw that the indentation doesn't display in the message!

I meant

Code: Select all


With 2 parts I get: 
I. First part
1. Chapter Title
Section1 Title
test sect2
2. Second part
1. Chapter Title
Section1 Title
test sect2

Post Reply