[xsl] maximum-repeats?

Subject: [xsl] maximum-repeats?
From: "Robert Austin" <RAustin@xxxxxxxx>
Date: Thu, 13 Dec 2007 10:39:52 -0500
Included, as well as pasted below is an fo document. It is commented to
describe the intent of individual code blocks. Basically, I'd like a
special page-master to be used for the last page if there are 2,3 or 4
pages. I'd also like the same special page-master to be used on the 5th
page if there are more than 4 pages. In other words, I must use a
special page master in the document. I mustn't be later than the 5th
page, and I'd like it to be as late in the document as possible. The
test case tries to use repeatable-page-master-alternatives to accomplish
this, but the maximum-repeats attribute seems to be ignored. Can anyone
offer some assistance?

<?xml version="1.0"?>
<root xmlns="http://www.w3.org/1999/XSL/Format";>

    <!-- here are my simple page masters. They each have the same page
width, height, and body region. They each have unique headers. Each
header region contains a static-content that contains the name of the
master-name it belongs to. This way, I can tell which simple-page-master
is used in the pdf. -->
    <simple-page-master master-name="first" page-width="8.5in"
      <region-before region-name="first-header" extent="1in" />
      <region-body region-name="body" margin="2.5cm" />
    <simple-page-master master-name="even" page-width="8.5in"
      <region-before region-name="even-header" extent="1in" />
      <region-body region-name="body" margin="2.5cm" />
    <simple-page-master master-name="odd" page-width="8.5in"
      <region-before region-name="odd-header" extent="1in" />
      <region-body region-name="body" margin="2.5cm" />
    <simple-page-master master-name="even-masthead" page-width="8.5in"
      <region-before region-name="even-masthead-header" extent="1in" />
      <region-body region-name="body" margin="2.5cm" />
    <simple-page-master master-name="odd-masthead" page-width="8.5in"
      <region-before region-name="odd-masthead-header" extent="1in" />
      <region-body region-name="body" margin="2.5cm" />

    <!-- here is my page-sequence-master. i'll comment with my
intentions below -->
    <page-sequence-master master-name="mySequence">
      <!-- the first page should use the first simple-page-master. this
works fine -->
      <single-page-master-reference master-reference="first" />

      <!-- the next three pages should use either the odd of even
simple-page-master, unless they happen to be the last page in the flow,
in which case they should use either the odd-masthead or even-masthead
simple-page-master. I am legally required to print a legal disclaimer on
this document. The disclaimer must before page 6 (in other words, on one
of the following pages: 1,2,3,4,5). My designer requires this disclaimer
to be on the last possible page. And the document may have as few as 2
pages or source. Therefore, i'd like it to be on the last page if there
are less than 5 pages, or on the 5 page if there are 5 or more pages.
      <repeatable-page-master-alternatives maximum-repeats="3">
        <!-- use the odd-masthead master if this page is odd, and is the
last page -->
master-reference="odd-masthead" odd-or-even="odd" page-position="last"

        <!-- use the even-masthead master if this page is even, and is
the last page -->
master-reference="even-masthead" odd-or-even="even" page-position="last"

        <!-- use the even master if this page isn't the last page, and
is even -->
        <conditional-page-master-reference master-reference="even"
odd-or-even="even" />

        <!-- use the odd master if this page isn't the last page, and is
odd -->
        <conditional-page-master-reference master-reference="odd"
odd-or-even="odd" />
      <!-- if the processor gets to this part of the sequence, than the
document must be 5 or more pages long, therefore the fifth page should
contain the disclaimer. This is the fifth page, so use either the
odd-disclaimer, or even-disclaimer master. -->

      <repeatable-page-master-alternatives maximum-repeats="1">
master-reference="odd-masthead" odd-or-even="odd" />
master-reference="even-masthead" odd-or-even="even" />

      <!-- at this point, the document is on page 6 or higher, and
should choose between even or odd master-page accordingly -->
        <conditional-page-master-reference master-reference="even"
odd-or-even="even" />
        <conditional-page-master-reference master-reference="odd"
odd-or-even="odd" />

  <!-- here is my sequence. each header has its name as its content. the
body contains 10 pages, each label their own page number. -->
  <page-sequence master-reference="mySequence">
    <static-content flow-name="first-header">
    <static-content flow-name="even-header">
    <static-content flow-name="odd-header">
    <static-content flow-name="even-masthead-header">
    <static-content flow-name="odd-masthead-header">
    <flow flow-name="body">
      <block break-after="page">First Page</block>
      <block break-after="page">Second Page</block>
      <block break-after="page">Third Page</block>
      <block break-after="page">Fourth Page</block>
      <block break-after="page">Fifth page, this should use either
odd-masthead-body or even-masthead-body</block>
      <block break-after="page">Sixth page</block>
      <block break-after="page">Seventh Page</block>
      <block break-after="page">Eight Page</block>
      <block break-after="page">Ninth Page</block>
      <block break-after="page">Tenth page, last page</block>

Current Thread