Keep Image With Step

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
Posts: 38

Keep Image With Step

Tue Mar 14, 2017 6:42 pm

I've seen several similar posts about this, and I've tried several of the recommendations. Nothing has worked thus far. Here's my issue...

I'm authoring task DITA files with steps and images with each step. If an image gets forced to a new page, the step associated with the image won't follow with it. This makes for very confusing documents. I'd appreciate any input about how I could improve the code, or apply an attribute that will make the images stick with their step.

Here's a sample of how I'm currently coding these steps:

Code: Select all

<step><cmd>1. Do the thing to the thing.</cmd>

I've also tried to force it by putting the image into the <cmd> element:

Code: Select all

<step><cmd>1. do the thing to the thing.<image>imagename.jpg</image></cmd></step>

Any advice or best practices would be much appreciated.

Posts: 5930

Re: Keep Image With Step

Thu Mar 16, 2017 12:57 pm

Hi Dan,

Sorry for the delay.
For PDF customization specific questions you can also register and write on the Yahoo Groups DITA Users List. We are also registered there and it's an active community, probably there are already DITA users who made this customization on their side.
In the XSLT stylesheet:


there is an XSLT template which matches the step and creates an XSL-FO list item:

Code: Select all

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

maybe you can try overriding that XSLT template in your PDF customization and set an attribute like keep-together.within-page="always" on the produced fo:list-item element.
More about PDF customizations:

Radu Coravu
<oXygen/> XML Editor
Posts: 38

Re: Keep Image With Step

Fri Mar 24, 2017 6:08 pm

Thanks for the advice. Your input, combined with other things I found in the past, resulted in success. I edited this file:

C:\Program Files\Oxygen XML Editor 18\frameworks\dita\DITA-OT2.x\plugins\org.dita.pdf2\cfg\fo\attrs\task-elements-attr.xsl

With this code for the <step> element:

<xsl:attribute-set name="steps.step" use-attribute-sets="">
<xsl:attribute name="keep-together.within-page">always</xsl:attribute>

Once I saw that this was successful, I did the same in the commons-attr.xsl file to <p> paragraph element.


Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 3 guests