%scons; %builders-mod; %functions-mod; %tools-mod; %variables-mod; ]> This tool tries to make working with Docbook in SCons a little easier. It provides several toolchains for creating different output formats, like HTML or PDF. Contained in the package is a distribution of the Docbook XSL stylesheets as of version 1.76.1. As long as you don't specify your own stylesheets for customization, these official versions are picked as default...which should reduce the inevitable setup hassles for you. Implicit dependencies to images and XIncludes are detected automatically if you meet the HTML requirements. The additional stylesheet utils/xmldepend.xsl by Paul DuBois is used for this purpose. Note, that there is no support for XML catalog resolving offered! This tool calls the XSLT processors and PDF renderers with the stylesheets you specified, that's it. The rest lies in your hands and you still have to know what you're doing when resolving names via a catalog. For activating the tool "docbook", you have to add its name to the Environment constructor, like this env = Environment(tools=['docbook']) On its startup, the Docbook tool tries to find a required xsltproc processor, and a PDF renderer, e.g. fop. So make sure that these are added to your system's environment PATH and can be called directly, without specifying their full path. For the most basic processing of Docbook to HTML, you need to have installed the Python lxml binding to libxml2, or a standalone XSLT processor, currently detected are xsltproc, saxon, saxon-xslt and xalan. Rendering to PDF requires you to have one of the applications fop or xep installed. Creating a HTML or PDF document is very simple and straightforward. Say env = Environment(tools=['docbook']) env.DocbookHtml('manual.html', 'manual.xml') env.DocbookPdf('manual.pdf', 'manual.xml') to get both outputs from your XML source manual.xml. As a shortcut, you can give the stem of the filenames alone, like this: env = Environment(tools=['docbook']) env.DocbookHtml('manual') env.DocbookPdf('manual') and get the same result. Target and source lists are also supported: env = Environment(tools=['docbook']) env.DocbookHtml(['manual.html','reference.html'], ['manual.xml','reference.xml']) or even env = Environment(tools=['docbook']) env.DocbookHtml(['manual','reference']) Whenever you leave out the list of sources, you may not specify a file extension! The Tool uses the given names as file stems, and adds the suffixes for target and source files accordingly. The rules given above are valid for the Builders &b-link-DocbookHtml;, &b-link-DocbookPdf;, &b-link-DocbookEpub;, &b-link-DocbookSlidesPdf; and &b-link-DocbookXInclude;. For the &b-link-DocbookMan; transformation you can specify a target name, but the actual output names are automatically set from the refname entries in your XML source. The Builders &b-link-DocbookHtmlChunked;, &b-link-DocbookHtmlhelp; and &b-link-DocbookSlidesHtml; are special, in that: they create a large set of files, where the exact names and their number depend on the content of the source file, and the main target is always named index.html, i.e. the output name for the XSL transformation is not picked up by the stylesheets. As a result, there is simply no use in specifying a target HTML name. So the basic syntax for these builders is always: env = Environment(tools=['docbook']) env.DocbookHtmlhelp('manual') If you want to use a specific XSL file, you can set the additional xsl parameter to your Builder call as follows: env.DocbookHtml('other.html', 'manual.xml', xsl='html.xsl') Since this may get tedious if you always use the same local naming for your customized XSL files, e.g. html.xsl for HTML and pdf.xsl for PDF output, a set of variables for setting the default XSL name is provided. These are: DOCBOOK_DEFAULT_XSL_HTML DOCBOOK_DEFAULT_XSL_HTMLCHUNKED DOCBOOK_DEFAULT_XSL_HTMLHELP DOCBOOK_DEFAULT_XSL_PDF DOCBOOK_DEFAULT_XSL_EPUB DOCBOOK_DEFAULT_XSL_MAN DOCBOOK_DEFAULT_XSL_SLIDESPDF DOCBOOK_DEFAULT_XSL_SLIDESHTML and you can set them when constructing your environment: env = Environment(tools=['docbook'], DOCBOOK_DEFAULT_XSL_HTML='html.xsl', DOCBOOK_DEFAULT_XSL_PDF='pdf.xsl') env.DocbookHtml('manual') # now uses html.xsl DOCBOOK_DEFAULT_XSL_HTML DOCBOOK_DEFAULT_XSL_HTMLCHUNKED DOCBOOK_DEFAULT_XSL_HTMLHELP DOCBOOK_DEFAULT_XSL_PDF DOCBOOK_DEFAULT_XSL_EPUB DOCBOOK_DEFAULT_XSL_MAN DOCBOOK_DEFAULT_XSL_SLIDESPDF DOCBOOK_DEFAULT_XSL_SLIDESHTML DOCBOOK_XSLTPROC DOCBOOK_XMLLINT DOCBOOK_FOP DOCBOOK_XSLTPROCFLAGS DOCBOOK_XMLLINTFLAGS DOCBOOK_FOPFLAGS DOCBOOK_XSLTPROCPARAMS DOCBOOK_XSLTPROCCOM DOCBOOK_XMLLINTCOM DOCBOOK_FOPCOM DOCBOOK_XSLTPROCCOMSTR DOCBOOK_XMLLINTCOMSTR DOCBOOK_FOPCOMSTR The default XSLT file for the &b-link-DocbookHtml; builder within the current environment, if no other XSLT gets specified via keyword. The default XSLT file for the &b-link-DocbookHtmlChunked; builder within the current environment, if no other XSLT gets specified via keyword. The default XSLT file for the &b-link-DocbookHtmlhelp; builder within the current environment, if no other XSLT gets specified via keyword. The default XSLT file for the &b-link-DocbookPdf; builder within the current environment, if no other XSLT gets specified via keyword. The default XSLT file for the &b-link-DocbookEpub; builder within the current environment, if no other XSLT gets specified via keyword. The default XSLT file for the &b-link-DocbookMan; builder within the current environment, if no other XSLT gets specified via keyword. The default XSLT file for the &b-link-DocbookSlidesPdf; builder within the current environment, if no other XSLT gets specified via keyword. The default XSLT file for the &b-link-DocbookSlidesHtml; builder within the current environment, if no other XSLT gets specified via keyword. The path to the external executable xsltproc (or saxon, xalan), if one of them is installed. Note, that this is only used as last fallback for XSL transformations, if no lxml Python binding can be imported in the current system. The path to the external executable xmllint, if it's installed. Note, that this is only used as last fallback for resolving XIncludes, if no lxml Python binding can be imported in the current system. The path to the PDF renderer fop or xep, if one of them is installed (fop gets checked first). Additonal command-line flags for the external executable xsltproc (or saxon, xalan). Additonal command-line flags for the external executable xmllint. Additonal command-line flags for the PDF renderer fop or xep. Additonal parameters that are not intended for the XSLT processor executable, but the XSL processing itself. By default, they get appended at the end of the command line for saxon and saxon-xslt, respectively. The full command-line for the external executable xsltproc (or saxon, xalan). The full command-line for the external executable xmllint. The full command-line for the PDF renderer fop or xep. The string displayed when xsltproc is used to transform an XML file via a given XSLT stylesheet. The string displayed when xmllint is used to resolve XIncludes for a given XML file. The string displayed when a renderer like fop or xep is used to create PDF output from an XML file. A pseudo-Builder, providing a Docbook toolchain for HTML output. env = Environment(tools=['docbook']) env.DocbookHtml('manual.html', 'manual.xml') or simply env = Environment(tools=['docbook']) env.DocbookHtml('manual') A pseudo-Builder, providing a Docbook toolchain for chunked HTML output. It supports the base.dir parameter. The chunkfast.xsl file (requires "EXSLT") is used as the default stylesheet. Basic syntax: env = Environment(tools=['docbook']) env.DocbookHtmlChunked('manual') where manual.xml is the input file. If you use the root.filename parameter in your own stylesheets you have to specify the new target name. This ensures that the dependencies get correct, especially for the cleanup via scons -c: env = Environment(tools=['docbook']) env.DocbookHtmlChunked('mymanual.html', 'manual', xsl='htmlchunk.xsl') Some basic support for the base.dir is provided. You can add the base_dir keyword to your Builder call, and the given prefix gets prepended to all the created filenames: env = Environment(tools=['docbook']) env.DocbookHtmlChunked('manual', xsl='htmlchunk.xsl', base_dir='output/') Make sure that you don't forget the trailing slash for the base folder, else your files get renamed only! A pseudo-Builder, providing a Docbook toolchain for HTMLHELP output. Its basic syntax is: env = Environment(tools=['docbook']) env.DocbookHtmlhelp('manual') where manual.xml is the input file. If you use the root.filename parameter in your own stylesheets you have to specify the new target name. This ensures that the dependencies get correct, especially for the cleanup via scons -c: env = Environment(tools=['docbook']) env.DocbookHtmlhelp('mymanual.html', 'manual', xsl='htmlhelp.xsl') Some basic support for the base.dir parameter is provided. You can add the base_dir keyword to your Builder call, and the given prefix gets prepended to all the created filenames: env = Environment(tools=['docbook']) env.DocbookHtmlhelp('manual', xsl='htmlhelp.xsl', base_dir='output/') Make sure that you don't forget the trailing slash for the base folder, else your files get renamed only! A pseudo-Builder, providing a Docbook toolchain for PDF output. env = Environment(tools=['docbook']) env.DocbookPdf('manual.pdf', 'manual.xml') or simply env = Environment(tools=['docbook']) env.DocbookPdf('manual') A pseudo-Builder, providing a Docbook toolchain for EPUB output. env = Environment(tools=['docbook']) env.DocbookEpub('manual.epub', 'manual.xml') or simply env = Environment(tools=['docbook']) env.DocbookEpub('manual') A pseudo-Builder, providing a Docbook toolchain for Man page output. Its basic syntax is: env = Environment(tools=['docbook']) env.DocbookMan('manual') where manual.xml is the input file. Note, that you can specify a target name, but the actual output names are automatically set from the refname entries in your XML source. A pseudo-Builder, providing a Docbook toolchain for PDF slides output. env = Environment(tools=['docbook']) env.DocbookSlidesPdf('manual.pdf', 'manual.xml') or simply env = Environment(tools=['docbook']) env.DocbookSlidesPdf('manual') A pseudo-Builder, providing a Docbook toolchain for HTML slides output. env = Environment(tools=['docbook']) env.DocbookSlidesHtml('manual') If you use the titlefoil.html parameter in your own stylesheets you have to give the new target name. This ensures that the dependencies get correct, especially for the cleanup via scons -c: env = Environment(tools=['docbook']) env.DocbookSlidesHtml('mymanual.html','manual', xsl='slideshtml.xsl') Some basic support for the base.dir parameter is provided. You can add the base_dir keyword to your Builder call, and the given prefix gets prepended to all the created filenames: env = Environment(tools=['docbook']) env.DocbookSlidesHtml('manual', xsl='slideshtml.xsl', base_dir='output/') Make sure that you don't forget the trailing slash for the base folder, else your files get renamed only! A pseudo-Builder, for resolving XIncludes in a separate processing step. env = Environment(tools=['docbook']) env.DocbookXInclude('manual_xincluded.xml', 'manual.xml') A pseudo-Builder, applying a given XSL transformation to the input file. env = Environment(tools=['docbook']) env.DocbookXslt('manual_transformed.xml', 'manual.xml', xsl='transform.xslt') Note, that this builder requires the xsl parameter to be set.