【发布时间】:2011-01-12 22:55:51
【问题描述】:
我正在尝试生成带有 pdf 生成的 mod 规范。我生成它的方式是使用如下所示的 contents.xml 文件...
<?xml version="1.0" encoding="UTF-8"?>
<article xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://docbook.org/ns/docbook http://schema.5d.ca/docbook/docbook.xsd
http://www.w3.org/2001/XInclude http://schema.5d.ca/docbook/XInclude.xsd">
<title>Mod Spec</title>
<?dbfo-need height="8in" space-before="3em" ?>
<xi:include href="first.xml"/>
<section>
<title>View Stuff</title>
<xi:include href="./stuff/panel.xml"/>
</section>
<section>
<title>Nav things</title>
<xi:include href="./things/about.xml"/>
<xi:include href="./things/control.xml"/>
<xi:include href="./things/launch.xml"/>
</section>
...(more sections with includes)
</article>
现在我还有一个样式表,用于在为 XSL-FO 发送上述 xml 之前设置页眉、页脚和表格样式,并且此样式表将需要添加分页符。
所以我的问题是:如何在 contents.xml 中的所有单独的 modspecs 之间添加分页符?
编辑 http://www.sagehill.net/docbookxsl/PageBreaking.html 声明我应该将此添加到我的 XSLT:
<xsl:template match="processing-instruction('hard-pagebreak')">
<fo:block break-after='page'/>
</xsl:template>
这样它就会在 .xml 文件中获取<?hard-pagebreak?>。我想使解决方案尽可能紧凑,那么如何编辑我的样式表,以便第一次通过将在每个 <xi:include> 之后添加 <?hard-pagebreak?>,然后是给定我的 sagehill 的模板?
【问题讨论】:
-
@Ace:如果“分页符”是指 XSL-FO 分页符,那么这与 XSLT 本身无关。
-
@Alejandro:也许我太天真了,但是有一个“新页面”或“分页符”字符会产生效果吗?
-
@Ace:这将是一个公平的 DocBook 问题......
-
@Alejandro:是的,但样式表将是我实现此更改的唯一方法,无论是修复 content.xml 还是所有其他 .xml 文件
-
@Ace:也许,但首先您需要知道要使用的特定 XML 词汇表的元素。