DITA-OT with PDF with XEP indices

Here should go questions about transforming XML with XSLT and FOP.
SimonH
Posts: 19

DITA-OT with PDF with XEP indices

Mon Jan 23, 2017 6:08 pm

I've got an issue with the index ouput.

I have a topic which defines:

<indexterm>frequency plot</indexterm>

and another that defines:

<indexterm>frequency plot<indexterm>grouped</indexterm></indexterm>

The generated output is:

frequency plot 70–71, 97
grouped 97

Basically the grouped frequency plot page numbers are output for the parent index term too. I saw a method of omitting the page numbers from the parent term using <xsl:with-param name="no-page">true</xsl:with-param> in the index_xep.xsl. However, this excludes all references on the parent term. I just wanted to exclude the page number for the term that is a descendent (page 97).

Anyone have any ideas how to omit the page numbers for the nested term? I presume these are been built somewhere higher up the chain.
Radu
Posts: 5217

Re: DITA-OT with PDF with XEP indices

Tue Jan 24, 2017 9:44 am

Hi,

I created a small sample DITA project based on your suggestions, set the "clean.temp" parameter to "no" in the transformation scenario and published to PDF using XEP.
Then I opened the "topic.fo" file from the transformation temporary files folder.
I searched in it for the frequency plot: index term. At the end of the FO file where the index page is built, there is a reference like this:

Code: Select all

<fo:index-page-citation-list>
                          <fo:index-key-reference color="blue" font-style="italic"
                            page-number-treatment="link" ref-index-key="frequency plot:"/>
                        </fo:index-page-citation-list>


so the enumerated list of pages is built by XEP by looking in all places where the index key "frequency plot:" is defined.
In my original DITA topic I had an index term like this:

Code: Select all

<cmd>Remove the<indexterm>frequency plot<indexterm>grouped</indexterm></indexterm> old oil filter.</cmd>


which got converted in the topic.fo to something like this:

Code: Select all

<fo:block>Remove the<fo:inline index-key="frequency plot:"/><fo:inline
                      index-key="frequency plot:grouped:"/> old oil filter.</fo:block>


So an index key is defined for the "frequency plot:" even though it is generated from a parent index term.
In the XSLT stylesheet DITA-OT-DIR\plugins\org.dita.pdf2\xsl\fo\index.xsl there is a template which creates all these inline index-key definitions:

Code: Select all

  <xsl:template match="opentopic-index:index.entry">
      <xsl:for-each select="opentopic-index:refID[last()]">
          <fo:inline index-key="{@value}"/>
      </xsl:for-each>
      <xsl:apply-templates/>
  </xsl:template>


Maybe you could change that template to avoid generating key definitions for index entries which have child index entries, something like this:

Code: Select all

  <xsl:template match="opentopic-index:index.entry">
    <xsl:if test="not(opentopic-index:index.entry)">
      <xsl:for-each select="opentopic-index:refID[last()]">
        <fo:inline index-key="{@value}"/>
      </xsl:for-each>
    </xsl:if>
    <xsl:apply-templates/>
  </xsl:template>


By the way, this recent DITA OT 2.x fix adds proper indentation for the nested index term:

https://github.com/dita-ot/dita-ot/issues/1525

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

Re: DITA-OT with PDF with XEP indices

Tue Jan 24, 2017 2:15 pm

Thanks as ever. I will give it a try.

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 1 guest