W3C home > Mailing lists > Public > www-xsl-fo@w3.org > January 2010

static content on last page

From: Ari Army <armyofda12mnkeys@gmail.com>
Date: Thu, 7 Jan 2010 17:08:42 -0500
Message-ID: <797650581001071408h2702bb8ayf1e8dc0fa106e34e@mail.gmail.com>
To: www-xsl-fo@w3.org
Basically i want to do something like this...
Usually when looping through xml with xsl, each student xml node has
content to fill one page but sometimes rarely 2 pages  ... The way it
was handled was 1 simple page-sequence, and if it goes onto a new page
then the 'footer' content at bottom is just on the next page near the
top (so footer was just part xsl-body region), and a break-after was
put for each block.

I want to set up something like this to handle the footers better,
with a page-sequence created for each student, so it can handle the
'last' pages appropriately.
Scenarios:
if a page-sequence produces 1 page, then a large footer is used
if a page-sequence produces 2/multiple pages, then a small footer is
used on 1st page, and large one on 2nd page.

This is how I think it should be done with code examples:

I would have 2 simple page masters with 2 before and after regions set
for each. The header region is the same on both so they can share that
static-content and have the same master-name to use later.

One simple page master I call 'lastPageIfMultiplePagesOrIfOnePage' has
a header and large footer, respectfully called
xsl-before-region-bothSameContent and
xsl-after-region-lastPageIfMultiplePagesOrIfOnePage and handles the
1st page if only 1 page produced, or last page if many pages produced
in the sequence.

Another simple page master called 'firstIfMultiplePages' has a header
xsl-before-region-bothSameContent and small footer,
xsl-after-region-firstIfMultiplePages, to hand if there are 2 pages in
the page sequence and handles the 1st page if so.

***So if one page is in the sequence,
lastPageIfMultiplePagesOrIfOnePage is called with the regions i want,
since it is the 'last' page in the sequence (i hope this overrides
'any' at least). the footer is larger since it has a comments area and
company info.

***If the sequence is two pages, firstIfMultiplePages is called for
the 1st page (its footer is smaller and just has company info and
doesnt include the comments area),
and lastPageIfMultiplePagesOrIfOnePage is called for the 2nd page and
includes the comments area in the footer.


Coded it would look something like this:

   <fo:layout-master-set>

      <fo:simple-page-master page-height="11in" page-width="8.5in"
master-name="firstIfMultiplePages">
        <fo:region-body region-name="xsl-region-body" margin="2in 0in
1in 0in"/>

        <fo:region-before
region-name="xsl-before-region-bothSameContent" extent="2in" />
        <fo:region-after region-name="xsl-region-after" extent="1in" />


      </fo:simple-page-master>

      <fo:simple-page-master page-height="11in" page-width="8.5in"
master-name="lastPageIfMultiplePagesOrIfOnePage">
        <fo:region-body region-name="xsl-region-body" margin="2in 0in
4in 0in"/>

        <fo:region-before
region-name="xsl-before-region-bothSameContent" extent="2in" />
        <fo:region-after region-name="xsl-region-after" extent="4in" />

      </fo:simple-page-master>

    </fo:layout-master-set>

Then a page-sequence-master is setup for last and any page-positions, aka:

<fo:page-sequence-master master-name="for_each_student">
   <fo:repeatable-page-master-alternatives>
     <fo:condition-page-master-reference
master-reference="lastPageIfMultiplePagesOrIfOnePage"
page-position="last">
     <fo:condition-page-master-reference
master-reference="firstIfMultiplePages" page-position="any">
   </fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>

and the actual page sequence flowing data into a student (would have
xsl do this for each student):

<fo:page-sequence master-reference="for_each_student">
  <fo:static-content
flow-name="xsl-before-region-bothSameContent">...</fo:static-content>

  <fo:static-content
flow-name="xsl-after-region-lastPageIfMultiplePagesOrIfOnePage">...</fo:static-content>
  <fo:static-content
flow-name="xsl-after-region-firstIfMultiplePages">...</fo:static-content>
  <fo:flow flow-name="xsl-region-body">....<fo:flow>
</fo:page-sequence>


soooo if you read all that, my question is:
if it doesnt overflow body region and is only 1 page, does it default
to that 'last' page-position which would override 'any'?

And if thats true... it starts building a student's page sequence, so
it tries to build page 1 with the large footer using 'last', but if
the content in xsl-body region overflows, will it be smart to use
'any' on the first. and 'last' on the 2nd page?

Sorry if that was too complex and along of a question
Thanks for any guidance, I'll test sometime next week, just wanted
clarification on my theoretical scenario.

-Arian
Received on Thursday, 7 January 2010 22:09:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 7 January 2010 22:09:16 GMT