2
<fo:block-container position="absolute" top="3.25in" left="2.9in" height="3.0in" width="7.8in" border-width="0.1in">
        <fo:block span="none" white-space-collapse="false"  font-family="Arial" font-size="10pt" text-align="start">
          <xsl:text>Page</xsl:text>
          <xsl:text>&#xa0;</xsl:text>
          <xsl:value-of disable-output-escaping="no" select="Visit/current_splitted_page"/>
          <xsl:text>&#xa0;</xsl:text>
          <xsl:text>of</xsl:text>
          <xsl:text>&#xa0;</xsl:text>
          <xsl:value-of disable-output-escaping="no" select="Visit/total_page"/>
        </fo:block>
      </fo:block-container>

I'm placing my XML tags like Current_split page and total page the result like

Page 0 of 0

for all pages.

How can I accomplish this?

Cœur
  • 37,241
  • 25
  • 195
  • 267
falak
  • 21
  • 1
  • 2
    possible duplicate of [How to show page number (N of N) using xslt in PDF Report](http://stackoverflow.com/questions/19267255/how-to-show-page-number-n-of-n-using-xslt-in-pdf-report) – Daniel Haley Aug 20 '15 at 19:57

1 Answers1

1

You can get last page number by the following step:

  1. Put @id to the last positioned fo:page-sequence/fo:flow.
  2. Refer it by fo:page-number-citation-last specifying @ref-id value with above fo:flow/@id value.

[Example]

<!-- Last fo:page-sequence -->
<fo:page-sequence>
  ...
  <fo:flow flow-name="xsl-region-body" id="id_last_flow">
    ...
  </fo:flow>
</fo:page-sequence>

[Page number reference example]

<fo:block-container position="absolute" top="3.25in" left="2.9in" height="3.0in" width="7.8in" border-width="0.1in">
    <fo:block span="none" white-space-collapse="false"  font-family="Arial" font-size="10pt" text-align="start">
      <xsl:text>Page</xsl:text>
      <xsl:text>&#xa0;</xsl:text>
      <!--Current page number -->
      <fo:page-number/>
      <xsl:text>&#xa0;</xsl:text>
      <xsl:text>of</xsl:text>
      <xsl:text>&#xa0;</xsl:text>
      <!--Last page number -->
      <fo:page-number-citation-last ref-id="id_last_flow"/>
    </fo:block>
</fo:block-container>
Toshihiko Makita
  • 1,294
  • 1
  • 8
  • 15
  • 1
    The above works in some XSL FO products and not in others who do not support an "id" on flow. If your product does not support "id" on flow then you should drop a block at the very end of the flow with that "id" – Kevin Brown Aug 22 '15 at 08:24