UNPKG

node10-libxslt

Version:

[Fork] Node.js bindings for libxslt compatible with libxmljs

52 lines (51 loc) 6.01 kB
<html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <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>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a href="ch01s02.html">Next</a></td></tr></table><hr></div><p>There is a growing list of tools to process DocBook documents using XSL stylesheets. Each tool implements parts or all of the XSL standard, which actually has several components: <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 in XML. It includes the formatting object language, but refers to separate documents for the transformation 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 into other XML documents, HTML, or text. It can be used to 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 document. It is used to find the parts of your document to apply different styles to. All XSL processors use this component.</p></dd></dl></div></p><p>To publish HTML from your XML documents, you just need an XSLT engine. To get to print, you need an XSLT engine to produce formatting objects (FO), which then must be processed with a formatting object processor to produce PostScript or PDF output.</p><p>James Clark's XT was the first useful XSLT engine, and it is still in wide use. It is written in Java, so it runs on many platforms, and it is free ( <a href="http://www.jclark.com" target="_top">http://www.jclark.com</a>). XT comes with James Clark's nonvalidating parser XP, but you can substitute a different Java parser. Here is a simple example of using XT from the Unix command line to produce HTML: You'll need to alter your <i><tt>CLASSPATH</tt></i> environment variable to include the path to where you put the <tt>.jar</tt> files from the XT distribution.</p><pre class="screen">CLASSPATH=xt.jar:xp.jar:sax.jar export CLASSPATH java com.jclark.xsl.sax.Driver <i><tt>filename.xml</tt></i> <i><tt>docbook/html/docbook.xsl</tt></i> &gt; <i><tt>output.html</tt></i></pre><p>If you replace the HTML stylesheet with a formatting object stylesheet, XT will produce a formatting object file. Then you can convert that to PDF using FOP, a formatting object processor available for free from the Apache XML Project ( <a href="http://xml.apache.org" target="_top">http://xml.apache.org</a>). Here is an example of that two stage processing:</p><pre class="screen">CLASSPATH=xt.jar:xp.jar:sax.jar:fop.jar export CLASSPATH java com.jclark.xsl.sax.Driver <i><tt>filename.xml</tt></i> <i><tt>docbook/fo/docbook.xsl</tt></i> &gt; <i><tt>output.fo</tt></i> java 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 choose from include:</p><div class="itemizedlist"><ul><li><p><a name="c44b1b3b4b9b1"></a>4XSLT, written in Python, from FourThought LLC ( <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 ( <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 ( <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 Project ( <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 Egon Willighagen ( <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 RenderX ( <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>&nbsp;</td><td width="20%" align="center"><a href="index.html">Home</a></td><td width="40%" align="right">&nbsp;<a href="ch01s02.html">Next</a></td></tr><tr><td width="40%" align="left">Preface&nbsp;</td><td width="20%" align="center"><a href="index.html">Up</a></td><td width="40%" align="right">&nbsp;A brief introduction to XSL</td></tr></table></div></body></html>