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

Re: Page-break/Static content

Subject: Re: Page-break/Static content
From: Alexey Gokhberg <alexei@xxxxxxxxxx>
Date: Thu, 28 Dec 2000 14:19:56 +0100
xsl page break
Tobi Kamke wrote:
> 
> Hi all,
> 
> I would like to create a stylesheet for a bill: On the first page there
> should be only the name of the receiver, some text and other things. On the
> second and the following pages there should be some static-content in the
> region-before field (e.g. page-number ...) and then finally in the
> region-body the single items of the bill. So my first problem is that I
> have to different single-page-masters, one for the first page, the other
> for the rest. I have now created the first page, but how can I enforce a
> page-break? I tried this:
> 
>    <fo:page-sequence master-name="sequence">
> 
>    <fo:flow flow-name="xsl-region-body">
>      <xsl:apply-templates select="DOCUMENT/DATA" mode="FirstPage"/>
>     </fo:flow>
> 
>     <fo:block break-after="page"/>
> 
>     <fo:static-content flow-name="xsl-region-before">
>      <fo:block-container height="3cm" width="7cm" top="0cm" left="0cm"
> position="absolute">
>       <fo:block font-family="serif" font-size="10pt" font-weight="bold">
>             Some text
>       </fo:block>
>     </fo:block-container>
>     </fo:static-content>
> 
>    <fo:flow flow-name="xsl-region-body">
>      <xsl:apply-templates select="DOCUMENT/ITEMS" mode="Rest"/>
>     </fo:flow>
> 
> FOP 0.15 returns the error that the flow-names must be unique. What can I
> do? Can someone help me?
> 

According to the recent XSL draft, one and only one fo:flow element is
allowed in the content of fo:page-sequence. You have two of them, which
is wrong anyway. Futhermore, the

     <fo:block break-after="page"/>

has the strange position, being outside any fo:flow and
fo:static-content.

You could try something like:

  <fo:page-sequence master-name="sequence">
<!--

    Place your fo:static-content declarations here ...

-->
    <fo:flow flow-name="xsl-region-body">
      <xsl:apply-templates select="DOCUMENT/DATA" mode="FirstPage"/>
      <fo:block break-after="page"/>
      <xsl:apply-templates select="DOCUMENT/ITEMS" mode="Rest"/>
    </fo:flow>
  </fo:page-sequence>

in order to achieve the proper page break inside the flow.

You will need the page sequence master (fo:page-sequence-master) to
define the separate layouts (incl. the static content) for the first
page and for the rest of the document. Your layout master set will look
like:

      <fo:layout-master-set>
        <fo:simple-page-master master-name="FirstPage" ...> 
          <!-- master for the first page -->
            ...
        </fo:simple-page-master>
        <fo:simple-page-master master-name="Rest" ...>
          <!-- master for the first page -->
            ...
        </fo:simple-page-master>
        <fo:page-sequence-master master-name="sequence">
          <fo:single-page-master-reference master-name="FirstPage"/>
          <fo:repeatable-page-master-reference master-name="Rest"/>
        </fo:page-sequence-master>
      </fo:layout-master-set>

This technique is demonstrated in details in the example of the
telephone bill included in the distribution of our XSL formatter
(available at http://www.unicorn-enterprises.com/ufo_1_00_01.zip); you
might find this example useful.

Alternative (and probably simpler, but stylistically inferior) solution
is using several page-sequences within the same document; the stylesheet
fragment would look like:

  <fo:page-sequence master-name="FirstPage">
<!--

    Place your fo:static-content declarations here ...

-->
    <fo:flow flow-name="xsl-region-body">
      <xsl:apply-templates select="DOCUMENT/DATA" mode="FirstPage"/>
    </fo:flow>
  </fo:page-sequence>

  <fo:page-sequence master-name="Rest">
<!--

    Place your fo:static-content declarations here ...

-->
    <fo:flow flow-name="xsl-region-body">
      <xsl:apply-templates select="DOCUMENT/ITEMS" mode="Rest"/>
    </fo:flow>
  </fo:page-sequence>

In this case you will need two different simple page masters (named
"FirstPage" and "Rest" in this example) to define the correct static
content.

Regards,

Alexey Gokhberg
Unicorn Enterprises SA

 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.