Understanding keep rules

Post here questions and problems related to editing and publishing DITA content.
mdslup
Posts: 167
Joined: Tue Mar 06, 2018 1:34 am

Understanding keep rules

Post by mdslup »

I am having some trouble understanding how to keep certain things together when generating a PDF. For example, in my document, the "Hardware Installation" is the fourth topic in my map. It starts out like this:

Code: Select all

 <taskbody>
<prereq id="prereq_k3t_gvb_cdb">
<note type="warning"><b>These instructions should only be used by:</b><ul
id="ul_q34_jxb_cdb">
<li>Customers who are installing the product near an outlet</li>
<li>Professional electricians who are installing the product to a hardwired
electrical connection</li>
</ul></note>
</prereq>
However, in my PDF output, it displays as:

Hardware Installation
Warning: These instructions should only be used by:
--- Page Break ---
* Customers who are installing the product near an outlet
* Professional electricians who are installing the product to a hardwired electrical connection

How can I modify my custom dita plugin files to make these stay together?
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Understanding keep rules

Post by Radu »

Hi,

The default XSL template which matches <b> is located in OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT2.x\plugins\org.dita.pdf2\xsl\fo\hi-domain.xsl and looks like this:

Code: Select all

    <xsl:template match="*[contains(@class,' hi-d/b ')]">
<fo:inline xsl:use-attribute-sets="b">
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
maybe in your PDF customization stylesheets you could override it like this:

Code: Select all

    <xsl:template match="*[contains(@class,' topic/note ')]/*[contains(@class,' hi-d/b ')][count(preceding-sibling::*) = 0]">
<fo:inline xsl:use-attribute-sets="b" keep-with-next="always">
<xsl:call-template name="commonattributes"/>
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply