Page 1 of 1

Understanding keep rules

Posted: Thu Mar 08, 2018 4:30 am
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?

Re: Understanding keep rules

Posted: Wed Mar 14, 2018 1:27 pm
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