1<html><head> 2 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 3 <title>Chapter 1. DocBook XSL</title><link rel="stylesheet" href="reference.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.37"><link rel="home" href="index.html" title="DocBook XSL Stylesheet Documentation"><link rel="up" href="index.html" title="DocBook XSL Stylesheet Documentation"><link rel="previous" href="pr01.html" title="Preface"><link rel="next" href="ch01s02.html" title="A brief introduction to XSL"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 1. DocBook XSL</th></tr><tr><td width="20%" align="left"><a href="pr01.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a href="ch01s02.html">Next</a></td></tr></table><hr></div><p>There is a growing list of tools to process DocBook 4 documents using XSL stylesheets. Each tool implements parts 5 or all of the XSL standard, which actually has several 6 components: 7 <div class="variablelist"><dl><dt><a name="c44b1b3b4b2b2b1"></a><span class="term">Extensible Stylesheet Language (XSL)</span></dt><dd><p><a name="c44b1b3b4b2b2b1b2"></a>A language for expressing stylesheets written 8 in XML. It includes the formatting object language, but 9 refers to separate documents for the transformation 10 language and the path language.</p></dd><dt><a name="c44b1b3b4b2b2b2"></a><span class="term">XSL Transformation (XSLT)</span></dt><dd><p><a name="c44b1b3b4b2b2b2b2"></a>The part of XSL for transforming XML documents 11 into other XML documents, HTML, or text. It can be used to 12 rearrange the content and generate new content.</p></dd><dt><a name="c44b1b3b4b2b2b3"></a><span class="term">XML Path Language (XPath)</span></dt><dd><p><a name="c44b1b3b4b2b2b3b2"></a>A language for addressing parts of an XML 13 document. It is used to find the parts of your document to 14 apply different styles to. All XSL processors use this 15 component.</p></dd></dl></div></p><p>To publish HTML from your XML documents, you just 16 need an XSLT engine. To get to print, you need an XSLT 17 engine to produce formatting objects (FO), which then must 18 be processed with a formatting object processor to produce 19 PostScript or PDF output.</p><p>James Clark's XT was the first useful XSLT engine, 20 and it is still in wide use. It is written in Java, so it 21 runs on many platforms, and it is free ( 22 <a href="http://www.jclark.com" target="_top">http://www.jclark.com</a>). 23 XT comes with James Clark's nonvalidating parser XP, but 24 you can substitute a different Java parser. Here is a 25 simple example of using XT from the Unix command line to 26 produce HTML: You'll need to alter your 27 <i><tt>CLASSPATH</tt></i> environment variable to 28 include the path to where you put the 29 <tt>.jar</tt> files from the XT 30 distribution.</p><pre class="screen">CLASSPATH=xt.jar:xp.jar:sax.jar 31export CLASSPATH 32java com.jclark.xsl.sax.Driver <i><tt>filename.xml</tt></i> <i><tt>docbook/html/docbook.xsl</tt></i> > <i><tt>output.html</tt></i></pre><p>If you replace the HTML stylesheet with a 33 formatting object stylesheet, XT will produce a formatting 34 object file. Then you can convert that to PDF using FOP, a 35 formatting object processor available for free from the 36 Apache XML Project ( 37 <a href="http://xml.apache.org" target="_top">http://xml.apache.org</a>). 38 Here is an example of that two stage processing:</p><pre class="screen">CLASSPATH=xt.jar:xp.jar:sax.jar:fop.jar 39export CLASSPATH 40java com.jclark.xsl.sax.Driver <i><tt>filename.xml</tt></i> <i><tt>docbook/fo/docbook.xsl</tt></i> > <i><tt>output.fo</tt></i> 41java org.apache.fop.apps.CommandLine <i><tt>output.fo</tt></i> <i><tt>output.pdf</tt></i></pre><p>As of this writing, some other XSLT processors to 42 choose from include:</p><div class="itemizedlist"><ul><li><p><a name="c44b1b3b4b9b1"></a>4XSLT, written in Python, from FourThought LLC ( 43 <a href="http://www.fourthought.com" target="_top">http://www.fourthought.com</a>)</p></li><li><p><a name="c44b1b3b4b9b2"></a>Sablotron, written in C++, from Ginger Alliance ( 44 45 <a href="http://www.gingerall.com" target="_top">http://www.gingerall.com</a>)</p></li><li><p><a name="c44b1b3b4b9b3"></a>Saxon, written in Java, from Michael Kay ( 46 <a href="http://users.iclway.co.uk/mhkay/saxon" target="_top">http://users.iclway.co.uk/mhkay/saxon</a>)</p></li><li><p><a name="c44b1b3b4b9b4"></a>Xalan, written in Java, from the Apache XML 47 Project ( 48 <a href="http://xml.apache.org" target="_top">http://xml.apache.org</a>)</p></li><li><p><a name="c44b1b3b4b9b5"></a>XML::XSLT,written in Perl, from Geert Josten and 49 Egon Willighagen ( 50 <a href="http://www.cpan.org" target="_top">http://www.cpan.org</a>)</p></li></ul></div><p>For print output, these additional tools are available for processing formatting objects:</p><div class="itemizedlist"><ul><li><p><a name="c44b1b3b4c11b1"></a>XEP (written in Java) from 51 RenderX ( 52 <a href="http://www.renderx.com" target="_top">http://www.renderx.com</a>).</p></li><li><p><a name="c44b1b3b4c11b2"></a>PassiveTeX from Sebastian Rahtz (<a href="http://users.ox.ac.uk/~rahtz/passivetex/" target="_top">http://users.ox.ac.uk/~rahtz/passivetex/</a>).</p></li></ul></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a href="pr01.html">Prev</a> </td><td width="20%" align="center"><a href="index.html">Home</a></td><td width="40%" align="right"> <a href="ch01s02.html">Next</a></td></tr><tr><td width="40%" align="left">Preface </td><td width="20%" align="center"><a href="index.html">Up</a></td><td width="40%" align="right"> A brief introduction to XSL</td></tr></table></div></body></html>