I've written a docbook 5.0 document with the header:
我写了一个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">
and docbook2pdf on Ubuntu 9.10 prints many error messages and doesn't do any pdf document. The errors are:
而docbook2pdf在Ubuntu 9.10上打印了许多错误消息,并且不做任何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 class page-sequence or simple-page-sequence
docbook2pdf for document in the docbook 4.5 format with normal header like:
docbook 4.5格式文件的docbook2pdf格式,一般的页眉如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
works quite OK.
很好的工作。
Is there any way to generate pdf from docbook 5.0?
有办法从docbook 5.0生成pdf吗?
7 个解决方案
#1
30
I see three options (available in Debian/Ubuntu) to generate pdf from docbook:
我看到了三个选项(Debian/Ubuntu中可用)从docbook生成pdf:
-
jade, which provides the docbook2pdf command the asker used. jade is ancient and works with SGML, which predates XML and does not support Unicode; it also lacks support for docbook 5.
jade,它提供了asker所使用的docbook2pdf命令。jade是古老的,并且与SGML一起工作,SGML先于XML,不支持Unicode;它还缺乏对docbook 5的支持。
-
the docbook-xsl stylesheets which go through XSL-FO. docbook-xsl is for docbook 4.5, docbook-xsl-ns is for docbook5. Use fop to go from XSL-FO to PDF. Pipeline: docbook5 —(xsl)—> xml.fo —(fop)—> pdf . Commands involved: xsltproc, fop.
通过XSL-FO的docbook-xsl样式表。docbook-xsl用于docbook 4.5, docbook- ns用于docbook5。使用fop从XSL-FO到PDF。管道:docbook5 -(xsl)- > xml。fo -(fop)- > pdf。命令包括:xsltproc,fop。
-
dblatex, which is primarily targeting docbook4.5 but has been updated for some of docbook5.
dblatex,它的主要目标是docbook4.5,但已经更新了一些docbook5。
xmlto can drive the last two, although it currently defaults to docbook-xsl and not docbook-xsl-ns.
xmlto可以驱动最后两个,尽管它目前默认为docbook-xsl,而不是docbook-xsl-ns。
A quick Docbook5 user guide
Prerequisites
sudo aptitude install docbook5 docbook-xsl-ns xsltproc fop xmlto libxml2-utils xmlstarlet
Validation
xmlstarlet val --err --xsd /usr/share/xml/docbook/schema/xsd/5.0/docbook.xsd book.xml
PDF output
xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl-ns/fo/docbook.xsl book.xml > book.fo
fop -fo book.fo -pdf book.pdf
#2
4
Apart from the header you gave, did you try a smaller example, like this one from the DocBook 5.0: The Definitive Guide ?
除了你给出的标题之外,你是否尝试过一个更小的例子,比如DocBook 5.0: the definitionguide ?
<?xml version="1.0" encoding="UTF-8"?>
<book xmlns='http://docbook.org/ns/docbook'>
<title>An Example Book</title>
<titleabbrev>Example</titleabbrev>
<info>
<legalnotice><para>No notice is required.</para></legalnotice>
<author><personname>
<firstname>Norman</firstname><surname>Walsh</surname>
</personname></author>
</info>
<dedication>
<para>
This book is dedicated to you.
</para>
</dedication>
<preface>
<title>Foreword</title>
<para>
Some content is always required.
</para>
</preface>
<chapter>
<title>A Chapter</title>
<para>
Content is required in chapters too.
</para>
</chapter>
<appendix>
<title>Optional Appendix</title>
<para>
Appendixes are optional.
</para>
</appendix>
</book>
Just rendered it to a PDF through one of my Maven environments. Can you give a small example (or a few separated onces) containing some content, which makes the use of all the additional name spaces necessary.
通过我的一个Maven环境将它呈现为PDF。您能否给出一个包含某些内容的小示例(或几个独立的实例),这使得使用所有附加的名称空间成为必要。
In case the above example does not work, and you are interested in how I have setup my environment read Making DocBook content available in a Maven project site. Just replace the example with the above DocBook 5.0 example. Only the docbkx-maven-plugin
is of interest, in relation to this question. (PS: Some basic knowledge of Java and Maven2 is required for this.)
如果上面的示例不起作用,并且您对如何设置我的环境read使DocBook内容在Maven项目站点中可用感兴趣。用上面的DocBook 5.0示例替换这个示例。关于这个问题,只有docbkx-maven-plugin感兴趣。(PS:这需要一些Java和Maven2的基础知识。)
#3
2
There are significant differences between Docbook 4.5 and 5.0. And those differences can prevent your document from being transformed.
Docbook 4.5和5.0之间存在显著差异。这些差异可以防止文档被转换。
If you want to check the validity of your 5.0 document, you can use the following command line tool :
如果要检查5.0文档的有效性,可以使用以下命令行工具:
-
it's a java tool, so you need to have a recent java runtime environment.
它是一个java工具,所以您需要有一个最近的java运行时环境。
-
the tool is Jing. You can download it from thaiopensource web site. : http://www.thaiopensource.com/relaxng/jing.html
该工具。你可以从thaiopensource网站下载。:http://www.thaiopensource.com/relaxng/jing.html
-
you will also need the relax ng file for docbook 5.0. It is provided with the docbook 5 distribution.
您还需要docbook 5.0的relax ng文件。它提供了docbook 5发行版。
-
run the validation test with the following command line :
java -jar path_to_Jing/jing.jar -t -i path_to_docbook5/docbook.rng document.xml使用以下命令行运行验证测试:java -jar path_to_Jing/jing。jar - t - i path_to_docbook5 / docbook。rng document.xml
If there are some failures, they should be returned this way : Error at URL "file:...../document.xml", line number 211, column number 59: bad value for attribute "id" from namespace "http://www.w3.org/XML/1998/namespace" Elapsed time 968+166=1134 milliseconds
如果有一些失败,它们应该以这样的方式返回:URL中的错误。xml",行号211,列号59:属性“id”的错误值来自名称空间http://www.w3.org/XML/1998/namespace"运行时间968+166=1134毫秒
#4
2
Publican
You can use Publican to publish your DocBook XML in PDF, html, and html-single formats. Publican is used by Red Hat as part of its internal documentation toolchain, and is an open source application hosted by the Fedora project. The tool uses "brands" to achieve a modularity in applying styles to the content being published. This preset manner simusing a wide variety of CMS or documentation tools.
您可以使用Publican以PDF、html和html-单一格式发布DocBook XML。Red Hat使用Publican作为其内部文档工具链的一部分,并且是由Fedora项目托管的开源应用程序。该工具使用“品牌”来实现将样式应用到发布内容的模块化。这种预先设定的方式简化了各种CMS或文档工具。
JBoss Documentation Guide
A good example of the tool in action is the JBoss Press Gang documentation, which is itself a great resource the gives documentation community guidance on the use of DocBook XML in JBoss documentation. The html and PDF versions were generated with Publican.
这个工具的一个很好的例子是JBoss的Press Gang文档,它本身就是一个伟大的资源,它提供了文档社区指南,用于在JBoss文档中使用DocBook XML。html和PDF版本是用Publican生成的。
#5
1
http://docbookpublishing.com supports DocBook 5.0 documents. It is an online service for DocBook to PDF formatting. You can also submit your DocBook documents via the REST API.
http://docbookpublishing.com支持DocBook 5.0文档。它是DocBook到PDF格式的在线服务。您还可以通过REST API提交DocBook文档。
#6
1
Go to Eclipse and install DocBook Editing and Processing for Eclipse (DEP4E) plugin. You can find it by going into marketplace and search for docbook there. This plugin will create an example docbook and can publish in html, pdf, and even ebook.
去Eclipse并为Eclipse (DEP4E)插件安装DocBook编辑和处理。你可以通过进入市场,在那里搜索docbook来找到它。这个插件将创建一个示例docbook,并可以以html、pdf甚至电子书的形式发布。
Or check out the DEP4E web site, read the Quick Starter Guide section 3. Getting Started, to get an idea of it's possibilities.
或查看DEP4E网站,阅读快速入门指南第3节。开始,了解它的可能性。
#7
0
wordpress post to docbook style posts: http://hashfold.com/techfold/wordpress-how-to-generate-docbook-style-posts/
docbook风格的文章:http://hashfold.com/techfold/wordpress-how-to-generate-docbook风格-posts/
#1
30
I see three options (available in Debian/Ubuntu) to generate pdf from docbook:
我看到了三个选项(Debian/Ubuntu中可用)从docbook生成pdf:
-
jade, which provides the docbook2pdf command the asker used. jade is ancient and works with SGML, which predates XML and does not support Unicode; it also lacks support for docbook 5.
jade,它提供了asker所使用的docbook2pdf命令。jade是古老的,并且与SGML一起工作,SGML先于XML,不支持Unicode;它还缺乏对docbook 5的支持。
-
the docbook-xsl stylesheets which go through XSL-FO. docbook-xsl is for docbook 4.5, docbook-xsl-ns is for docbook5. Use fop to go from XSL-FO to PDF. Pipeline: docbook5 —(xsl)—> xml.fo —(fop)—> pdf . Commands involved: xsltproc, fop.
通过XSL-FO的docbook-xsl样式表。docbook-xsl用于docbook 4.5, docbook- ns用于docbook5。使用fop从XSL-FO到PDF。管道:docbook5 -(xsl)- > xml。fo -(fop)- > pdf。命令包括:xsltproc,fop。
-
dblatex, which is primarily targeting docbook4.5 but has been updated for some of docbook5.
dblatex,它的主要目标是docbook4.5,但已经更新了一些docbook5。
xmlto can drive the last two, although it currently defaults to docbook-xsl and not docbook-xsl-ns.
xmlto可以驱动最后两个,尽管它目前默认为docbook-xsl,而不是docbook-xsl-ns。
A quick Docbook5 user guide
Prerequisites
sudo aptitude install docbook5 docbook-xsl-ns xsltproc fop xmlto libxml2-utils xmlstarlet
Validation
xmlstarlet val --err --xsd /usr/share/xml/docbook/schema/xsd/5.0/docbook.xsd book.xml
PDF output
xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl-ns/fo/docbook.xsl book.xml > book.fo
fop -fo book.fo -pdf book.pdf
#2
4
Apart from the header you gave, did you try a smaller example, like this one from the DocBook 5.0: The Definitive Guide ?
除了你给出的标题之外,你是否尝试过一个更小的例子,比如DocBook 5.0: the definitionguide ?
<?xml version="1.0" encoding="UTF-8"?>
<book xmlns='http://docbook.org/ns/docbook'>
<title>An Example Book</title>
<titleabbrev>Example</titleabbrev>
<info>
<legalnotice><para>No notice is required.</para></legalnotice>
<author><personname>
<firstname>Norman</firstname><surname>Walsh</surname>
</personname></author>
</info>
<dedication>
<para>
This book is dedicated to you.
</para>
</dedication>
<preface>
<title>Foreword</title>
<para>
Some content is always required.
</para>
</preface>
<chapter>
<title>A Chapter</title>
<para>
Content is required in chapters too.
</para>
</chapter>
<appendix>
<title>Optional Appendix</title>
<para>
Appendixes are optional.
</para>
</appendix>
</book>
Just rendered it to a PDF through one of my Maven environments. Can you give a small example (or a few separated onces) containing some content, which makes the use of all the additional name spaces necessary.
通过我的一个Maven环境将它呈现为PDF。您能否给出一个包含某些内容的小示例(或几个独立的实例),这使得使用所有附加的名称空间成为必要。
In case the above example does not work, and you are interested in how I have setup my environment read Making DocBook content available in a Maven project site. Just replace the example with the above DocBook 5.0 example. Only the docbkx-maven-plugin
is of interest, in relation to this question. (PS: Some basic knowledge of Java and Maven2 is required for this.)
如果上面的示例不起作用,并且您对如何设置我的环境read使DocBook内容在Maven项目站点中可用感兴趣。用上面的DocBook 5.0示例替换这个示例。关于这个问题,只有docbkx-maven-plugin感兴趣。(PS:这需要一些Java和Maven2的基础知识。)
#3
2
There are significant differences between Docbook 4.5 and 5.0. And those differences can prevent your document from being transformed.
Docbook 4.5和5.0之间存在显著差异。这些差异可以防止文档被转换。
If you want to check the validity of your 5.0 document, you can use the following command line tool :
如果要检查5.0文档的有效性,可以使用以下命令行工具:
-
it's a java tool, so you need to have a recent java runtime environment.
它是一个java工具,所以您需要有一个最近的java运行时环境。
-
the tool is Jing. You can download it from thaiopensource web site. : http://www.thaiopensource.com/relaxng/jing.html
该工具。你可以从thaiopensource网站下载。:http://www.thaiopensource.com/relaxng/jing.html
-
you will also need the relax ng file for docbook 5.0. It is provided with the docbook 5 distribution.
您还需要docbook 5.0的relax ng文件。它提供了docbook 5发行版。
-
run the validation test with the following command line :
java -jar path_to_Jing/jing.jar -t -i path_to_docbook5/docbook.rng document.xml使用以下命令行运行验证测试:java -jar path_to_Jing/jing。jar - t - i path_to_docbook5 / docbook。rng document.xml
If there are some failures, they should be returned this way : Error at URL "file:...../document.xml", line number 211, column number 59: bad value for attribute "id" from namespace "http://www.w3.org/XML/1998/namespace" Elapsed time 968+166=1134 milliseconds
如果有一些失败,它们应该以这样的方式返回:URL中的错误。xml",行号211,列号59:属性“id”的错误值来自名称空间http://www.w3.org/XML/1998/namespace"运行时间968+166=1134毫秒
#4
2
Publican
You can use Publican to publish your DocBook XML in PDF, html, and html-single formats. Publican is used by Red Hat as part of its internal documentation toolchain, and is an open source application hosted by the Fedora project. The tool uses "brands" to achieve a modularity in applying styles to the content being published. This preset manner simusing a wide variety of CMS or documentation tools.
您可以使用Publican以PDF、html和html-单一格式发布DocBook XML。Red Hat使用Publican作为其内部文档工具链的一部分,并且是由Fedora项目托管的开源应用程序。该工具使用“品牌”来实现将样式应用到发布内容的模块化。这种预先设定的方式简化了各种CMS或文档工具。
JBoss Documentation Guide
A good example of the tool in action is the JBoss Press Gang documentation, which is itself a great resource the gives documentation community guidance on the use of DocBook XML in JBoss documentation. The html and PDF versions were generated with Publican.
这个工具的一个很好的例子是JBoss的Press Gang文档,它本身就是一个伟大的资源,它提供了文档社区指南,用于在JBoss文档中使用DocBook XML。html和PDF版本是用Publican生成的。
#5
1
http://docbookpublishing.com supports DocBook 5.0 documents. It is an online service for DocBook to PDF formatting. You can also submit your DocBook documents via the REST API.
http://docbookpublishing.com支持DocBook 5.0文档。它是DocBook到PDF格式的在线服务。您还可以通过REST API提交DocBook文档。
#6
1
Go to Eclipse and install DocBook Editing and Processing for Eclipse (DEP4E) plugin. You can find it by going into marketplace and search for docbook there. This plugin will create an example docbook and can publish in html, pdf, and even ebook.
去Eclipse并为Eclipse (DEP4E)插件安装DocBook编辑和处理。你可以通过进入市场,在那里搜索docbook来找到它。这个插件将创建一个示例docbook,并可以以html、pdf甚至电子书的形式发布。
Or check out the DEP4E web site, read the Quick Starter Guide section 3. Getting Started, to get an idea of it's possibilities.
或查看DEP4E网站,阅读快速入门指南第3节。开始,了解它的可能性。
#7
0
wordpress post to docbook style posts: http://hashfold.com/techfold/wordpress-how-to-generate-docbook-style-posts/
docbook风格的文章:http://hashfold.com/techfold/wordpress-how-to-generate-docbook风格-posts/