Page 1 of 1

Controlling Page Breaks Before/After for Part/Chapter

Posted: Thu Jul 12, 2018 12:23 am
by paulkhillier
Hello Oxygen Team and Users,

I am struggling to figure out how to implement the following fir the DITA MAP PDF - Based on DITA and CSS (WYSIWYG) transform:

• Part has page break before, but not after (keep with next chapter title)
• Chapter has no page break before

I tried coding the following (among many other solutions) to override the default configuration for part/chapter, with no luck:

Code: Select all

*[class~="topic/topic"] > *[class~="topic/title"] {
page-break-after: avoid;
}

*[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"] {
page-break-before: avoid;
}
I unfortunately cannot post hosted images from my workplace, but here's what I'm getting vs. the desired result:

Desired

Part Title (page break before)
Chapter Title (no page break following part title)
Mapref Title (no page break following chapter title)

Actual

Part Title (page break before and after)
Chapter Title (page break before)
Mapref Title (no page break following chapter title)

I've been reviewing https://www.oxygenxml.com/doc/versions/ ... aking.html and trying different solutions with no luck. Can you suggest how to achieve this page flow?

Regards,

Paul Hillier

Re: Controlling Page Breaks Before/After for Part/Chapter

Posted: Thu Jul 12, 2018 11:43 am
by Radu
Hi Paul,

I think you should start by trying to see the actual merged XML document on which your CSS changes are applied:

https://www.oxygenxml.com/doc/versions/ ... e_css.html

because this will give you a better idea about what to match.

All out default page break policies are defined in this CSS file: OXYGEN_INSTALL_DIR\frameworks\dita\css\print\p-page-breaks.css
As you see we also look for a certain @outputclass attribute value which could be set on certain DITA topic root elements or even on topicrefs.

Regards,
Radu

Re: Controlling Page Breaks Before/After for Part/Chapter

Posted: Thu Jul 12, 2018 10:02 pm
by paulkhillier
Hi Radu,

Thanks for pointing me to the merged.xml... would you believe I've gotten through 80% of the templating without referring to this? :oops:

Here is a snippet of the XML that I am trying to control page breaks for:

Code: Select all

<part xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot" is-chapter="true" is-part="true" class="- map/topicref bookmap/part " format="dita" navtitle="Enhancements" rev="23 January 2018" scope="local" type="confidential"><topicmeta class="- map/topicmeta "><navtitle class="- topic/navtitle " href="#d7e66">Enhancements</navtitle></topicmeta><chapter is-chapter="true" class="- map/topicref bookmap/chapter " format="dita" href="#d7e67" rev="23 January 2018" scope="local" type="confidential"><topicmeta class="- map/topicmeta "><navtitle href="#d7e67" class="- topic/navtitle ">DSC Calculations/Percent Free/Inventory</navtitle></topicmeta><topicref class="- map/topicref " format="dita" href="#unique_3" navtitle="Ten Percent Free Calculation Adjustment" rev="23 January 2018" scope="local" type="concept"><topicmeta class="- map/topicmeta " data-topic-id="PETXXXXXX_BenefitBackground"><resourceid appid="PETXXXXXX_BenefitBackground" class="- topic/resourceid " oxy-source="topic"/><navtitle href="#unique_3" class="- topic/navtitle ">Ten Percent Free Calculation Adjustment</navtitle></topicmeta><
Based on this structure, I would expect the following to work, but it does not:

Code: Select all

*[class~="map/topicref"] *[class~="bookmap/part"] {
page-break-after: avoid;

}

*[class~="map/topicref"] *[class~="bookmap/chapter"] {
page-break-before: avoid;

}
Also tried this:

Code: Select all

*[class~="map/topicref"] *[class~="bookmap/part"] {
page-break-after: avoid;

}

*[class~="map/topicref"] *[class~="bookmap/chapter"][navtitle] {
page-break-before: avoid;

}

What am I missing? Please assist Oxygen wizards!

Regards,

Paul Hillier

Re: Controlling Page Breaks Before/After for Part/Chapter

Posted: Fri Jul 13, 2018 10:34 am
by Radu
Hi Paul,

If you look in this CSS OXYGEN_INSTALL_DIR/frameworks/dita/css/print/p-chapters.css

it defines a new page sequence for each chapter:

Code: Select all

*[class ~= "topic/topic"][is-chapter] {
/* Each chapter starts a new page sequence, so the :first selector applies to each of them. */
-oxy-page-group:start;
page: chapter;
}
you could probably define in your custom.css the page sequence on each part and avoid having the chapter break the sequence:

Code: Select all

*[class ~= "topic/topic"][is-chapter] {
-oxy-page-group:auto;
page: auto;
}

*[class ~= "topic/topic"][is-part] {
-oxy-page-group:start;
page: chapter;
}
Regards,
Radu

Re: Controlling Page Breaks Before/After for Part/Chapter

Posted: Fri Jul 13, 2018 4:24 pm
by paulkhillier
Thank you Radu, that has the intended result.

With regards,

Paul Hillier