Section Numbers for PDF

Here should go questions about transforming XML with XSLT and FOP.
cbgarcia
Posts: 10
Joined: Tue Apr 23, 2013 11:48 pm

Section Numbers for PDF

Post by cbgarcia »

Hi,

How can I add a leading section number in a PDF output of a bookmap? For example:
1 Heading 1
1.1 Heading 2
1.2 Heading 2
2 Heading 1
and so on.

Thank you.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Section Numbers for PDF

Post by Radu »

Hi,

Oxygen uses the DITA Open Toolkit to publish DITA content to various output formats like PDF.
By default when a bookmap is published to PDF, if you refer top-level topics using the <chapter> or <part> elements instead of <topicref>, the chapters will appear numbered both in the TOC and in the content.
If you want to do this for other topic references as well you will need to write a DITA OT PDF customization:

http://www.oxygenxml.com/doc/ug-oxygen/ ... ation.html

In the XSLT stylesheet:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins\org.dita.pdf2\xsl\fo\toc.xsl

there are templates like:

Code: Select all

<xsl:template match="*[contains(@class, ' bookmap/chapter ')] |
*[contains(@class, ' boookmap/bookmap ')]/opentopic:map/*[contains(@class, ' map/topicref ')]" mode="tocPrefix" priority="-1">
which are used to compute the TOC prefix number so you would probably need to provide additional templates matching your type of references.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Rushina
Posts: 8
Joined: Wed Nov 08, 2017 5:11 pm

Re: Section Numbers for PDF

Post by Rushina »

Hi,

In spite of turning on autolabel parameters for sections, the sections do not appear numbered either in ToC nor in bookmarks. Please help.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Section Numbers for PDF

Post by Radu »

Hi,

This particular forum thread is for generating PDF from DITA.
Those parameters "section.label.includes.component.label" that you are trying to set seem to be for DocBook. Are you generating PDF from DocBook content? If so, there is a "docbook-apps" users list on which you could register and ask:

https://docbook.org/help

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Rushina
Posts: 8
Joined: Wed Nov 08, 2017 5:11 pm

Re: Section Numbers for PDF

Post by Rushina »

Thank you, Radu. I found the answer where I had to change values in two files and just one which was causing the issue. Thank you, nevertheless.
Post Reply