views:

475

answers:

2

I've written a docbook 5.0 document with the header:

<?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"&gt;

and docbook2pdf on Ubuntu 9.10 prints many error messages and doesn't do any pdf document. The errors are:

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:

<?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"&gt;

works quite OK.

Is there any way to generate pdf from docbook 5.0?

A: 

Apart from the header you gave, did you try a smaller example, like this one from the DocBook 5.0: The Definitive Guide ?

<?xml version="1.0" encoding="UTF-8"?>

<book xmlns='http://docbook.org/ns/docbook'&gt;
  <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.

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.)

Verhagen
A: 

There are significant differences between Docbook 4.5 and 5.0. And those differences can prevent your document from being transformed.

If you want to check the validity of your 5.0 document, you can use the following command line tool :

  1. it's a java tool, so you need to have a recent java runtime environment.

  2. the tool is Jing. You can download it from thaiopensource web site. : http://www.thaiopensource.com/relaxng/jing.html

  3. you will also need the relax ng file for docbook 5.0. It is provided with the docbook 5 distribution.

  4. 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

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

Hicham Bakir