Keep a table on the same page

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

Keep a table on the same page

Thu Oct 15, 2015 5:48 pm

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: 307
Location: Craiova

Re: Keep a table on the same page

Fri Oct 16, 2015 12:13 pm

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
Location: Canada

Re: Keep a table on the same page

Fri Oct 16, 2015 3:42 pm

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: 82

Re: Keep a table on the same page

Wed Nov 15, 2017 6:12 pm

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: 82

Re: Keep a table on the same page

Wed Nov 15, 2017 6:21 pm

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......

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 5 guests