【发布时间】:2012-07-16 22:05:43
【问题描述】:
我正在使用 1.77 xsl 转换将 docbook 转换为 html。但是当它被转换时,它会自动生成一个目录。你如何改变这种行为?
我发现了这个:Disable table of contents for documents
所以我猜测 html xsl 转换将是表示系统?
【问题讨论】:
我正在使用 1.77 xsl 转换将 docbook 转换为 html。但是当它被转换时,它会自动生成一个目录。你如何改变这种行为?
我发现了这个:Disable table of contents for documents
所以我猜测 html xsl 转换将是表示系统?
【问题讨论】:
Elaborate DocBook 格式旨在使用 xsl 样式表进行自定义。
Writing a DocBOok Customization Layer for Formatting
Customizing Table Of Contents Using XSL
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0"> <!-- change this to 2.0 if your tools support it -->
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
<!--uncomment this to suppress toc when using XSL 1.0 or 2.0
<xsl:param name="generate.toc">article</xsl:param>
<xsl:param name="generate.toc">book</xsl:param>
-->
<!--uncomment this to suppress toc when using XSL 2.0
<xsl:param name="generate.toc">
article nop
book nop
</xsl:param>
-->
</xsl:stylesheet>
让您的工具使用customize_formatting.xsl 而不是现成的docbook.xsl。然后,将您的所有格式自定义设置在 <xsl:stylesheet> 部分的正文中。
对于 TOC 抑制,您可以取消注释相应的行。
有些(或者可能是全部)XSL 1.0 工具有一个怪癖,似乎阻止它们处理<xsl:param name="generate.toc"> 正文中使用的空格分隔对。我已经成功地通过使用单个单词 article 或 book 而不是正确的空格分隔对来抑制 TOC。
【讨论】:
转换时,可以使用Transformer#setParameter(String, Object) 方法指定不生成TOC,如下所示:
transformer.setParameter("generate.toc", "nop");
【讨论】: