The fo:page-number-citation is used to reference the page-number for the page containing the first normal area returned by the cited formatting object.
Cited formatting Object must resolve to an Object in the output to trace the page in question
The cited page is the page containing, as a descendant, the first normal area returned by the formatting object with an id trait matching the ref-id trait of the fo:page-number-citation (the referenced formatting object).
You can add page number citation (or any other fo:markup) to your layout using TextBox.
The following example illustrates a page x of n citation using a "last-page" identifier ..
<fo:page-number/> of <fo:page-number-citation ref-id="last-page"/> Pages
XSL:FO
To Ensure this working, a textbox must be added to the output after the last output flow Object.
In this example, adding a TextBox With the following content will ensure a valid last page citation.
<xsl:attribute name="id">last-page</xsl:attribute>
XSLT