documentation:setting_up_docbook_transforms
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| documentation:setting_up_docbook_transforms [2009/05/15 08:26] – kgs | documentation:setting_up_docbook_transforms [2022/02/10 13:34] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== Transforming DocBook XML into HTML, PDF, etc. ===== | ||
| + | |||
| + | Producing DocBook XML is the first step in the documentation process. To successfully produce web pages, PDF, text files, etc. from DocBook requires using XSL processors to transform the files. | ||
| + | |||
| + | [[zzz_archive: | ||
| + | |||
| + | ==== DocBook XSL Stylesheets ==== | ||
| + | |||
| + | The [[http:// | ||
| + | |||
| + | |||
| + | ==== DocBook and Validation Tools ==== | ||
| + | |||
| + | To successfully transform into HTML, PDF, and so forth, DocBook XML must be valid and well-formed. With XML, a miss is as good as a mile; one missing angle bracket will produce bad output. Furthermore, | ||
| + | |||
| + | There are a number of good validation tools for DocBook. A standard freebie is xmllint, which runs on many platforms. DocBook-friendly editors such as XMLMind will offer some validation assistance. Higher-end tools such as oXygen have built-in validators that all but ensure valid files. | ||
| + | |||
| + | ==== CSS and DocBook Output ==== | ||
| + | |||
| + | Transformed with the standard XSL stylesheets, | ||
| + | |||
| + | The Evergreen project currently does not have a set of CSS for DocBook. | ||
| + | |||
| + | ===== Setting up DocBook transforms on Linux ===== | ||
| + | |||
| + | Every Linux distribution seems to ship with different tools for transforming DocBook. It is relatively simple to set up a set of transforms to XHTML and PDF using the standard XSLT stylesheets and FO tools. This guide will get you up and running quickly. | ||
| + | |||
| + | =====Prerequisite===== | ||
| + | We require just one binary package included in your distribution. Every distribution makes the libxslt processor, '' | ||
| + | |||
| + | =====Preparing the build tools===== | ||
| + | In this phase, we download, extract, and create symbolic links to the build tools. You can probably use more recent versions of the tools as they become available. | ||
| + | |||
| + | < | ||
| + | mkdir doctools | ||
| + | cd doctools | ||
| + | |||
| + | # Install the DocBook RelaxNG schema | ||
| + | wget http:// | ||
| + | wget http:// | ||
| + | |||
| + | # Install the DocBook XSL stylesheets | ||
| + | tar xjf docbook-xsl-1.73.2.tar.bz2 | ||
| + | ln -sf docbook-xsl-1.73.2 docbook | ||
| + | |||
| + | # Install Apache FOP | ||
| + | wget http:// | ||
| + | tar xzf fop-0.94-bin-jdk1.4.tar.gz | ||
| + | ln -sf fop-0.94 fop | ||
| + | |||
| + | # Install hypenation support for Apache FOP | ||
| + | wget http:// | ||
| + | unzip offo-hyphenation.zip | ||
| + | </ | ||
| + | |||
| + | =====Generating the XHTML and PDF from a DocBook source file===== | ||
| + | The following is a simple script for generating XHTML and PDF from a DocBook source file. It assumes that your tools are installed in a subdirectory called '' | ||
| + | FOP=~/ | ||
| + | XSL=~/ | ||
| + | DOC=~/ | ||
| + | |||
| + | # Generate XHTML | ||
| + | xsltproc $XSL/ | ||
| + | |||
| + | #Generate PDF via FO | ||
| + | xsltproc $XSL/ | ||
| + | $FOP/fop $DOC/ | ||
| + | </ | ||
| + | |||
| + | ======Setting up DocBook transforms on Windows====== | ||
| + | |||
| + | [[http:// | ||
| + | |||
| + | Some XML processors that run on Windows, such as oXygen ($), automate all or part of the following, and for substantial editorial work in a Windows environment, | ||
| + | |||
| + | ==== Installing a free Windows-based XSL validator and processor ==== | ||
| + | |||
| + | Download: | ||
| + | |||
| + | - The latest libxml2 package | ||
| + | - The latest libxslt package | ||
| + | |||
| + | Note: The above packages can be downloaded from http:// | ||
| + | |||
| + | Then on your computer: | ||
| + | |||
| + | - Create a new directory, '' | ||
| + | - Extract the contents of both the libxml2 and libxslt zip files to '' | ||
| + | - Rename the sub-directories to C: | ||
| + | - Open a terminal session and add C: | ||
| + | set PATH=%PATH%; | ||
| + | |||
| + | - Test that XSLT processing tools work: <code dos> | ||
| + | xsltproc --help</ | ||
| + | - If you get a list of options for passing to xsltproc, then everything is set up correctly. | ||
| + | - If you get an error dialog saying "The procedure entry point xmlXPathCompiledEvalToBoolean could not be located in the dynamic link library libxml2.dll" | ||
| + | rename C: | ||
| + | |||
| + | - Download the DocBook XML schema package from http:// | ||
| + | - Extract the contents of the zip file to C: | ||
| + | - Download the DocBook XSL Stylesheet distribution (docbook-xsl) from http:// | ||
| + | - Extract the docbook-xsl ZIP file to C: | ||
| + | - Using the sample XML files you downloaded, test a basic transform: <code dos> | ||
| + | xsltproc C: | ||