如何在一页上顺序决定新节点的开始以插入不同的 header
How to on one page sequence decide begining of a new node to insert different header
获得正确结果后进行编辑:
好的,我做到了。基本上当我明白@Kevin 真正想要我做什么时,我在主题的开头创建了空标记(使用 keep-with-next),并且在创建主题标题后我将其更改为正常的 header。现在一切正常了。
编辑:
我尝试了@Kevin-Brown的建议,但可能我做错了什么。我将展示最小版本,以给出发生的事情的一般图像。
我得到了:
flow
block with normal header marker
block with keep-with-next always, and empty marker which actually doesnt matter in my case
block with content
和header看起来像:
<fo:block>
<fo:retrieve-marker retrieve-class-name="body-header-marker" retrieve-position="first-including-carryover" retrieve-boundary="page"/>
</fo:block>
问题是 header 并没有真正的结转。因为现在,即使我删除空标记,我在主题页面上也会有 header,而在主题的下一页上我不会有任何内容。然后,我将再次讨论该主题的开头。我做错了什么?
老问题:
我正在使用格式化 Objects,但在相同情况下找到好的(实际上是任何)解决方案时遇到了一些问题。有什么方法可以检查当前正在处理的节点是否实际占用了 2 页?
也许如果我尝试定义问题,您可以提出一些更好的解决方案。我在 xml 中有多个主题,在处理主题期间,我在每个页面上添加了 header 和页脚。我想更改它,不在新主题标题所在的页面(主题从新页面开始)添加header。所以也许有比检查页面更好的方法来做我想做的事。因为我认为由于函数式编程中 "variables" 的不同方法,我可能无法按我想要的方式使用页面。
您可以将每个主题放在单独的 fo:page-sequence
中,并使用 fo:page-sequence-master
(http://www.w3.org/TR/xsl11/#fo_page-sequence-master) 到 select 不同的 fo:simple-page-master
只是第一个页。你可以做到 page-master 有不同的 header.
请参阅 http://www.antennahouse.com/antenna1/comprehensive-xsl-fo-tutorials-and-samples-collection/ 中的 'Switching the layout in facing pages automatically (page-sequence-master)',尽管您可能希望在 page-position="first"
上 select 而不是 odd-or-even
。
你想要的伪标记的一般原则是这样的:
block-container for topic
throw marker containing the header for the topic
... content of topic ...
end block-container for topic
block-container with empty marker keep-with-next as "always"
throw marker with nothing in it (basically clear the marker)
end block-container with empty marker
block-container for topic
throw marker containing the header for the topic
... content of topic ...
end block-container for topic
... and so on ...
所以你将标记 first-including-carryover 拉到你的 header 中。这意味着其 parent 容器从顶部开始或从最后一页开始的第一个标记。
如果您的页面与主题的开头完美契合,则页面上的第一个标记将为空白。这是因为您将空标记 block-container 粘贴到每个主题的开头。此结构中没有内容,它不会破坏您的输出。我没有在上面显示将空标记容器放在第一个主题上方,但如果您愿意,也可以这样做。
如果您的页面在主题内中断,则将拉取 "carryover" 标记,这将拉取上一页主题的 header。通常这个标记会在末尾包含类似“- 继续”的内容。
获得正确结果后进行编辑:
好的,我做到了。基本上当我明白@Kevin 真正想要我做什么时,我在主题的开头创建了空标记(使用 keep-with-next),并且在创建主题标题后我将其更改为正常的 header。现在一切正常了。
编辑:
我尝试了@Kevin-Brown的建议,但可能我做错了什么。我将展示最小版本,以给出发生的事情的一般图像。
我得到了:
flow
block with normal header marker
block with keep-with-next always, and empty marker which actually doesnt matter in my case
block with content
和header看起来像:
<fo:block>
<fo:retrieve-marker retrieve-class-name="body-header-marker" retrieve-position="first-including-carryover" retrieve-boundary="page"/>
</fo:block>
问题是 header 并没有真正的结转。因为现在,即使我删除空标记,我在主题页面上也会有 header,而在主题的下一页上我不会有任何内容。然后,我将再次讨论该主题的开头。我做错了什么?
老问题:
我正在使用格式化 Objects,但在相同情况下找到好的(实际上是任何)解决方案时遇到了一些问题。有什么方法可以检查当前正在处理的节点是否实际占用了 2 页?
也许如果我尝试定义问题,您可以提出一些更好的解决方案。我在 xml 中有多个主题,在处理主题期间,我在每个页面上添加了 header 和页脚。我想更改它,不在新主题标题所在的页面(主题从新页面开始)添加header。所以也许有比检查页面更好的方法来做我想做的事。因为我认为由于函数式编程中 "variables" 的不同方法,我可能无法按我想要的方式使用页面。
您可以将每个主题放在单独的 fo:page-sequence
中,并使用 fo:page-sequence-master
(http://www.w3.org/TR/xsl11/#fo_page-sequence-master) 到 select 不同的 fo:simple-page-master
只是第一个页。你可以做到 page-master 有不同的 header.
请参阅 http://www.antennahouse.com/antenna1/comprehensive-xsl-fo-tutorials-and-samples-collection/ 中的 'Switching the layout in facing pages automatically (page-sequence-master)',尽管您可能希望在 page-position="first"
上 select 而不是 odd-or-even
。
你想要的伪标记的一般原则是这样的:
block-container for topic
throw marker containing the header for the topic
... content of topic ...
end block-container for topic
block-container with empty marker keep-with-next as "always"
throw marker with nothing in it (basically clear the marker)
end block-container with empty marker
block-container for topic
throw marker containing the header for the topic
... content of topic ...
end block-container for topic
... and so on ...
所以你将标记 first-including-carryover 拉到你的 header 中。这意味着其 parent 容器从顶部开始或从最后一页开始的第一个标记。
如果您的页面与主题的开头完美契合,则页面上的第一个标记将为空白。这是因为您将空标记 block-container 粘贴到每个主题的开头。此结构中没有内容,它不会破坏您的输出。我没有在上面显示将空标记容器放在第一个主题上方,但如果您愿意,也可以这样做。
如果您的页面在主题内中断,则将拉取 "carryover" 标记,这将拉取上一页主题的 header。通常这个标记会在末尾包含类似“- 继续”的内容。