Kamil Święch
Kamil Święch

Reputation: 35

XSL - Keep together 2 fo:blocks on a page

In XSLT I have fo:region-body with attribute column-count="3" and 2 fo:blocks. First of them have to be across all columns (title of the second fo:block with a horizontal line). The second one is a block of text divided between 3 columns.

<fo:block span="all">
    <xsl:apply-templates select="//region[@name='BodyTitle']"/>
</fo:block>
<fo:block span="none">
     <xsl:apply-templates select="//region[@name='Body_3_Columns']"/>
</fo:block>

I would like to keep those blocks the same page but without positive result. Keep-together, Keep-with-next, etc. does not work on this case. I even tried to put those in fo:block-container, however both of them were displayed as either one or three columns depending on chosen span value (all / none).

Is there any way to resolve my problem?

Thanks in advance!

Upvotes: 0

Views: 1821

Answers (1)

Tony Graham
Tony Graham

Reputation: 8068

If you are using AH Formatter, then you can make a three-column fo:block-container for the block of text:

<fo:block keep-with-next.within-page="always">...</fo:block>
<fo:block-container column-count="3" keep-together.within-page="always">...

If the document as a whole has three columns, then you can put span="all" on both the fo:block and the fo:block-container to get the correct width for the columns inside the fo:block-container.

Upvotes: 1

Related Questions