I have a document consisting of multiple sub-documents. Here is how a sub-document looks like:
1 page
2-n pages
Then comes the next sub-document with the same structure:
1 page
2-m pages
As I said, those sub-documents are combined in a single .pdf file.
Here is my xsl-fo tempalte:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<fo:root font-size="11pt" font-family="serif">
<fo:layout-master-set>
<fo:simple-page-master master-name="A4-portrait"
page-height="29.7cm" page-width="21.0cm" margin-top="1cm"
margin-left="1.5cm" margin-right="1cm" margin-bottom="1cm">
<fo:region-body />
<fo:region-after region-name="footer" extent="15mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<!-- first sub-document -->
<fo:page-sequence master-reference="A4-portrait" initial-page-number="1">
...........
<fo:block text-align="center">
Page <fo:page-number/>/<fo:page-number-citation-last ref-id="end"/>
</fo:block>
...........
</fo:page-sequence>
<fo:page-sequence master-reference="A4-portrait" id="end">
...........
<fo:block text-align="center">
Page <fo:page-number/>/<fo:page-number-citation-last ref-id="end"/>
</fo:block>
...........
</fo:page-sequence>
<!-- second sub-document -->
<fo:page-sequence master-reference="A4-portrait" initial-page-number="1">
...........
<fo:block text-align="center">
Page <fo:page-number/>/<fo:page-number-citation-last ref-id="end"/>
</fo:block>
...........
</fo:page-sequence>
<fo:page-sequence master-reference="A4-portrait" id="end">
...........
<fo:block text-align="center">
Page <fo:page-number/>/<fo:page-number-citation-last ref-id="end"/>
</fo:block>
...........
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
So, I have 2 identical blocks consisting of 2 page-sequences each. In my example, let's say sub-document 1 has 4 pages (n=4) and sub-document 2 has 2 pages (m=2). Here are the page numbers that I get:
1/4
2/4
3/4
4/4
1/4
2/2
Everything is OK, except the first page of the second sub-document. At that point, <fo:page-number-citation-last ref-id="end"/>
returns 4, which is the value from sub-document 1. So, instead of 1/2
, I get 1/4
.
Any suggestions how I can fix this?