1.5. Translation to HTML

Your file is now ready to be converted to other formats. To convert this file from DocBook format to HTML format, the command docbook2html can be used. This will run Norman Walsh's XSLT to HTML stylesheets and Michael Kay's saxon XSLT processor to generate the HTML files from the DocBook sources.

Example 1.2. Running docbook2html (single output file)

$ docbook2html dbfile.xml
dbfile.xml abc.xsl dbfile.html
 
 Using java 1.4 from AFS.
 
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

If you validated your XML file with an XML parser, then there should be no errors, and the procedure will generate the file dbfile.html, which can be viewed with an HTML browser, e.g., the line browser lynx shows the following.

Example 1.3. HTML version generated from a DocBook file as displayed by lynx

                                                           XML rules the world!

XML rules the world!
     _________________________________________________________________

   Table of Contents

   XML and DocBook do it together

XML and DocBook do it together

   DocBook and XML are the golden twins of the 21st century !


Commands: Use arrow keys to move, '?' for help, 'q' to quit, '<-' to go back.
  Arrow keys: Up and Down to move. Right to follow a link; Left to go back.
 H)elp O)ptions P)rint G)o M)ain screen Q)uit /=search [delete]=history list 

In general, with a larger document, and the chunk option, you will get several files, as shown when we run (an early version) of the present manual with the docbook2html procedure.

Example 1.4. Running docbook2html with the chunk option

$ docbook2html -chunk dbatcern.xml
dbatcern.xml abc.xsl index.html
 
 Using java 1.4 from AFS.
 
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

Writing ch01s02.html for sect1(why-docbook)
Writing ch01s03.html for sect1(your-world-view)
Writing ch01s04.html for sect1(markup-based-on-content)
Writing ch01.html for chapter(introduction)
Writing ch02s02.html for sect1(installing-the-tools)
Writing ch02s03.html for sect1(hello-world)
Writing ch02s04.html for sect1(style-sheets)

     ... Many more lines ...

Writing ch11s03.html for sect1(warnings)
Writing ch11.html for chapter(miscellaneous)
Writing ch12.html for chapter(next)
Writing apa.html for appendix(emacs)
Writing go01.html for glossary(glossary)
Writing index.html for book(dbatcern)

We can see that files are generated at the level of the section (sect1 element), and in each case the value of the id attribute, if present, is displayed between parentheses.