How to generate a page break

Post here questions and problems related to editing and publishing DITA content.
reinierk
Posts: 36
Joined: Tue Feb 21, 2012 8:22 pm
Location: Rotterdam, the Netherlands
Contact:

How to generate a page break

Post by reinierk »

I write a book with chapters containing DITA/concepts. At the end of the Chapter I present some examples using DITA/tasks. I would like to have a page break before the first task so it it appears on a new page.
How to achieve this?
I do not want to start a new chapter for the examples; they are part of the current chapter.
The ditamap looks like this:

Code: Select all

   <chapter href="Unit01-Overzicht-historie/U01-Title-page.dita">
<topicref href="Unit01-Overzicht-historie/u01-topics.dita"/>
<topicref href="Unit01-Overzicht-historie/uitputting-ipv4.dita"/>
<topicref href="Unit01-Overzicht-historie/historie-ipv6.dita"/>
<topicref href="Unit01-Overzicht-historie/eigenschappen-ipv6.dita"/>
<topicref href="Unit01-Overzicht-historie/Adresnotatie.dita"/>
<topicref href="Unit01-Overzicht-historie/Hierarchische-adressering.dita"/>
<topicref href="Unit01-Overzicht-historie/adrestypen.dita"/>
<topicref href="Unit01-Overzicht-historie/Adresbereiken.dita"/>
<topicref href="Unit01-Overzicht-historie/Adresinstelling.dita"/>
<topicref href="Unit01-Overzicht-historie/Pakket-formaat.dita"/>
<topicref href="Unit01-Overzicht-historie/Transitie-technieken.dita"/>
<topicref href="Unit01-Labs/unit01-Labs.dita">
<topicref href="Unit01-Labs/ipv6-adressen-windows.dita"/>
The break should occur just before "Unit01-Labs/unit01-Labs.dita"
Kind Regards,
Reinier Kleipool,
Course Materials editor,
Open Source Academy
http://www.OpenSourceAcademy.eu
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to generate a page break

Post by Radu »

Hi,

Oxygen uses the DITA Open Toolkit to publish DITA content to various output sources.

If you look in this XSL:

OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/xsl/fo/commons.xsl

there is an XSL template:

<xsl:template match="*[contains(@class, ' topic/topic ')]">

which at some stage contains a choose:

Code: Select all


 <xsl:when test="not(ancestor::*[contains(@class,' topic/topic ')])">
..............
</xsl:when>
<xsl:otherwise>.......
This choose statement creates a separate "<fo:flow flow-name="xsl-region-body">" for topics which are on the first level but does not create such a flow for topics which are on the second/third... levels.

In the "xsl:otherwise" you could prepend this code:

Code: Select all


  <xsl:if test="contains(@outputclass, 'LINE_BREAK')">
<fo:block page-break-before="always"/>
</xsl:if>
Then on the topic on which you want to force the line break you could set an attribute like:

<task id="taskId" outputclass="LINE_BREAK">....

There could be other possibilities to tackle this problem, this is what I thought of.

You can also try to ask this question on the DITA Users List:
http://tech.groups.yahoo.com/group/dita-users/
Maybe they have better approaches.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
reinierk
Posts: 36
Joined: Tue Feb 21, 2012 8:22 pm
Location: Rotterdam, the Netherlands
Contact:

Re: How to generate a page break

Post by reinierk »

I solved it by modifing the

Code: Select all

<xsl:template match="*" mode="processTopicTitle">
This works on the presumption that if a topic is that important to appear on a separate page, it has a title element. If the outputclass attribute contains the string "osa/page-break" on such a title, the following stylesheet modification will add an page-break-before="always" attribute to the output fo:block element.

Change:

Code: Select all


<xsl:template match="*" mode="processTopicTitle">
.
.
.
<fo:block>
<xsl:call-template name="processAttrSetReflection">
<xsl:with-param name="attrSet" select="$attrSet2"/>
<xsl:with-param name="path" select="'../../cfg/fo/attrs/commons-attr.xsl'"/>
</xsl:call-template>
<!-- start extra lines -->
<xsl:if test="contains(@outputclass,'osa/page-break')">
<xsl:attribute name="page-break-before">always</xsl:attribute>
</xsl:if>
<!-- end extra lines -->
<xsl:if test="$level = 1">
<fo:marker marker-class-name="current-header">
<xsl:call-template name="getTitle"/>
</fo:marker>
</xsl:if>
.
.
.
Kind Regards,
Reinier Kleipool,
Course Materials editor,
Open Source Academy
http://www.OpenSourceAcademy.eu
Post Reply