xsl fo - XSL-FO page-master-alternatives sometimes exhausted -


i have bit robust stylesheet books. @ moment, can’t figure out problem. stylesheet works, not, depending on toc’s lenght, can change dynamically number of levels want include in it.

my stylesheets work way (my intention is):

let imprints part starts on title-page, ends on page, if last page of toc odd, put there blank page after it:

        <fo:page-sequence-master master-name="imprints">             <fo:repeatable-page-master-alternatives>                 <fo:conditional-page-master-reference master-reference="pagemaster.blank" blank-or-not-blank="blank" page-position="any"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.title-page" odd-or-even="odd" page-position="first"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.copyright-page" odd-or-even="even" page-position="rest"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.toc" odd-or-even="odd" page-position="rest"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.toc" odd-or-even="even" page-position="rest"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.toc" odd-or-even="odd" page-position="last"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.toc" odd-or-even="even" page-position="last"/>             </fo:repeatable-page-master-alternatives>         </fo:page-sequence-master> 

let main part, content-pages, starts on first odd page after toc (or blank page after it), let every chapter starts on odd page after previous chapter (last page or blank) , ends on page. if last page should odd, force blank page (here suppose problem because work whole part particular chapters):

        <fo:page-sequence-master master-name="content-pages">             <fo:repeatable-page-master-alternatives>                 <fo:conditional-page-master-reference master-reference="pagemaster.page-right.first" odd-or-even="odd" page-position="first"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.blank" blank-or-not-blank="blank" page-position="any"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.page-left" odd-or-even="even" page-position="rest"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.page-right" odd-or-even="odd" page-position="rest"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.page-left" odd-or-even="even" page-position="last"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.page-right" odd-or-even="odd" page-position="last"/>             </fo:repeatable-page-master-alternatives>         </fo:page-sequence-master> 

i call them way (i not sure difference between force-page-count="even" , force-page-count="end-on-even". have checked docs still unclear me):

    <fo:page-sequence master-reference="imprints" force-page-count="even">         <fo:flow flow-name="xsl-region-body">             <fo:block>                 <xsl:apply-templates select="//tei:tei/tei:teiheader" mode="draft"/>             </fo:block>         </fo:flow>     </fo:page-sequence>     <fo:page-sequence master-reference="pagemaster.copyright-page">         <fo:flow flow-name="xsl-region-body">             <fo:block xsl:use-attribute-sets="p">                 © copyright!             </fo:block>         </fo:flow>     </fo:page-sequence>     <fo:page-sequence master-reference="pagemaster.toc">         <fo:flow flow-name="xsl-region-body">             <fo:block>                 <xsl:apply-templates select="//tei:tei/tei:text" mode="toc"/>             </fo:block>         </fo:flow>     </fo:page-sequence>     <xsl:for-each select="//tei:div[@n='1']">         <fo:page-sequence master-reference="content-pages" force-page-count="end-on-even">             <fo:static-content flow-name="region-before-left">                 <fo:block xsl:use-attribute-sets="running-header-left">                     <fo:inline xsl:use-attribute-sets="running-header-pageno-left">                         <fo:page-number/>                     </fo:inline>                 </fo:block>             </fo:static-content><!-- running header right -->             <fo:static-content flow-name="region-before-right">                 <fo:block xsl:use-attribute-sets="running-header-right">                     <fo:inline xsl:use-attribute-sets="running-header-pageno-right">                         <fo:page-number/>                     </fo:inline>                 </fo:block>             </fo:static-content>             <fo:static-content flow-name="xsl-footnote-separator">                 <fo:block>                     <fo:leader xsl:use-attribute-sets="footnote-separator"/>                 </fo:block>             </fo:static-content>             <fo:flow flow-name="xsl-region-body">                 <xsl:apply-templates select="."/>             </fo:flow>         </fo:page-sequence>     </xsl:for-each> 

when fails , throws subsequences exhausted in page-sequence-master "content-pages", cannot recover. (no context info available), helps change force-page-count or add 1 reference pagemaster.page-right.first , make possible on even pages. chapters start on odd pages have page numbers (which should not). confusing.

even adding:

<fo:conditional-page-master-reference master-reference="pagemaster.page-right.first" odd-or-even="odd" page-position="rest"/> 

… not help.

i use last saxon , apache fop 1.1.

update

progress according @tony_graham:

        <fo:page-sequence-master master-name="imprints">             <fo:repeatable-page-master-alternatives>                 <fo:conditional-page-master-reference master-reference="pagemaster.title-page" odd-or-even="odd" page-position="first"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.copyright-page" odd-or-even="even" page-position="rest"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.toc"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.blank" blank-or-not-blank="blank"/>             </fo:repeatable-page-master-alternatives>         </fo:page-sequence-master>         <fo:page-sequence-master master-name="content-pages">             <fo:repeatable-page-master-alternatives>                 <fo:conditional-page-master-reference master-reference="pagemaster.page-right.first" odd-or-even="odd" page-position="first"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.page-left" odd-or-even="even" page-position="rest"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.page-right" odd-or-even="odd" page-position="rest"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.page-left" odd-or-even="even" page-position="last"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.page-right" odd-or-even="odd" page-position="last"/>                 <fo:conditional-page-master-reference master-reference="pagemaster.blank" blank-or-not-blank="blank"/>             </fo:repeatable-page-master-alternatives> 

and rest:

<fo:page-sequence master-reference="imprints" force-page-count="end-on-even"> ...  <fo:page-sequence master-reference="pagemaster.copyright-page" initial-page-number="auto-odd"> ... 

put force-page-count="end-on-even" on fo:page-sequence before every fo:page-sequence want start on odd page. alternatively, set initial-page-number="auto-odd" on fo:page-sequence. see https://www.w3.org/tr/xsl11/#initial-page-number

force-page-count="even" means if page-sequence started on page, end on odd page make number of pages, , vice-versa if started on odd page. force-page-count="end-on-even" finish on odd page irrespective of if page-sequence started on odd or page. (ah formatter has extensions end on 'doubly-even', , more besides, , force page count entire document end on page, etc. see https://www.antennahouse.com/product/ahf63/ahf-ext.html#axf.force-page-count) however, it's initial-page-number need.

also:

  1. you don't need repeat fo:conditional-page-master-reference 2 different odd-or-even select same page-master. that's same 1 fo:conditional-page-master-reference no odd-or-even since default value any. see https://www.w3.org/tr/xsl11/#odd-or-even.
  2. you can drop explicit page-position="any" since that's default anyway.
  3. "imprints" has 2 'odd-or-even="even" page-position="rest"', second never used.
  4. selecting same "pagemaster.toc" odd/even , rest/last reduced page-position="any".

update

you can change current fo:page-sequence-masters to:

    <fo:page-sequence-master master-name="imprints">         <fo:repeatable-page-master-alternatives>             <fo:conditional-page-master-reference master-reference="pagemaster.blank" blank-or-not-blank="blank"/>             <fo:conditional-page-master-reference master-reference="pagemaster.title-page" page-position="first"/>             <fo:conditional-page-master-reference master-reference="pagemaster.copyright-page" odd-or-even="even" page-position="rest"/>             <fo:conditional-page-master-reference master-reference="pagemaster.toc"/>         </fo:repeatable-page-master-alternatives>     </fo:page-sequence-master>     <fo:page-sequence-master master-name="content-pages">         <fo:repeatable-page-master-alternatives>             <fo:conditional-page-master-reference master-reference="pagemaster.blank" blank-or-not-blank="blank"/>             <fo:conditional-page-master-reference master-reference="pagemaster.page-right.first" page-position="first"/>             <fo:conditional-page-master-reference master-reference="pagemaster.page-left" odd-or-even="even"/>             <fo:conditional-page-master-reference master-reference="pagemaster.page-right" odd-or-even="odd"/>         </fo:repeatable-page-master-alternatives> 

within fo:repeatable-page-master-alternatives, "the conditions tested in order beginning of sequence of children", want put least alternatives first. (see https://www.w3.org/tr/xsl11/#fo_repeatable-page-master-alternatives) want have catch-all alternative @ end, you've got covered.

however, don't understand why "imprints" includes "pagemaster.copyright-page" , "pagemaster.toc" when copyright page , toc each in separate page-sequences refer specific page-masters. may want more like:

    <fo:page-sequence-master master-name="imprints">         <fo:repeatable-page-master-alternatives>             <fo:conditional-page-master-reference master-reference="pagemaster.blank" blank-or-not-blank="blank"/>             <fo:conditional-page-master-reference master-reference="pagemaster.title-page"/>         </fo:repeatable-page-master-alternatives>     </fo:page-sequence-master>     <fo:page-sequence-master master-name="toc">         <fo:repeatable-page-master-alternatives>             <fo:conditional-page-master-reference master-reference="pagemaster.blank" blank-or-not-blank="blank"/>             <fo:conditional-page-master-reference master-reference="pagemaster.toc"/>         </fo:repeatable-page-master-alternatives>     </fo:page-sequence-master>     <fo:page-sequence-master master-name="copyright-page">         <fo:repeatable-page-master-alternatives>             <fo:conditional-page-master-reference master-reference="pagemaster.blank" blank-or-not-blank="blank"/>             <fo:conditional-page-master-reference master-reference="pagemaster.copyright-page"/>         </fo:repeatable-page-master-alternatives>     </fo:page-sequence-master>     <fo:page-sequence-master master-name="content-pages">         <fo:repeatable-page-master-alternatives>             <fo:conditional-page-master-reference master-reference="pagemaster.blank" blank-or-not-blank="blank"/>             <fo:conditional-page-master-reference master-reference="pagemaster.page-right.first" page-position="first"/>             <fo:conditional-page-master-reference master-reference="pagemaster.page-left" odd-or-even="even"/>             <fo:conditional-page-master-reference master-reference="pagemaster.page-right" odd-or-even="odd"/>         </fo:repeatable-page-master-alternatives> ... <fo:page-sequence master-reference="imprints"> ... <fo:page-sequence master-reference="copyright-page" initial-page-number="auto-odd"> ... <fo:page-sequence master-reference="pagemaster.toc" initial-page-master="auto-odd"> ... <xsl:for-each select="//tei:div[@n='1']">     <fo:page-sequence master-reference="content-pages" initial-page-number="auto-odd"> 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -