[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Page break help

Subject: Re: Page break help
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 12 May 2008 21:46:15 -0400
Re:  Page break help
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@xxxxxxxxxxxxxxxxxxxx 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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.