A.3. Producing Formatted Output

Before using these examples, install the required tools as shown in Section 2.1, “Required Tools”.

A.3.1. Using Jade

Example A.3. Converting DocBook to XHTML (One Large File)
% jade -V nochunks \  1
    -c /usr/local/share/xml/docbook/dsssl/modular/catalog \ 2
    -c /usr/local/share/xml/docbook/catalog \
    -c /usr/local/share/xml/jade/catalog \
    -d /usr/local/share/xml/docbook/dsssl/modular/html/docbook.dsl \3
    -t sgml 4 file.xml > file.html 5

1

Specifies the nochunks parameter to the stylesheets, forcing all output to be written to the standard output (using Norm Walsh's stylesheets).

2

Specifies the catalogs that Jade will need to process. Three catalogs are required. The first is a catalog that contains information about the DSSSL stylesheets. The second contains information about the DocBook DTD. The third contains information specific to Jade.

3

Specifies the full path to the DSSSL stylesheet that Jade will use when processing the document.

4

Instructs Jade to perform a transformation from one DTD to another. In this case, the input is being transformed from the DocBook DTD to the XHTML DTD.

5

Specifies the file that Jade should process, and redirects output to the specified .html file.


Example A.4. Converting DocBook to XHTML (Several Small Files)
% jade \
    -c /usr/local/share/xml/docbook/dsssl/modular/catalog \ 1
    -c /usr/local/share/xml/docbook/catalog \
    -c /usr/local/share/xml/jade/catalog \
    -d /usr/local/share/xml/docbook/dsssl/modular/html/docbook.dsl \2
    -t sgml 3 file.xml 4

1

Specifies the catalogs that Jade will need to process. Three catalogs are required. The first is a catalog that contains information about the DSSSL stylesheets. The second contains information about the DocBook DTD. The third contains information specific to Jade.

2

Specifies the full path to the DSSSL stylesheet that Jade will use when processing the document.

3

Instructs Jade to perform a transformation from one DTD to another. In this case, the input is being transformed from the DocBook DTD to the XHTML DTD.

4

Specifies the file that Jade should process. The stylesheets determine how the individual XHTML files will be named, and the name of the root file, the one that contains the start of the document.

This example may still only generate one XHTML file, depending on the structure of the document you are processing, and the stylesheet's rules for splitting output.


Example A.5. Converting DocBook to PostScript®

The source XML file must be converted to a TeX file.

% jade -V tex-backend \ 1
    -c /usr/local/share/xml/docbook/dsssl/modular/catalog \ 2
    -c /usr/local/share/xml/docbook/catalog \
    -c /usr/local/share/xml/jade/catalog \
    -d /usr/local/share/xml/docbook/dsssl/modular/print/docbook.dsl \3
    -t tex 4 file.xml

1

Customizes the stylesheets to use various options specific to producing output for TeX.

2

Specifies the catalogs that Jade will need to process. Three catalogs are required. The first is a catalog that contains information about the DSSSL stylesheets. The second contains information about the DocBook DTD. The third contains information specific to Jade.

3

Specifies the full path to the DSSSL stylesheet that Jade will use when processing the document.

4

Instructs Jade to convert the output to TeX.

The generated .tex file must now be run through tex, specifying the &jadetex macro package.

% tex "&jadetex" file.tex

tex commands must be run at least three times. The first run processes the document, and determines areas of the document which are referenced from other parts of the document, for use in indexing, and so on.

Do not be alarmed if you see warning messages such as LaTeX Warning: Reference `136' on page 5 undefined on input line 728. at this point.

The second run reprocesses the document now that certain pieces of information are known (such as the document's page length). This allows index entries and other cross-references to be fixed up.

The third pass performs any final cleanup necessary.

The output from this stage will be file.dvi.

Finally, run dvips to convert the .dvi file to PostScript®.

% dvips -o file.ps file.dvi

Example A.6. Converting DocBook to PDF

The first part of this process is identical to that of converting DocBook to PostScript®, using the same jade command line (Example A.5, “Converting DocBook to PostScript®”).

After the .tex file has been generated, run pdfTeX. However, use the &pdfjadetex macro package instead.

% pdftex "&pdfjadetex" file.tex

Again, run this command three times.

This will generate file.pdf, which does not need to be processed any further.


All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.