falak
falak

Reputation: 21

How can i number the N of N page in XSL if i have unknown total pages

<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?

Upvotes: 2

Views: 551

Answers (1)

Toshihiko Makita
Toshihiko Makita

Reputation: 1304

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>

Upvotes: 1

Related Questions