dita-community / org.dita-community.pdf-page-break

PDF Page Break Plugin for DITA Open Toolkit based on a blog post by Radu Coravu
Apache License 2.0
2 stars 0 forks source link

Insert page-break before a topic #1

Open qvrijt opened 5 years ago

qvrijt commented 5 years ago

Problem: I want some selected topics to start at a new page.

Solution: Extend the pageBreak.xsl with the following template:

<xsl:template match="*" mode="processTopic">
  <!-- CUSTOM start -->
  <xsl:for-each select="prolog/processing-instruction('pagebreak')">
    <xsl:message>Pagebreak before topic</xsl:message>
    <fo:block break-before="page"/>
  </xsl:for-each>
  <!-- CUSTOM end -->
  <xsl:next-match /><!-- hand-over to current template for processTopic -->
</xsl:template>

Now you can force a topic to start on a new page by inserting a pagebreak in the prolog section:

<prolog>
  <?pagebreak?>
</prolog?>

This has been tested to work with DITA-OT 3.2.

qvrijt commented 5 years ago

NOTE The following constructs can be 'abused' very well in DITA-OT 3.2 in tables:

<row>
  <entry><p>text before <?pagebreak?> and text after</p></entry>
</row>

And in lists:

<ul>
  <li><p>text before <?pagebreak?> and text after</p></li>
</ul>