Chapter 3. How do I write a DocBook document?

Contents

3.1. How do I transform a DocBook document?
3.2. What is fo and what is a fo renderer?
3.3. How do I change the way the output looks?
3.4. Generated text
3.5. What if there is no parameter for the thing I want to change?
3.6. Glossary generation
3.7. Profiling
3.8. The directory structure of the distribution

This is easily the most difficult thing to get used to when composing in DocBook or DTD that tries to focus on semantics rather than presentation. There's not one short or even long answer to the question of what the best authoring environment is, but recently a couple of editors have made strides in solving the problem of how to represent semantics and reasonable presentation at the same time.

WYSIWYG is ultimately impossible any time you produce multiple outputs from a single source. This subject is discussed every few months on one of the XML or DocBook lists.

See a list of DocBook authoring tools at the DocBook Wiki.

In addition to providing help authoring instances of DocBook XML (or any DTD) by indicating what elements are valid at what points, these tools validate documents. When a tool validates a document, it compares the XML to its DTD to see if it conforms to the DTD. If the document does not conform to the DTD, the tools typically try to indicate what and where the problem is, though they can't always tell you exactly what is wrong.

There are a few other editors at various levels of maturity. I hear Oxygen and Morphon mentioned sometimes.

I'm not discussing DSSSL or fosi here.

Most of the tools that transform XML documents are command line. Example using xsltproc:

xsltproc -o output.xml path/to/html/docbook.xsl input.xml 
            

To use XSL to go to HTML Help, you must also run hhc or use the HTML Help workshop to compile the chm.

XSL does not take you directly to pdf. You use XSL to convert the DocBook document to xsl-fo, then use a fo renderer to convert that document to a pdf or postscript file.

There are several convenience tools that hide the transformation process from you to one degree or another. You certainly need either one of these or something you write yourself (a batch file, shell script, perl script, make file, ant script)