Re: Detecting last page of real content

At 2012-02-05 15:20 -0600, Earl Hood wrote:
>[Sorry if this is a dupe, seems mailing list does not like
>  when Sender field is not the same as From/Reply-to.  List
>  software should handle this properly.]
>
>I have an odd-even page layout where the sequence is configured
>to end on even.  Hence, a blank page will be inserted if the
>flow content ends on odd.
>
>The problem I have is detecting the case when the flow content
>ends on odd since I am required to indicate that the next page
>is blank.  For example, if the next page is blank, the previous
>page should have something like the following where the page
>number is printed:
>
>  3/4 blank
>
>This indicates we are on page 3, and page 4 is blank.
>
>I've tried to use the "last" for page-position in
>conditional-page-master-reference, but it appears that "last"
>also includes the generated blank page vs the last page
>of flowed content.
>
>Is there a way with standard XSL-FO to get the effect I
>want?

Yes, I've done this in my XSL-FO classroom and showed it working with 
Antenna House.  Attached is the PDF I created (I don't know if this 
list will accept attachments or not).  The XSL-FO that created the 
PDF is below.

In brief,

(1) - put a unique identifier in each page-sequence's blank page flow
(2) - use different page geometries for odd and even pages
(3) - add a marker retrieval on the odd page after the page number
(4) - at the end of the flow the marker as you want the suffix to appear,
       using a page-number-citation to cite the following even page number
       using that page-sequences blank page unique identifier defined in (1)

Note that students informed me that the commercial brand of XSL-FO 
processor they are using does not support this standard use of 
XSL-FO.  I won't say publicly which processor that was, but it might 
be that the processor you are using will not work here.

A contributor to the XSL list revealed this approach last year I 
think.  I wish I had thought of it.

I hope this helps.

. . . . . . . . . Ken

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="http://www.w3.org/1999/XSL/Format" font-family="Times" 
font-size="20pt">
    <layout-master-set>
       <simple-page-master master-name="frame-even" 
page-height="210mm" page-width="297mm"
                           margin-top="1cm"
                           margin-bottom="1cm"
                           margin-left="1cm"
                           margin-right="1cm">
          <region-body region-name="frame-body" margin-bottom="1cm"/>
          <region-after region-name="after-even" extent="1cm"/>
       </simple-page-master>
       <simple-page-master master-name="frame-odd" 
page-height="210mm" page-width="297mm" margin-top="1cm"
                           margin-bottom="1cm"
                           margin-left="1cm"
                           margin-right="1cm">
          <region-body region-name="frame-body" margin-bottom="1cm"/>
          <region-after region-name="after-odd" extent="1cm"/>
       </simple-page-master>
       <simple-page-master master-name="blank" page-height="210mm" 
page-width="297mm" margin-top="1cm"
                           margin-bottom="1cm"
                           margin-left="1cm"
                           margin-right="1cm">
          <region-body region-name="blank-body"/>
       </simple-page-master>
       <page-sequence-master master-name="frames">
          <repeatable-page-master-alternatives>
             <conditional-page-master-reference 
master-reference="blank" blank-or-not-blank="blank"/>
             <conditional-page-master-reference 
master-reference="frame-even" odd-or-even="even"/>
             <conditional-page-master-reference 
master-reference="frame-odd" odd-or-even="odd"/>
          </repeatable-page-master-alternatives>
       </page-sequence-master>
    </layout-master-set>
   <page-sequence master-reference="frames" force-page-count="end-on-even">
       <static-content flow-name="after-even">
          <block text-align="center">
         Page <page-number/>
          </block>
       </static-content>
       <static-content flow-name="after-odd">
          <block text-align="center">
         Page <page-number/>
             <retrieve-marker retrieve-class-name="next_blank"/>
          </block>
       </static-content>
       <static-content flow-name="blank-body">
          <block id="d0e3_blank"/>
       </static-content>
       <flow flow-name="frame-body">
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>
             <marker marker-class-name="next_blank">
           (<page-number-citation ref-id="d0e3_blank"/> blank)
         </marker>
          </block>
       </flow>
    </page-sequence>
   <page-sequence master-reference="frames" force-page-count="end-on-even">
       <static-content flow-name="after-even">
          <block text-align="center">
         Page <page-number/>
          </block>
       </static-content>
       <static-content flow-name="after-odd">
          <block text-align="center">
         Page <page-number/>
             <retrieve-marker retrieve-class-name="next_blank"/>
          </block>
       </static-content>
       <static-content flow-name="blank-body">
          <block id="d0e102_blank"/>
       </static-content>
       <flow flow-name="frame-body">
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>
             <marker marker-class-name="next_blank">
           (<page-number-citation ref-id="d0e102_blank"/> blank)
         </marker>
          </block>
       </flow>
    </page-sequence>
   <page-sequence master-reference="frames" force-page-count="end-on-even">
       <static-content flow-name="after-even">
          <block text-align="center">
         Page <page-number/>
          </block>
       </static-content>
       <static-content flow-name="after-odd">
          <block text-align="center">
         Page <page-number/>
             <retrieve-marker retrieve-class-name="next_blank"/>
          </block>
       </static-content>
       <static-content flow-name="blank-body">
          <block id="d0e129_blank"/>
       </static-content>
       <flow flow-name="frame-body">
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>
             <marker marker-class-name="next_blank">
           (<page-number-citation ref-id="d0e129_blank"/> blank)
         </marker>
          </block>
       </flow>
    </page-sequence>
   <page-sequence master-reference="frames" force-page-count="end-on-even">
       <static-content flow-name="after-even">
          <block text-align="center">
         Page <page-number/>
          </block>
       </static-content>
       <static-content flow-name="after-odd">
          <block text-align="center">
         Page <page-number/>
             <retrieve-marker retrieve-class-name="next_blank"/>
          </block>
       </static-content>
       <static-content flow-name="blank-body">
          <block id="d0e228_blank"/>
       </static-content>
       <flow flow-name="frame-body">
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>This is a test</block>
          <block>
             <marker marker-class-name="next_blank">
           (<page-number-citation ref-id="d0e228_blank"/> blank)
         </marker>
          </block>
       </flow>
    </page-sequence>
</root> 
--
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/uoui9h
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/f/
G. Ken Holman                   mailto:gkholman@CraneSoftwrights.com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal

Received on Monday, 6 February 2012 03:28:53 UTC