Docbook转pdf技巧-选择正确的TOC页种类

Docbook转pdf时,可以自由选择想要生成的TOC页种类。一般是通过修改fop(docbook转pdf工具)的配置参数来完成。

官方默认的TOC页配置参数如下:

<xsl:param name="generate.toc">
/appendix toc,title
article/appendix  nop
/article  toc,title
book      toc,title,figure,table,example,equation
/chapter  toc,title
part      toc,title
/preface  toc,title
reference toc,title
/sect1    toc
/sect2    toc
/sect3    toc
/sect4    toc
/sect5    toc
/section  toc
set       toc,title
</xsl:param>

book标签后面用逗号隔开的字串,就是用来控制生成的索引页种类的。
接下来,你可以根据自己的需求,修改下这个字串。
按照多数技术文档的惯例,它们会在这里去掉figure,table,example,equation这些索引页,只保留Table of Content和Title。
修改后的配置如下:

<xsl:param name="generate.toc">
/appendix toc,title
article/appendix  nop
/article  toc,title
book      toc,title
/chapter  toc,title
part      toc,title
/preface  toc,title
reference toc,title
/sect1    toc
/sect2    toc
/sect3    toc
/sect4    toc
/sect5    toc
/section  toc
set       toc,title
</xsl:param>

最后,将上面的配置添加到 FOP 的渲染xsl里即可。

作者:Ken Wu 原文链接:http://kenwublog.com/docbook2pdf-choose-your-correct-toc

2010/07/20 | Posted in Others
No comments yet.

Leave a comment

Attention: Java syntax highlighting is enable. For example: <pre lang="java"> class A {} </pre>