W3C home > Mailing lists > Public > www-xsl-fo@w3.org > June 2001

Re: page break

From: Paul Grosso <pgrosso@arbortext.com>
Date: Tue, 26 Jun 2001 16:22:59 -0500
Message-Id: <>
To: www-xsl-fo@w3.org, Emmanuel Dupouy <Emmanuel.Dupouy@valtech.fr>
Emmanuel Dupouy <Emmanuel.Dupouy@valtech.fr> writes:
> Another question is how could I know the total page number. I would like to
> put it on the bottom of each page like this : 2/30 - 3/30...

The XSL FO Subgroup discussed this today and asked me to reply.

You should be able to put (via your stylesheet) a zero height float
at the end of your fo:flow and then use fo:page-number-citation to
reference it.  Since floats have to stay in order, this float would
come out after all other floats and should therefore be on the last page.

For example, consider the following template:

<xsl:template match="document">
  <fo:page-sequence master-name="docpages" font-family="serif"
         font-size="12pt" line-height="13pt" initial-page-number="1">
   <fo:static-content flow-name="xsl-region-after">
     <fo:block text-align="center">
       <xsl:text> of </xsl:text>
       <fo:page-number-citation ref-id="last-page"/>
   <fo:flow flow-name="xsl-region-body">
     <!-- emit one last zero-height float -->
    <fo:float float="before">
      <fo:block id="last-page" line-height="0pt"></fo:block>

There can be several pages of built-up floats emitted at the end,
and you should still get the desired results.  (It does work in
my implementation, and I didn't even think about this ahead of
time, so there's a chance it will work in most implementations.)

One interesting issue is:  if you use the "force-page-count" 
property on fo:page-sequence and that causes an extra blank
page to be emitted after the last page with floats on it, what
do you want to consider as your last page number?  The above
technique would give you the last page on which you actually
had something, but this seems like a reasonable thing to get.
(Then again, I don't know how many implementations support
"force-page-count".  Mine doesn't.)

Received on Tuesday, 26 June 2001 17:27:20 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:25 UTC