Jump to content

Page numbering issue with multiple page seqenuce


shouasx
 Share

Recommended Posts

Is there a work around getting the total page number with multiple sequence? The code below, I have a cover page defined and another for the rest of the document.

<xsl:stylesheet  xmlns:fox="http://xml.apache.org/fop/extensions"  xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <!--=============================================================================    Main Template    ==============================================================================-->  <xsl:template match="/SalesBill">    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">      <fo:layout-master-set>        <fo:simple-page-master master-name="First-Page" page-height="11in" page-width="8.5in" margin-top=".25in" margin-left=".50in" margin-bottom=".25in" margin-right=".50in">          <fo:region-body margin-left=".50in" margin-top=".25in" margin-bottom=".50in" margin-right=".50in"/>          <fo:region-before extent=".50in" precedence="true" region-name="before-on-first"/>          <fo:region-after extent=".50in" precedence="true"/>          <fo:region-start extent=".50in" precedence="false"/>          <fo:region-end extent=".50in" precedence="false"/>        </fo:simple-page-master>        <fo:simple-page-master master-name="Repeat-Pages" page-height="11in" page-width="8.5in" margin-top=".25in" margin-left=".50in" margin-bottom=".25in" margin-right=".50in">          <fo:region-body margin-left=".50in" margin-top=".25in" margin-bottom=".50in" margin-right=".50in"/>          <fo:region-before extent=".50in" precedence="true" region-name="before-rest"/>          <fo:region-after extent=".50in" precedence="true"/>          <fo:region-start extent=".50in" precedence="false"/>          <fo:region-end extent=".50in" precedence="false"/>        </fo:simple-page-master>        <!-- Create a template for a cover/page for the rest of the document -->        <page-sequence-master master-name="All-Pages">          <single-page-master-reference master-reference="First-Page"/>          <repeatable-page-master-reference master-reference="Repeat-Pages"/>        </page-sequence-master>      </fo:layout-master-set>      <fo:page-sequence master-reference="All-Pages" initial-page-number="1">        <fo:static-content flow-name="before-on-first">          <fo:block text-align="right" color="#000000" font-family="Arial" font-size="8.0pt">            <xsl:text>My header</xsl:text>          </fo:block>        </fo:static-content>        <fo:static-content flow-name="xsl-region-after">          <fo:block text-align="justify" color="#000000" font-family="Arial" font-size="8.0pt">            <xsl:text>Page </xsl:text>            <fo:page-number/>            <xsl:text> of  </xsl:text>            <fo:page-number-citation ref-id="theEnd"/>          </fo:block>        </fo:static-content>        <fo:flow flow-name="xsl-region-body">          <fo:block>            <xsl:text>Just some body text as an example</xsl:text>          </fo:block>          <fo:block id="theEnd"/>        </fo:flow>      </fo:page-sequence>    </fo:root>  </xsl:template></xsl:stylesheet>

Using this approach works a single page sequence, but does not seem to work for multiple pages. It looks like whenever you have multiple pages, the total number is reset upon entering the new page sequence.

   <fo:static-content flow-name="xsl-region-after">     <fo:block text-align="center">       Page <fo:page-number/> of <fo:page-number-citation ref-id="end"/>     </fo:block>   </fo:static-content>   ...   <fo:block id="end"/>

So if there is 4 pages total, on the cover page this is showing up as "Page 1 of 1" instead of "Page 1 of 4". Anyone ran into this problem before?

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...