Page 1 of 1

ToC hiding Chapter level pagenumber

Posted: Thu Jan 24, 2019 4:46 pm
by Quick van Rijt
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?

Re: ToC hiding Chapter level pagenumber

Posted: Mon Jan 28, 2019 2:51 pm
by Radu
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

Re: ToC hiding Chapter level pagenumber

Posted: Fri Feb 01, 2019 6:45 pm
by Quick van Rijt
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 :-)

Re: ToC hiding Chapter level pagenumber

Posted: Fri Feb 01, 2019 7:40 pm
by Quick van Rijt
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>