我写了一个带有标题的docbook 5.0文档:
<?xml version="1.0" encoding="UTF-8"?>
<book version="5.0" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:db="http://docbook.org/ns/docbook">
Run Code Online (Sandbox Code Playgroud)
和Ubuntu 9.10上的docbook2pdf打印许多错误消息,并且不执行任何pdf文档.错误是:
openjade:test.xml:2:0:E: prolog can't be omitted unless CONCUR NO and LINK EXPLICIT NO and either IMPLYDEF ELEMENT YES or IMPLYDEF DOCTYPE YES
openjade:test.xml:2:0:E: no document type declaration; will parse without validation
openjade:/usr/share/sgml/docbook/stylesheet/dsssl/modular/print/dbtitle.dsl:18:5:E: flow objects at the root must be all of class scroll or all of class page-sequence or simple-page-sequence
openjade:/usr/share/sgml/docbook/stylesheet/dsssl/modular/print/dbbibl.dsl:704:4:E: flow objects at the root must be all of class scroll or all of …Run Code Online (Sandbox Code Playgroud) 我有一个docbook文档,当我创建PDF时,我希望它显示章节标题,而不是前面的"章节".根据这个,以下应该工作:
我的自定义样式表:(doc.xsl)
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
<xsl:import
href="/usr/share/xml/docbook/stylesheet/docbook-xsl-ns/fo/docbook.xsl"/>
<xsl:param name="local.l10n.xml" select="document('')"/>
<l:l18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
<l:l10n language="en">
<l:context name="title-numbered">
<l:template name="chapter" text="%n. %t"/>
</l:context>
</l:l10n>
</l:l18n>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)
当我使用这个文档时:(doc.xml)
<book xmlns="http://docbook.org/ns/docbook" version="5.0"
xml:lang="en">
<title>Doc</title>
<chapter>
<title>Introduction</title>
<section>
<title>Purpose of the document</title>
<para></para>
</section>
</chapter>
</book>
Run Code Online (Sandbox Code Playgroud)
和这些命令:
xsltproc doc.xsl doc.xml > doc.fo
fop -fo doc.fo -pdf fo.pdf
Run Code Online (Sandbox Code Playgroud)
生成的PDF在名为"简介"的章节前面仍然有"第1章".
我尝试了不同的上下文名称,如"title",但它不起作用.我做错了什么或如何调试此问题?
更新
我发现了问题.这条线l:l18n应该是l:i18n......
我试图使用 xi:include 将 a.xml 元素的所有子元素(部分)包含到 b.xml 中。这两个 XML 文件都是有效的 docbook 5 文件。
xml文件
<chapter xml:id="TheChapter">
<section>
<title>section 1</title>
</section>
<section>
<title>section 2</title>
</section>
<section>
<title>section 3</title>
</section>
</chapter>
Run Code Online (Sandbox Code Playgroud)
b.xml
<section>
<xi:include href="a.xml" xpointer="element(/TheChapter/*)"/>
</section>
Run Code Online (Sandbox Code Playgroud)
我正在使用 XMLMind,它报告错误。
cannot parse inclusion directive: cannot parse XPointer "element(/TheChapter/*)": "/TheChapter/*", XPointer element() scheme syntax error
Run Code Online (Sandbox Code Playgroud)
我对 element() 方案的使用不正确吗?