Reputation: 11
I am using XSLT and XSL-FO for document creation.
I need to introduce multiple sequences of page numbering, i.e main section numbered from 1 to end page, which is broken by two subsequences of corresponding subdocuments, numbered from 1 to end of each of these sections, and after them the main sequence is continued.
The problem I can't overcome is that the subsequences are counted in main sequence, and page number of main section after continuation is incremented page number of previous subsequence.
So I get e.g.
main section | subsection | subsection | continuation of main |
---|---|---|---|
1, 2, 3 | 1, 2 | 1, 2 | 3, 4, 5... |
And I want
main section | subsection | subsection | continuation of main |
---|---|---|---|
1, 2, 3 | 1, 2 | 1, 2 | 4, 5, 6... |
How can I achieve it?
Upvotes: 1
Views: 620
Reputation: 3788
In an FO file, the fo:page-sequence
elements define a flat list of contents to be paginated, so there is no concept of a "main section" containing "subsections".
The initial-page-number property controls how page numbers are computed for a page sequence.
In particular, when a page sequence ends and a new one starts the only available options concerning page numbering are:
There is no way to refer to a different page sequence and say "continue from that".
That said, if your document is not much more complicated than your example you can achieve what you want with a workaround.
This is probably the easiest (and dirtiest) one:
initial-page-number="4"
in the appropriate fo:page-sequence
Slightly more complicated:
fo:page-sequence
elements in the order: (main section) - (continuation of main) - (subsection) - (subsection)initial-page-number
for the "continuation of main" section; for subsections, use initial-page-number="1"
to restart the page numbers (but they are already like this, from your example)A cleaner and fully-automated solution would require using FOP's intermediate format:
A final note: you did not specify why your document needs such a peculiar page numbering and what degree of control you have on this requirement, but I cannot help wondering whether it is confusing for a reader to see page numbers restart that way, and difficult for them to find what they need ("I am told the information I need is on page 2; but which page 2?").
Upvotes: 0