xsl-list
[Top] [All Lists]

Re: [xsl] Page break help

2008-05-12 18:48:43
At 2008-05-12 13:20 -0400, Ferry, Jeremy wrote:
I've got a document who's content is a table that contains rows of
product line items. I'm using groups to break the product line items
into pages.

Why not use natural page breaks, using a "keep" to keep a given row from breaking over a page break?

At the very end of the product line items (on the last page)
I need to print a block of content. Currently I'm simply making the
group size small enough to make room for the block of content on the
last page but this has the undesirable side effect of not filling up the
available space on all previous pages.

If you flowed your content over the page breaks, you could flow your following block naturally without any intervention.

For example, I can fit 7 records on a page but I need to put a block
after the last group that takes up the space of 2 records. So what I'm
trying to do is force a page break if the last group contains more than
5 records but all the previous pages should fit 7 records...

This is not in the spirit of XSL-FO, but I find it difficult to advise with the limited information you've shared. I would have thought using a table might help, perhaps with a footnote construct used to flow blocks at the bottom of the last page.

And I also don't understand your requirement in that if, on the last page, you need to break the items at the fifth one, then the sixth and seventh one will be on the next page, which means it no longer is the last page.

                <xsl:if test="position() = last()">

                        <xsl:if test="count(current-group()) &gt; 5">
                                <fo:block break-before="page"/>
                        </xsl:if>

                        content block to follow last group goes here...

                </xsl:if>

In the above you don't indicate which context is being tested for being the last, and I can't see where in the processing of the group you are testing the count of constructs in the group ... because your test is resulting in the block being added but you don't show where this instruction is being executed in relation to the members of the current group. Wouldn't you need an iteration context over the current group and then add the break when the position() is equal to 5? Or something along those lines?

Sorry ... I really don't find your requirement very clearly stated.

The <fo:block break-before="page"/> IS getting included in the output
but the page break is not happening.

If that block is already at the top of a page, there is no blank page generated ... break-before="page" is not a command to be executed, it is a condition that has to be true. The formatter goes to a new page explicitly if the formatting position is not at the beginning of a page. If the formatting position is at the beginning of the page when the formatter encounters this condition, nothing is done because the condition is already being satisfied.

Am I doing something wrong?

If that block is not already at the top of a page, this indicates a problem in the formatter you are using. It is not following your directive that this block is flowed as the first block in a page context (that is, that there is a page break before this block in the final result). You don't say which formatter you are using.

Maybe I've just misunderstood how page breaks work?

I've described above part of what I teach to my XSL-FO students about break-before= ... I hope this helps.

. . . . . . . . . . . . . . Ken


--
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>