I had a problem that a client wanted a report such that the page number in the header would reset every time there was a new order number. At the same time, the client wanted a running page number on the footer.
This was tricky because it is easy to have one or the other but not both. Hok Min (sp?) from Oracle Product Support provided me with a solution. Here his the code he gave me:
<fo:page-number xdofo:report-page-number="true"/>
The problem with using this code is that for it to work, it has to go in a form field. This presents a problem because headers and footers cannot have form fields in an RTF template. The work around is to define a subtemplate and to call the subtemplate from the footer. Understand that subtemplates do not have to be on a separate RTF template but they can exist on the same RTF template. When I do it this way, I usually put the definitions at the end of the RTF template that I am working on.
Here is the definition of the subtemplate:
<?template:pageno?>TotPageNo<?end template?>
The form field contains the code above in the blue text.
Now to use it in a footer:
--------------------------------------------------------------------------------------
footer section
<?call:pageno?>