Your second alternative works for me with both FOP 2.0 and FOP 2.2:
<fo:page-sequence-master master-name="allPages">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position="only" master-reference="singlePage"/>
<fo:conditional-page-master-reference page-position="any" master-reference="multiPage"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
Did you try it with enough content to make a second page? E.g., add <fo:block break-before="page">content</fo:block>
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.:
<fo:static-content flow-name="xsl-region-after-single">
<fo:block>after single</fo:block>
</fo:static-content>
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'.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…