多个同名fo:retrieve-marker检索疑问:区域体标记会被哪个页脚调用?
FO标记检索规则问题解答
问题场景
现有两个页脚的<fo:retrieve-marker>拥有相同的retrieve-class-name、retrieve-boundary和retrieve-position属性,当xsl-region-body中的<fo:marker>调用该marker-class-name时,会被哪个页脚检索到?
示例代码
<fo:static-content flow-name="second-page-footer" font-family="normal" font-style="normal" font-size="4"> <fo:retrieve-marker retrieve-class-name="continued" retrieve-position="last-starting-within-page" retrieve-boundary="page"/> <fo:block-container position="absolute" top="20mm"> <xsl:call-template name="pageTwoFooter"/> </fo:block-container> </fo:static-content> <fo:static-content flow-name="rest-page-footer" font-family="normal" font-style="normal" font-size="4"> <fo:retrieve-marker retrieve-class-name="continued" retrieve-position="last-starting-within-page" retrieve-boundary="page"/> </fo:static-content> <fo:flow flow-name="xsl-region-body" font-size="8pt" font-family="normal" font-style="normal" font-weight="normal"> <fo:marker marker-class-name="continued"> <xsl:call-template name="continuedNextPage"/> </fo:marker> </fo:flow>
规则解析与答案
只有当前页面实际使用的页脚static-content会检索到该marker,具体逻辑如下:
- XSL-FO中的
static-content是和特定页面的区域绑定的,示例里的second-page-footer对应第二页的页脚区域,rest-page-footer对应第三页及以后的页脚区域 - 每个页面只会渲染分配给它的static-content:
- 第二页时,
second-page-footer里的<fo:retrieve-marker>会匹配同页面body中的continued标记 - 第三页及后续页面时,
rest-page-footer里的<fo:retrieve-marker>会匹配对应页面body中的continued标记
- 第二页时,
- 核心规则:标记检索是页面上下文绑定的,不同页面的static-content不会互相干扰,也不会同时触发检索,只有当前页面激活的页脚组件才会执行标记检索操作。
内容的提问来源于stack exchange,提问作者Rito Sarkar
相关产品推荐
相关产品推荐

