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

RE: page numbers and fo

Subject: RE: page numbers and fo
From: Sebastian Rahtz <sebastian.rahtz@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 2 Jun 2000 11:59:26 +0100 (BST)
xsl fo page numbers
Pawson, David writes:
 > Taking the wet towel off,
 > That would give me no page number on the first page.
 >    fine for onepagers
 >    bust for two pagers, which require page number on first page also?
 > 

Set up the page sequence to use a numbered page master for the first
page.

Consider the worked example that follows (everyone else can hit Delete
at this point if they dont want to read lines of XSL FO). If you, or
any XSL FO guru, spots an error, PLEASE tell me. I spent a long time
on this, and I want it to be right.


Sebastian

<fo:layout-master-set>

* first define 3 page master, simple1, left1 and right1

  <fo:simple-page-master master-name="simple1" page-width="211mm"
  page-height="297mm" margin-top="75pt" margin-bottom="100pt"
  margin-left="80pt" margin-right="150pt">
    <fo:region-body margin-bottom="24pt" margin-top="24pt" />

    <fo:region-after extent="25pt" />

    <fo:region-before extent="25pt" />
  </fo:simple-page-master>

* note that we explicitly name the regions in here, so that we can
* assign static content properly later

  <fo:simple-page-master master-name="left1" page-width="211mm"
  page-height="297mm" margin-top="75pt" margin-bottom="100pt"
  margin-left="80pt" margin-right="150pt">
    <fo:region-body margin-bottom="24pt" margin-top="24pt" />

    <fo:region-after region-name="xsl-region-after-left"
    extent="25pt" />

    <fo:region-before region-name="xsl-region-before-left"
    extent="25pt" />
  </fo:simple-page-master>

  <fo:simple-page-master master-name="right1" page-width="211mm"
  page-height="297mm" margin-top="75pt" margin-bottom="100pt"
  margin-left="80pt" margin-right="150pt">
    <fo:region-body margin-bottom="24pt" margin-top="24pt" />

    <fo:region-after region-name="xsl-region-after-right"
    extent="25pt" />

    <fo:region-before region-name="xsl-region-before-right"
    extent="25pt" />
  </fo:simple-page-master>

* OK, now define some page master sequences. first, a twosided one,
* where we alternate left and right masters depending on odd-or-even

  <fo:page-sequence-master master-name="twoside1">
    <fo:repeatable-page-master-alternatives>
      <fo:conditional-page-master-reference master-name="first1"
      page-position="first" />

      <fo:conditional-page-master-reference master-name="right1"
      odd-or-even="odd" />

      <fo:conditional-page-master-reference master-name="left1"
      odd-or-even="even" />
    </fo:repeatable-page-master-alternatives>
  </fo:page-sequence-master>

* now a one-sided version, where we use the "simple1" master for all
* but the  first page

  <fo:page-sequence-master master-name="oneside1">
    <fo:repeatable-page-master-alternatives>
      <fo:conditional-page-master-reference master-name="first1"
      page-position="first" />

      <fo:conditional-page-master-reference
      master-name="simple1" />
    </fo:repeatable-page-master-alternatives>
  </fo:page-sequence-master>


Got that straight? anyone else read that far? Now we can actually
*use* these beasts, eg the following starts a new page sequence in
twosided mode with appropriate static content for left and right

<fo:page-sequence hyphenate="true" language="US"
initial-page-number="1" master-name="twoside1">
  <fo:static-content flow-name="xsl-region-after-right">
    <fo:block text-align="end" font-size="10pt">
      <fo:page-number />
    </fo:block>
  </fo:static-content>

  <fo:static-content flow-name="xsl-region-after-left">
    <fo:block text-align="justify" font-size="10pt">
      <fo:page-number />
      <fo:leader rule-thickness="0pt" />
    </fo:block>
  </fo:static-content>

  <fo:static-content flow-name="xsl-region-before-right">
    <fo:block text-align="center" font-size="10pt">
    TEI Lite: An Introduction to Text Encoding for
    Interchange</fo:block>
  </fo:static-content>

  <fo:static-content flow-name="xsl-region-before-left">
    <fo:block text-align="center" font-size="10pt">Lou Burnard and
    C. M. Sperberg-McQueen</fo:block>
  </fo:static-content>

  <fo:static-content flow-name="xsl-region-before-first" />

  <fo:static-content flow-name="xsl-region-after-first">
    <fo:block font-size="10pt">
      <fo:leader text-align="center" rule-thickness="0pt" />
      <fo:page-number />
    </fo:block>
  </fo:static-content>

  <fo:flow flow-name="xsl-region-body" font-family="Times Roman"
  font-size="10pt">...</fo:flow>
</fo:page-sequence>


Did someone say that XSL FO was wordy?

Of course, don't bother to try the above in FOP or XEP, cos they don't
implement this version of the language :-}

Sebastian


 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.