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

Re: [FO] Conditional page break

Subject: Re: [FO] Conditional page break
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 29 Aug 2002 13:14:10 -0400
xsl fo conditional page break
At 2002-08-29 09:46 -0700, Troy Ely wrote:
<letter>
    <section title="The Boarding House">
Mrs Mooney was a butcher's daughter. She was a woman who
was quite able to keep things to herself: a determined woman.
She had married her father's foreman, and opened a butcher's
shop near Spring Gardens. But as soon as his father-in-law was
dead Mr Mooney began to go to the devil. He drank, plundered
the till, ran headlong into debt. It was no use making him
take the pledge: he was sure to break out again a few days
after. By fighting his wife in the presence of customers and
by buying bad meat he ruined his business. One night he went
for his wife with the cleaver, and she had to sleep in a
neighbour's house.
    </section>
    <section title="After the Race">
The cars came scudding in towards Dublin, running evenly like
pellets in the groove of the Naas Road. At the crest of the
hill at Inchicore sightseers had gathered in clumps to watch
the cars careering homeward, and through this channel of
poverty and inaction the Continent sped its wealth and
industry. Now and again the clumps of people raised the
cheer of the gratefully oppressed. Their sympathy, however,
was for the blue cars - the cars of their friends, the French.
    </section>
    <signature>
James Joyce
    </signature>
    <CCs>
        <cc>Poe</cc>
        <cc>Maupassant</cc>
    </CCs>
    <docstamp>
JJ:1914:ss12345
    </docstamp>
</letter>
...
Currently, the app turns each element into an fo:block.
...
However, the business requires that the sig/cc/docstamp
combination never appear on a page by itself -- there must
always be at least 2 lines of text preceding it.

Is there a way to force a certain number of lines to the
next page, when the content of the block will fit within
a page?

The following stylesheet will produce the result you need when I test it with Antenna House, and I've kept the widow count at the default of 2.


Note that the signature is being kept with the last area of the preceding block and that pulls the minimum number of widow lines onto the page with the signature block.

I hope this helps.

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

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://www.w3.org/1999/XSL/Format"
                version="1.0">

<xsl:template match="/">
<root xmlns="http://www.w3.org/1999/XSL/Format"
      font-family="Times" font-size="24pt">

  <layout-master-set>
    <simple-page-master master-name="frame"
                        page-height="297mm" page-width="210mm"
                        margin-top="15mm" margin-bottom="15mm"
                        margin-left="15mm" margin-right="15mm">
      <region-body region-name="frame-body"/>
    </simple-page-master>
  </layout-master-set>

  <page-sequence master-reference="frame">
    <flow flow-name="frame-body">
      <xsl:apply-templates/>
    </flow>
  </page-sequence>
</root>
</xsl:template>

<xsl:template match="section">
  <block space-after="1em"><xsl:apply-templates/></block>
</xsl:template>

<xsl:template match="signature|cc|docstamp">
  <block keep-with-previous="always"><xsl:apply-templates/></block>
</xsl:template>

</xsl:stylesheet>


-- Upcoming hands-on in-depth Europe: Sep 18-Sep 20,2002 XSLT/XPath and XSL-FO North America: Sep 30-Oct 4,2002 instructor-led deliveries Japan: Oct 7-Oct 11,2002

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 (Fax:-0995)
ISBN 0-13-065196-6                       Definitive XSLT and XPath
ISBN 1-894049-08-X   Practical Transformation Using XSLT and XPath
ISBN 1-894049-07-1               Practical Formatting Using XSL-FO
XSL/XML/DSSSL/SGML/OmniMark services, books (electronic, printed),
articles, training (instructor-live,Internet-live,web/CD,licensed)
Next public training:     2002-09-11,13,18,19,30,10-03,07,10,12-08


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.