Re: page break

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">
       <fo:page-number/>
       <xsl:text> of </xsl:text>
       <fo:page-number-citation ref-id="last-page"/>
      </fo:block>
   </fo:static-content>
   <fo:flow flow-name="xsl-region-body">
     <xsl:apply-templates/>
     <!-- emit one last zero-height float -->
    <fo:float float="before">
      <fo:block id="last-page" line-height="0pt"></fo:block>
    </fo:float>
   </fo:flow>
  </fo:page-sequence>
</xsl:template>

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.)

paul

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