[xep-support] XSL:fo question

G. Ken Holman gkholman at CraneSoftwrights.com
Mon Oct 10 07:21:50 PDT 2005


At 2005-10-10 08:54 -0400, gayle.greene at exxonmobil.com wrote:
>I have set up conditional page master references for
>different footers for first, rest and last.  The majority of the time the
>documents will be multiple pages and this works.  I want to control for the
>possibility of a single page document which would need the footer that is
>unique to the first page and the footer that is unique to the last page.
>The first page has an icon and the last page has legal text.  The single
>page document would need the icon and the legal text.  From testing, the
>document is interpreted as first page but not first and last.  I have
>searched on the web and it seems that I cannot use page-count as a
>variable.

Correct you cannot use page-count as a variable.

When I need to accommodate a one-page difference from a 
first/middle/last page pattern, I use two page 
repeatable-page-master-alternatives, where the first one is tested 
only a single time, along the lines of:

   <page-sequence-master master-name="whatever">
     <repeatable-page-master-alternatives maximum-repeats="1">
       <conditional-page-master-reference master-reference="only-page-layout"
                                          page-position="last"/>
       <conditional-page-master-reference master-reference="first-page-layout"
                                          page-position="first"/>
     </repeatable-page-master-alternatives>
     <repeatable-page-master-alternatives maximum-repeats="no-limit">
       <conditional-page-master-reference master-reference="last-page-layout"
                                          page-position="last"/>
       <conditional-page-master-reference master-reference="rest-page-layout"
                                          page-position="rest"/>
     </repeatable-page-master-alternatives>
   </page-sequence-master>

Note the document order of the conditional page master references: a 
one-page page sequence is both the first and the last, so I test for 
last first and, if if the first page isn't the last page, then it is 
the first page of a multiple page sequence.

For the next page and remainder of the pages, the first set of 
alternatives is ignored, and the second set of alternatives is the 
only one used, checking for the last in the sequence or otherwise.

Thus, four unique conditions are tested, not just three.  The 
complete example is below.

I hope this helps.

. . . . . . . . . . Ken

<?xml version="1.0" encoding="iso-8859-1"?><!--pgseq-four-conditions.fo-->
<root xmlns="http://www.w3.org/1999/XSL/Format"
       font-family="Times" font-size="20pt">

   <layout-master-set>
     <simple-page-master master-name="only-page-layout"
                         page-height="297mm" page-width="210mm"
                         margin-top="15mm" margin-bottom="15mm"
                         margin-left="15mm" margin-right="15mm">
       <region-body region-name="frame-body" margin-top="10mm"/>
       <region-before region-name="only-region" extent="10mm"/>
     </simple-page-master>
     <simple-page-master master-name="first-page-layout"
                         page-height="297mm" page-width="210mm"
                         margin-top="15mm" margin-bottom="15mm"
                         margin-left="15mm" margin-right="15mm">
       <region-body region-name="frame-body" margin-top="10mm"/>
       <region-before region-name="first-region" extent="10mm"/>
     </simple-page-master>
     <simple-page-master master-name="last-page-layout"
                         page-height="297mm" page-width="210mm"
                         margin-top="15mm" margin-bottom="15mm"
                         margin-left="15mm" margin-right="15mm">
       <region-body region-name="frame-body" margin-top="10mm"/>
       <region-before region-name="last-region" extent="10mm"/>
     </simple-page-master>
     <simple-page-master master-name="rest-page-layout"
                         page-height="297mm" page-width="210mm"
                         margin-top="15mm" margin-bottom="15mm"
                         margin-left="15mm" margin-right="15mm">
       <region-body region-name="frame-body" margin-top="10mm"/>
       <region-before region-name="rest-region" extent="10mm"/>
     </simple-page-master>

   <page-sequence-master master-name="whatever">
     <repeatable-page-master-alternatives maximum-repeats="1">
       <conditional-page-master-reference master-reference="only-page-layout"
                                          page-position="last"/>
       <conditional-page-master-reference master-reference="first-page-layout"
                                          page-position="first"/>
     </repeatable-page-master-alternatives>
     <repeatable-page-master-alternatives maximum-repeats="no-limit">
       <conditional-page-master-reference master-reference="last-page-layout"
                                          page-position="last"/>
       <conditional-page-master-reference master-reference="rest-page-layout"
                                          page-position="rest"/>
     </repeatable-page-master-alternatives>
   </page-sequence-master>

   </layout-master-set>

   <page-sequence master-reference="whatever">
     <static-content flow-name="only-region">
       <block text-align="center">only</block>
     </static-content>
     <flow flow-name="frame-body">
       <block>This is the only page</block>
     </flow>
   </page-sequence>
   <page-sequence master-reference="whatever">
     <static-content flow-name="only-region">
       <block text-align="center">only</block>
     </static-content>
     <static-content flow-name="first-region">
       <block text-align="center">first</block>
     </static-content>
     <static-content flow-name="last-region">
       <block text-align="center">last</block>
     </static-content>
     <static-content flow-name="rest-region">
       <block text-align="center">rest</block>
     </static-content>
     <flow flow-name="frame-body">
       <block>This is the first page</block>
       <block break-before="page">This is a middle page</block>
       <block break-before="page">This is a middle page</block>
       <block break-before="page">This is the last page</block>
     </flow>
   </page-sequence>
</root>


--
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman at CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/f/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/f/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html



More information about the Xep-support mailing list