Hi,
I assume that you want to change the bookmarks' structure for the DITA-OT PDF output.
DITA Open Toolkit PDF output can be customized in several ways:
* creating a DITA Open Toolkit plugin which adds extensions to the PDF plugin.
* creating a customization directory and using it from the PDF transformation scenario.
You can find more details in our user manual:
https://www.oxygenxml.com/doc/versions/ ... ation.html
For your request, you can follow the next procedure. This customization is based on the 'Custom directory' method. I've tested with DITA-OT 1.8.5.
* Copy the entire directory: DITA_OT_DIR\plugins\org.dita.pdf2\Customization to another location (for instance, C:\Customization).
* Rename C:\Customization\catalog.xml.orig to: C:\Customization\catalog.xml.
* Open the catalog.xml in Oxygen XML Editor and uncomment this line:
Code: Select all
<uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl"/>
* Rename C:\Customization\fo\xsl\custom.xsl.orig to: C:\Customization\fo\xsl\custom.xsl
* Modify the custom.xsl file by adding an import to bookmarks.xsl
Code: Select all
<xsl:import href="bookmarks.xsl"/>
* Create the bookmarks.xsl with the follow content:
Code: Select all
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:exsl="http://exslt.org/common"
xmlns:opentopic="http://www.idiominc.com/opentopic"
xmlns:opentopic-index="http://www.idiominc.com/opentopic/index"
xmlns:exslf="http://exslt.org/functions"
xmlns:opentopic-func="http://www.idiominc.com/opentopic/exsl/function"
xmlns:ot-placeholder="http://suite-sol.com/namespaces/ot-placeholder"
extension-element-prefixes="exsl"
exclude-result-prefixes="opentopic-index opentopic exslf opentopic-func ot-placeholder"
version="2.0">
<xsl:template name="createBookmarks">
<xsl:variable name="bookmarks" as="element()*">
<xsl:choose>
<xsl:when test="$retain-bookmap-order">
<xsl:apply-templates select="/" mode="bookmark"/>
</xsl:when>
<xsl:otherwise>
<!--
start patch
Generate the 'fo:bookmark' for the book title
-->
<fo:bookmark>
<xsl:attribute name="internal-destination">
<xsl:call-template name="generate-toc-id"/>
</xsl:attribute>
<xsl:variable name="bookmapTitle" select="//*[contains(@class, 'bookmap/mainbooktitle')]"/>
<fo:bookmark-title>
<xsl:value-of select="normalize-space($bookmapTitle)"/>
</fo:bookmark-title>
<!--
end patch
-->
<xsl:for-each select="/*/*[contains(@class, ' topic/topic ')]">
<xsl:variable name="topicType">
<xsl:call-template name="determineTopicType"/>
</xsl:variable>
<xsl:if test="$topicType = 'topicNotices'">
<xsl:apply-templates select="." mode="bookmark"/>
</xsl:if>
</xsl:for-each>
<xsl:choose>
<xsl:when test="($ditaVersion >= 1.1) and $map//*[contains(@class,' bookmap/toc ')][@href]"/>
<xsl:when test="($ditaVersion >= 1.1) and ($map//*[contains(@class,' bookmap/toc ')]
or /*[contains(@class,' map/map ')][not(contains(@class,' bookmap/bookmap '))])">
<fo:bookmark internal-destination="{$id.toc}">
<fo:bookmark-title>
<xsl:call-template name="insertVariable">
<xsl:with-param name="theVariableID" select="'Table of Contents'"/>
</xsl:call-template>
</fo:bookmark-title>
</fo:bookmark>
</xsl:when>
<xsl:when test="$ditaVersion >= 1.1"/>
<xsl:otherwise>
<fo:bookmark internal-destination="{$id.toc}">
<fo:bookmark-title>
<xsl:call-template name="insertVariable">
<xsl:with-param name="theVariableID" select="'Table of Contents'"/>
</xsl:call-template>
</fo:bookmark-title>
</fo:bookmark>
</xsl:otherwise>
</xsl:choose>
<xsl:for-each select="/*/*[contains(@class, ' topic/topic ')] |
/*/ot-placeholder:glossarylist |
/*/ot-placeholder:tablelist |
/*/ot-placeholder:figurelist">
<xsl:variable name="topicType">
<xsl:call-template name="determineTopicType"/>
</xsl:variable>
<xsl:if test="not($topicType = 'topicNotices')">
<xsl:apply-templates select="." mode="bookmark"/>
</xsl:if>
</xsl:for-each>
<xsl:if test="//opentopic-index:index.groups//opentopic-index:index.entry">
<xsl:choose>
<xsl:when test="($ditaVersion >= 1.1) and $map//*[contains(@class,' bookmap/indexlist ')][@href]"/>
<xsl:when test="($ditaVersion >= 1.1) and ($map//*[contains(@class,' bookmap/indexlist ')]
or /*[contains(@class,' map/map ')][not(contains(@class,' bookmap/bookmap '))])">
<fo:bookmark internal-destination="{$id.index}">
<fo:bookmark-title>
<xsl:call-template name="insertVariable">
<xsl:with-param name="theVariableID" select="'Index'"/>
</xsl:call-template>
</fo:bookmark-title>
</fo:bookmark>
</xsl:when>
<xsl:when test="$ditaVersion >= 1.1"/>
<xsl:otherwise>
<fo:bookmark internal-destination="{$id.index}">
<fo:bookmark-title>
<xsl:call-template name="insertVariable">
<xsl:with-param name="theVariableID" select="'Index'"/>
</xsl:call-template>
</fo:bookmark-title>
</fo:bookmark>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</fo:bookmark>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="exists($bookmarks)">
<fo:bookmark-tree>
<xsl:copy-of select="$bookmarks"/>
</fo:bookmark-tree>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
The template was copied from:
DITA-OT/plugins/org.dita.pdf2/xsl/fo/bookmarks.xsl.
The modifications are marked with
start patch and
end patch comments.