XSL-FO fo:repeatable-page-master-alternatives not working properly

前端 未结 1 1637
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-21 01:44

I want to add the page number in footer if the number of pages is more than one, but not for if there is only one page.

I tried the following code but it shows the page

1条回答
  •  情书的邮戳
    2021-01-21 02:42

    Your second alternative works for me with both FOP 2.0 and FOP 2.2:

    
        
            
            
        
    
    

    Did you try it with enough content to make a second page? E.g., add content to force a second page.

    If you change the 'content' text in your fo:static-content for the fo:region-after then you'll get a better idea of which fo:conditional-page-master-reference is being used; e.g.:

    
       after single
    
    

    The way that fo:conditional-page-master-reference (https://www.w3.org/TR/xsl11/#fo_conditional-page-master-reference) works is that it is selected if it is the first alternative for which all of its sub-conditions are true. If there is enough content to make a second page, then the page-position="only" sub-condition is no longer true, so the formatter should try again with other alternatives.

    The formatter should try again because if it doesn't, then the fo:repeatable-page-master-alternatives (https://www.w3.org/TR/xsl11/#fo_repeatable-page-master-alternatives) doesn't satisfy its constraints (my emphasis):

    The sub-sequence of pages mapped to this sub-sequence-specifier satisfies the constraints of this sub-sequence-specifier if (a) the sub-sequence of pages consists of zero or more pages, (b) each page is generated using the fo:simple-page-master referenced by the one of the alternatives that are the children of the fo:repeatable-page-master-alternatives, (c) the conditions on that alternative are true, (d) that alternative is the first alternative in the sequence of children for which all the conditions are true, and (e) the length of the sub-sequence is less than or equal to the value of 'maximum-repeats'.

    0 讨论(0)
提交回复
热议问题