Page 1 of 1
Keep a table on the same page
Posted: Thu Oct 15, 2015 5:48 pm
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
Re: Keep a table on the same page
Posted: Fri Oct 16, 2015 12:13 pm
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.
Re: Keep a table on the same page
Posted: Fri Oct 16, 2015 3:42 pm
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
Re: Keep a table on the same page
Posted: Wed Nov 15, 2017 6:12 pm
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.
Re: Keep a table on the same page
Posted: Wed Nov 15, 2017 6:21 pm
by Boreas
Well,
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......