ToC hiding Chapter level pagenumber

Here should go questions about transforming XML with XSLT and FOP.
Quick van Rijt
Posts: 9
Joined: Tue Aug 23, 2016 6:18 pm

ToC hiding Chapter level pagenumber

Post by Quick van Rijt » Thu Jan 24, 2019 4:46 pm

When rendering with DITA 3.2.1 to PDF by FOP using customization plugin, my generated topic.fo has TOC entries, all ending on

Code: Select all

<fo:basic-link ...>
...
<fo:inline xsl:use-attribute-sets="__toc__page-number">
<fo:leader xsl:use-attribute-sets="__toc__leader"/>
<fo:page-number-citation>
<xsl:attribute name="ref-id">
<xsl:call-template name="generate-toc-id"/>
</xsl:attribute>
</fo:page-number-citation>
</fo:inline>
</fo:basic-link>


In the resulting PDF, all lower level topics are shown as expected. But Chapter and Appendix level topics show leader-dots without a pagenumber.

I have modified __toc__page-number with @border="1px solid orange" to highlight the block, but nothing apparently off-page.
I have search all org.dita.pdf2 and org.dita.pdf2.fop folders.

Where to look to fix this?
Regards
Quick van Rijt
Professional user of Oxygen XML and DITA OT

Radu
Posts: 6328
Joined: Fri Jul 09, 2004 5:18 pm

Re: ToC hiding Chapter level pagenumber

Post by Radu » Mon Jan 28, 2019 2:51 pm

Hi Quick,

Honestly I'm quite rusty when it comes to XSL-FO based PDF customization.
If you add an <xsl:message> with a <xsl:copy-of select="."/> in that particular code is it called also for Chapter and Appendix.
If it is called, what value does the call " <xsl:call-template name="generate-toc-id"/>" return?
If set the "clean.temp=no" parameter and after the transformation you look in the temporary folder at the "*_Merged.xml" file, does that "ref-id" attribute set for a Chapter properly refer to the chapter ID?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Quick van Rijt
Posts: 9
Joined: Tue Aug 23, 2016 6:18 pm

Re: ToC hiding Chapter level pagenumber

Post by Quick van Rijt » Fri Feb 01, 2019 6:45 pm

My ToC entries for Chapters/Appendices do have OPENTOPIC id's for fo:basic-link/@internal-destination.
I then suspected the fo:page-number-citation/@ref-id to fail (even if it has the same OPENTOPIC value)

I discovered in topic.fo that the Chapters/Appendix level topics do not get assigned an early @id (in fo:block or fo:wrapper).
I am not touching that area in my plugin.

@id is assigned in processing template dita-ot-3.2.1/org.dita.pdf2/xsl/fo/topic.xsl:69: [Codebox=]<xsl:template match="*" mode="processTopicTitle">[/Codebox]
Which in turn is called by template [Codebox=]<xsl:template match="*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/title ')]">[/Codebox]
AND that last template especially ignores Chapter or Appendix processing!! (But how can the core PDF2 transformation be successful then?) I am not done yet :-)
Regards
Quick van Rijt
Professional user of Oxygen XML and DITA OT

Quick van Rijt
Posts: 9
Joined: Tue Aug 23, 2016 6:18 pm

Re: ToC hiding Chapter level pagenumber

Post by Quick van Rijt » Fri Feb 01, 2019 7:40 pm

Solved it.
To remove the default fancy chapter heading, I used an empty insertChapterFirstpageStaticContent template.
The DITA-OT uses it also to set the chapter's @id for table of content reference.

The solution is adding an empty block ($myplugin/cfg/fo/xsl/commons.xsl):

Code: Select all


    <xsl:template match="*" mode="insertChapterFirstpageStaticContent">
<xsl:param name="type" as="xs:string"/>

<fo:block>
<xsl:attribute name="id">
<xsl:call-template name="generate-toc-id"/>
</xsl:attribute>

<xsl:comment> commons.xsl/insertChapterFirstpageStaticContent: fancy chapter start removed</xsl:comment>
</fo:block>
</xsl:template>
Regards
Quick van Rijt
Professional user of Oxygen XML and DITA OT

Post Reply