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

Re: static content on last page

From: Tony Graham <Tony.Graham@MenteithConsulting.com>
Date: Fri, 08 Jan 2010 08:45:51 +0000
To: www-xsl-fo@w3.org
Message-ID: <877hrt0ytc.fsf@takai.menteithconsulting.com>
On Thu, Jan 07 2010 22:08:42 +0000, armyofda12mnkeys@gmail.com wrote:
...
> 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.

The concept isn't that a particular value inherently overrides any other
value; it's the first fo:conditional-page-master-reference in the
sequence that has all its conditions evaluate to true that is used.  See
point (d) in the last paragraph of
http://www.w3.org/TR/xsl11/#fo_repeatable-page-master-alternatives

So it's best to put the more unusual cases *before* the conventional
cases.  Which you have done.

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

This appears to do what you want.

...
> 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'?

The 'last' condition would be true for single-page page sequences, yes.

Because that fo:conditional-page-master-reference is before the one with
page-position="any", the one with "last" would be used when it's true.

> 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?

It should be smart enough, though that's one of the hard parts of
building a XSL formatter.

Regards,


Tony Graham                         Tony.Graham@MenteithConsulting.com
Director                                  W3C XSL FO SG Invited Expert
Menteith Consulting Ltd                               XML Guild member
XML, XSL and XSLT consulting, programming and training
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Registered in Ireland - No. 428599   http://www.menteithconsulting.com
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
xmlroff XSL Formatter                               http://xmlroff.org
xslide Emacs mode                  http://www.menteith.com/wiki/xslide
Unicode: A Primer                               urn:isbn:0-7645-4625-2
Received on Friday, 8 January 2010 08:46:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 8 January 2010 08:46:27 GMT