正文流与重复静态内容
让长正文真正跨页,并把页眉页脚放到正确区。
学完这一章,你能够
- 让长正文真正跨页,并把页眉页脚放到正确区。
- 让长正文真正跨页,并把页眉页脚放到正确区。
一条flow可以填充多页
page-sequence描述一组页面的内容和选择模板规则,通常不是“一个page-sequence只对应一张纸”。主flow按布局不断分配内容;当前页放不下时,由模板规则选择后续页面。
simple-page-master可以重复,也可由page-sequence-master组合首页、奇偶页等选择条件。声明了left/right两个名字,不会自动启用交替规则。
flow-name需要匹配区名
主flow通常flow-name="xsl-region-body"。xsl-region-before/after/start/end是常见静态内容目标,应由相应static-content绑定,而不是声称任意主flow都可直接流入所有五区。
自定义region-name允许改变名字;无论默认或自定义,都须按对象内容模型和目标区类别使用。原始资料列出的五个名字保留解释,同时纠正把主体流与静态内容混同的教学方式。
验证跨页行为
本章自有长文档包含编号行,页眉重复品牌、页脚使用page-number。必须实际产生至少两页,逐页检查重复页眉与递增页码,并核对首尾正文没有被遗漏或覆盖。
文本抽取可能改变视觉顺序,因此还要检查区域树与渲染图。重复页眉不是把内容复制进业务XML每一行,也不能只截图第一页就宣布分页成功。
结构、取值与适用条件
| 项目 | 语法/值 | 独立用途 | 条件/边界 |
| 主体 | flow-name=xsl-region-body | 正文自动跨页 | 不是一个sequence只一页 |
| 前/后侧 | static-content → xsl-region-before/after | 重复页眉/页脚 | 与region-name匹配 |
| 起/止侧 | static-content → xsl-region-start/end | 静态侧栏 | 方向依writing-mode |
| page-number | 当前页编号 | 逐页观察Page1..N | 编号规则受序列属性影响 |
| master重复 | page-sequence-master等 | 选后续页模板 | 不会自动把left/right按名字交替 |
本章全部独立FO输入与预期
| 项目 | 语法/值 | 独立用途 | 条件/边界 |
| 1 | fo/flow.fo | Learning line 001;Learning line 100 | 真实页数、尺寸、内容与具体条件检查 |
本章独立核心源码与验证步骤
展开查看收起
python
from fo_lab import run_cases
SCENARIOS = [{'id': '1',
'file': 'fo/flow.fo',
'expected_text': ['Learning line 001', 'Learning line 100'],
'min_pages': 3,
'repeated_header': 'MBSKY repeated header',
'page_numbers': True}]
if __name__ == "__main__":
run_cases('xslfo-flow', SCENARIOS)
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 本章1项输入分别得到明确结果:fo/flow.fo应生成实际PDF
- 尺寸与页数按本章条件核对;不能把本轮实例通过推断为56对象全支持。
完整FO输入:flow.fo
展开查看收起
xml
<?xml version="1.0" encoding="UTF-8"?><fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="Helvetica" font-size="11pt" line-height="15pt" ><fo:layout-master-set><fo:simple-page-master master-name="body" page-width="210mm" page-height="297mm" margin="18mm"><fo:region-body margin-top="14mm" margin-bottom="14mm"/><fo:region-before extent="10mm"/><fo:region-after extent="10mm"/></fo:simple-page-master></fo:layout-master-set><fo:page-sequence master-reference="body"><fo:static-content flow-name="xsl-region-before"><fo:block >MBSKY repeated header</fo:block></fo:static-content><fo:static-content flow-name="xsl-region-after"><fo:block >Page <fo:page-number/></fo:block></fo:static-content><fo:flow flow-name="xsl-region-body"><fo:block font-size="18pt" color="#2563eb" space-after="8mm">MBSKY | mbsky.com</fo:block><fo:block space-after="2mm">Learning line 001: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 002: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 003: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 004: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 005: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 006: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 007: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 008: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 009: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 010: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 011: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 012: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 013: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 014: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 015: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 016: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 017: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 018: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 019: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 020: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 021: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 022: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 023: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 024: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 025: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 026: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 027: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 028: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 029: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 030: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 031: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 032: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 033: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 034: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 035: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 036: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 037: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 038: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 039: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 040: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 041: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 042: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 043: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 044: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 045: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 046: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 047: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 048: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 049: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 050: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 051: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 052: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 053: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 054: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 055: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 056: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 057: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 058: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 059: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 060: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 061: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 062: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 063: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 064: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 065: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 066: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 067: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 068: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 069: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 070: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 071: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 072: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 073: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 074: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 075: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 076: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 077: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 078: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 079: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 080: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 081: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 082: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 083: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 084: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 085: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 086: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 087: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 088: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 089: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 090: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 091: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 092: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 093: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 094: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 095: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 096: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 097: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 098: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 099: observe every page, not only the first.</fo:block><fo:block space-after="2mm">Learning line 100: observe every page, not only the first.</fo:block></fo:flow></fo:page-sequence></fo:root>
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- Learning line 001;Learning line 100
本章附件与实例包
课程关联工程包(登记关联13章) · 含当前章节或实例 · mbskycom202611a543.zip
常见错误与边界检查
- 混淆业务XML、XSLT、FO输入、区域树和最终PDF。
- 把flow误用于所有页眉页脚,或模板名自动等同纸张尺寸。
- 只写边框宽度不写样式、表格顺序不合法、逻辑方向固定解释为物理左右。
技术规范与官方资料
练习与参考解答
查看参考解答
按具体处理器和对象适用性分析;替代实现单独说明,不删去未支持对象,不以数量或文字抽取替代视觉核验。