n3v3r8g81n
n3v3r8g81n

Reputation: 1

How to keep my topics printing consecutively, without an empty page after each topic

DITA 3.6
Oxygen XML Editor 23.1

The "DITA for Print" book nor any other source, so far, has helped me produce a pdf where the topics are consecutive rather than having a blank page after them. To each topicref in the ditamap, I added outputclass="page-break-avoid". To each topic element in each file, I added outputclass="page-break-avoid".

Should I add something in an xsl file? Can you point me to the answer?

Upvotes: 0

Views: 401

Answers (1)

Toshihiko Makita
Toshihiko Makita

Reputation: 1304

The blank page is generated from the definition fo:page-sequence/@force-page-number property.

To change not to generate blank-page, you can override org.dita.pdf2/cfg/fo/attrs/commons-attr.xsl.

    <xsl:attribute-set name="__force__page__count">
        <xsl:attribute name="force-page-count">
            <xsl:choose>
                <xsl:when test="/*[contains(@class, ' bookmap/bookmap ')]">
                    <xsl:value-of select="'even'"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="'auto'"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:attribute>
    </xsl:attribute-set>

Change the value even to auto will satisfy your needs.

Steps to customize

I'm not familiar with PDF2 plug-in. So this may not the standard way. But I could customize it by following steps.

  1. Make customization XSL file

[DITA-OT]/plugins/org.dita.pdf2/Customization/fo/attrs/commons-attr.xsl

<?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:rx="http://www.renderx.com/XSL/Extensions"
    version="2.0">

    <xsl:attribute-set name="__force__page__count">
        <xsl:attribute name="force-page-count">
            <xsl:choose>
                <xsl:when test="/*[contains(@class, ' bookmap/bookmap ')]">
                    <xsl:value-of select="'auto'"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="'auto'"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:attribute>
    </xsl:attribute-set>

</xsl:stylesheet>

  1. Include it into [DITA-OT]/plugins/org.dita.pdf2/Customization/fo/attrs/custom.xsl
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    version="2.0">
    <xsl:include href="commons-attr.xsl"/>
</xsl:stylesheet>
  1. Customize [DITA-OT]/plugins/org.dita.pdf2/Customization/catalog.xml
<?xml version="1.0" encoding="utf-8"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
  <!-- Custom attributes entry -->
  <uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl"/>
</catalog>
  1. Specify customization.dir property with [DITA-OT]\plugins\org.dita.pdf2\Customization in Oxygen transformation scenario.

Oxygen transformation scenario

  1. Apply transformation scenario from Oxygen.

  2. I've got the following temp/topic.fo. The fo:page-sequence/@force-page-count became auto and in the result PDF, the redundant blank pages are removed.

temp/topic.fo comparison

Upvotes: 0

Related Questions