The first steps with DocBook

Open a new SGML document by typing C-x C-f ~/dbtest.sgml. Insert the DocBook formal public identifier via the DTD->Insert DTD->DocBook 4.1 menu command. Insert some elements into the document, e.g. starting with the chapter and sect1 tags. Enter some para elements to hold some text. Validate your document with the SGMLValidate menu command.

Now prepare the system to create printable output from your document. We'll first do this with Emacs menu commands, and later on the command line. Use the DSSSL->File Options->Jade backend menu command to select the TeX backend. Use the DSSSL->File Options->DSSSL stylesheet menu command to set the stylesheet. Use the filename completion feature in the minibuffer to select the file docbook.dsl in the \print subdirectory of the DocBook hierarchy. Now use the DSSSL->Jade command to run Jade with the selected options on your document. Use the DSSSL->Recenter output buffer menu command to see the Jade stderr output. Except the "DTDDECL catalog entries are not supported" message which is a known limitation of Jade there should be no error messages, and Jade should exit with a "Jade finished at" message. If no errors occurred, there will be a new file dbtest.tex in your present working directory.

Note: While the abovementioned DTDDECL warning is a nice indicator that OpenJade does not hang while processing your 150 kb document, you may find it distracting after a while. To get rid of this message, scan all your catalog files for lines starting with DTDDECL. Comment these lines out by adding a " –– " (space dash dash space) to the start and the end of the line.

Now use the DSSSL->Jadetex menu command to run the intermediate TeX file through LaTeX. This may take some time if new fonts have to be created and is accompanied by a bunch of messages in the output buffer. You should eventually see a successful message which also tells you how many pages were created. Use the DSSSL->View DVI command to display dbtest.dvi. The curious may load the intermediate dbtest.tex file into Emacs to see the fancy output of the TeX backend.

Now hit DSSSL->dviPS to create a PostScript document. Click on DSSSL->View PS to view the PostScript document dbtest.ps with GhostView.

Modify the file options to create HTML output from the same DocBook source. Using the commands described above, set the OpenJade backend to SGML and set the stylesheet to docbook.dsl in the \html subdirectory of your DocBook stylesheet hierarchy. Now run Jade again. This will create a set of HTML files with a file like book1.htm as the starting point.

To process your document on the command line you essentially use the same commands as in the OpenJade chapter. The main difference is that we need to supply a proper SGML declaration as the newer DocBook versions do not work with OpenJade's builtin default declaration. The correct one to use is docbook.dcl which is part of the DocBook DTD archive. To transform your DocBook document (aptly named docbook.sgml in these examples) into either RTF or HTML, run the following commands:

c:\user\myself> openjade -t rtf -d \path\to\print\docbook.dsl \path\to\docbook.dcl docbook.sgml
c:\user\myself> openjade -t sgml -d \path\to\html\docbook.dsl \path\to\docbook.dcl docbook.sgml