Keep Image With Step

Having trouble installing Oxygen? Got a bug to report? Post it all here.
thedantanner
Posts: 42
Joined: Thu Oct 27, 2016 11:13 pm

Keep Image With Step

Post by thedantanner »

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>
<stepxmp><fig><image>imagefileone.jpg</image></fig></stepxmp></step>
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.

-Dan
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Keep Image With Step

Post by Radu »

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:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT2.x\plugins\org.dita.pdf2\xsl\fo\task-elements.xsl

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:

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

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
thedantanner
Posts: 42
Joined: Thu Oct 27, 2016 11:13 pm

Re: Keep Image With Step

Post by thedantanner »

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="ol.li">
<xsl:attribute name="keep-together.within-page">always</xsl:attribute>
</xsl:attribute-set>

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

Cheers,
d
Post Reply