0

I've tried the following suggestions and none have worked, my <fo:block> keeps getting split between the two inner blocks.

<fo:block keep-with-next="always" page-break-inside="avoid">
  <fo:block keep-together="always">
    Block # 1, a header
  </fo:block>

  <fo:block keep-together="always">
    Block # 2, a bunch of text
  </fo:block>
</fo:block>

How can I keep the two inner blocks together on the page? I am using FO.NET, in case that has limitations.

Community
  • 1
  • 1
DLeh
  • 23,806
  • 16
  • 84
  • 128
  • I do not have FO.NET around, but RenderX XEP and Apache FOP tested and neither has that issue. Both kept your whole block together on a page without any split. – Kevin Brown Jun 12 '15 at 22:40
  • 1
    *in case that has limitations*: FO.NET is based on version 0.20.4 of FOP. Which is ancient. According to this page, it only supported `keep-together` for table rows, http://www.cs.helsinki.fi/group/xmltools/formatters/fop/fop-0.20.5/build/site/compliance.html#fo-property-keep-together – mzjn Jun 13 '15 at 06:13
  • Thank you for your help. Unfortunately we are stuck using FONet. So I'll just thave to convert my blocks to a table instead, which shouldn't be a problem. Thanks! – DLeh Jun 13 '15 at 12:53
  • @mzjn if you want to submit an answer i will mark it as the answer, thanks! – DLeh Jun 16 '15 at 12:20

1 Answers1

0

I think you should contact FO.NET folks. Testing this example with RenderX XEP and with Apache FOP yields 3 pages output. At 10.36in the whole text of your block fits on the page, at 10.37in it does not. In both products, all of the content in your block is moved to the following page. Note that the only required tag is the page-break-inside="avoid", nothing else.

        <fo:flow flow-name="xsl-region-body">
            <fo:block>Space</fo:block>
            <fo:block space-before="10.36in">I Generate One Page</fo:block>
            <fo:block page-break-inside="avoid">
                <fo:block >
                    Block # 1, a header
                </fo:block>
                <fo:block>
                    Block # 2, a bunch of text
                </fo:block>
            </fo:block>
            <fo:block break-before="page">I Generate Two Pages</fo:block>
            <fo:block space-before="10.37in">Space</fo:block>
            <fo:block page-break-inside="avoid">
                <fo:block >
                    Block # 1, a header
                </fo:block>
                <fo:block>
                    Block # 2, a bunch of text
                </fo:block>
            </fo:block>
        </fo:flow>

In looking at the FO.NET website, it has not been updated since 2009. I don;t see anything about their (lack of) support for keeps but coming from another XSL FO vendor, keeps are pretty difficult to do correctly in code.

Kevin Brown
  • 8,805
  • 2
  • 20
  • 38