Keep Image With Step

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
thedantanner
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>
<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: 5749

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:

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/18.1/ug-editor/topics/dita_pdf_output_customization-x-predefined3.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
thedantanner
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="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

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 2 guests