Keep a table on the same page

Having trouble installing Oxygen? Got a bug to report? Post it all here.
BogdanM777
Posts: 68
Joined: Tue Jun 09, 2015 6:26 pm
Location: Canada

Keep a table on the same page

Post by BogdanM777 »

Hi guys,

I would have another question for you:
How could I keep a table "whole" on a page, i.e. not to have it split over 2 pages, if its size permits of course?

Thank you
radu_pisoi
Posts: 403
Joined: Thu Aug 21, 2003 11:36 am
Location: Craiova
Contact:

Re: Keep a table on the same page

Post by radu_pisoi »

Hi,

I assume that you are talking about the DITA PDF customization.

In this case, a solution is to set the keep-together.within-page XSL-FO property for DITA tables.

This can be done by extending the attribute-set for the table element and add the keep-together.within-page attribute. The attribute set for the table is defined in DITA-OT/plugins/org.dita.pdf2/cfg/fo/attrs/tables-attr.xsl.

If you are using a DITA PDF customization plugin, you should specify the next attribute set in the DITA-PDF-Customization/fo/attrs/custom.xsl:

Code: Select all

<xsl:attribute-set name="table" use-attribute-sets="base-font">
<xsl:attribute name="keep-together.within-page">1</xsl:attribute>
</xsl:attribute-set>
Make sure that the above XSLT file is referred from DITA-PDF-Customization/catalog.xml, the next line should be un-comment:

Code: Select all

<!-- Custom attributes entry -->
<uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl"/>


More details about DITA to PDF Output Customization could be found in our user manual.
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
BogdanM777
Posts: 68
Joined: Tue Jun 09, 2015 6:26 pm
Location: Canada

Re: Keep a table on the same page

Post by BogdanM777 »

Thank you very much Radu.
I will try that. The only thing was that I did not know in which file to do the modification for keep-together-within-page.
I did it for other elements and it worked very nicely.

Have a great day
Boreas
Posts: 86
Joined: Wed Feb 09, 2011 10:43 pm

Re: Keep a table on the same page

Post by Boreas »

Hello,

Pushing my luck, I wanted to do the same thing but for a codeblock.
I added this code in the custom.xsl file.

Code: Select all

<xsl:attribute-set name="codeblock" use-attribute-sets="pre">
<xsl:attribute name="keep-together.within-page">1</xsl:attribute>
</xsl:attribute-set>
My reference to the customs.xsl file was already uncommented, So I figured I was in business.

But it did not work. :(

Is it because it's just not possible to do that? or am I missing something.
Boreas
Posts: 86
Joined: Wed Feb 09, 2011 10:43 pm

Re: Keep a table on the same page

Post by Boreas »

Well, :wink: actually it works for the codeblock if I use

Code: Select all

<xsl:attribute name="keep-together.within-page">always</xsl:attribute>
instead of

Code: Select all

<xsl:attribute name="keep-together.within-page">1</xsl:attribute>
I suspect we can probably do this for any element......
Post Reply