We use XSL-FO for creating PDFs. Users of our application can select if the want the PDF to contain certain blocks or not. This is implemented using conditions in the XML files.
While the default orientation is portrait, some of these optional blocks require landscape orientation.
Sometimes there is an optional portrait block between two optional landscape blocks.
We consoder portrait to be the default, thus inside every optional landscape block there is an initial
</fo:page-sequence> to end the previous portrait block's page sequence followed by a <fo:page-sequence ...> with reference to our landscape master. And the end of the landscape blocks we similarly switch back to portrait because normally there will be a portrait block thereafter.
But that's not always the case because portrait blocks can also be skipped.
We thus sometimes end up with
<fo:page-sequence initial-page-number='1' master-reference='A4-LZ-portrait'>
<!-- content-->
</fo:page-sequence>
<fo:page-sequence initial-page-number='auto' force-page-count='no-force'
master-reference='A4-GA-landscape'>
<!-- content-->
</fo:page-sequence>
<fo:page-sequence initial-page-number='1' master-reference='A4-LZ-portrait'>
<!-- NO content, this is just due to switching back to portrait -->
</fo:page-sequence>
<fo:page-sequence initial-page-number='auto' force-page-count='no-force'
master-reference='A4-GA-landscape'>
<!-- content-->
</fo:page-sequence>
The "no content" page-sequence causes an empty page. How can we get rid of this page?
Sidenote: There are always headers and footers for pages in any orientation.
An empty
fo:page-sequenceis not covered by XSL 1.1.In general, I would recommend modifying your application so that you don't generate empty
fo:page-sequence. However, you can do handle them using Antenna House Formatter because it explicitly allows an emptyfo:page-sequence(https://www.antenna.co.jp/AHF/help/en/ahf-ext.html#empty-page-sequence).XSL formatters can also run an initial XSLT transformation (which might default to using an XSLT 1.0 processor). You could instead write some XSLT to remove the empty
fo:page-sequencebefore formatting.