I need to print different headers on certain pages, that our sorting machine knows how to handle the pages:

First page: X

First page when last page: Y

Following pages: X

Following page when last page: Y

So basicly when the machine „reads“ an Y in the header, it knows  to sort tha pages away and start a new stack.

 Im working with FOP 0.20.5.  I tried to work with page-sequences for about a week but thats does not work form me.


    <fo:page-sequence-master master-name="SeitenSequenz">


       <fo:conditional-page-master-reference master-reference="first-page" page-position="first"/>

       <fo:conditional-page-master-reference master-reference="following-pages" page-position="rest"/>

       <fo:conditional-page-master-reference master-reference="last-page" page-position="last"/>




If i go with this i get first page:X, 2nd and 3rd page get: Y.

Is it a good idea to work with different headers or are their other possibilities?


With best regards