LDP/LDP/howto/docbook/DocBook-OpenJade-SGML-XML-H...

899 lines
44 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://docbook.org/xml/4.1.2/docbookx.dtd">
<article id="DocBook-OpenJade-SGML-XML-HOWTO">
<articleinfo>
<title>DocBook XML/SGML Processing Using OpenJade</title>
<author>
<firstname>Saqib</firstname>
<surname>Ali</surname>
<affiliation>
<address> <email>saqib@seagate.com</email> </address>
</affiliation>
</author>
<revhistory id="revhistory">
<revision>
<revnumber>v2.2.8</revnumber>
<date>2003-07-16</date>
<authorinitials>es</authorinitials>
<revremark>Added info about keeping JREs up-to-date forCocoon</revremark>
</revision>
<revision>
<revnumber>v2.2.7</revnumber>
<date>2003-07-09</date>
<authorinitials>es</authorinitials>
<revremark> Fixed broken links to LDP XSL and other LDP XSL spefic filenames. </revremark>
</revision>
<revision>
<revnumber>v2.2.6</revnumber>
<date>2003-06-16</date>
<authorinitials>sa</authorinitials>
<revremark> Verified the instruction against docbook XSL 1.57. </revremark>
</revision>
<revision>
<revnumber>v2.2.5</revnumber>
<date>2003-05-16</date>
<authorinitials>sa</authorinitials>
<revremark> Fixed the broken links in the external resources section. </revremark>
</revision>
<revision>
<revnumber>v2.2.4</revnumber>
<date>2003-04-20</date>
<authorinitials>sa</authorinitials>
<revremark> Updated links to the new Demo Site. Added new links to the resources section. </revremark>
</revision>
<revision>
<revnumber>v2.2.3</revnumber>
<date>2002-11-22</date>
<authorinitials>sa</authorinitials>
<revremark> Added the suggestion made by users. Added new links to the resources section. </revremark>
</revision>
<revision>
<revnumber>v2.2.2</revnumber>
<date>2002-10-09</date>
<authorinitials>as</authorinitials>
<revremark> This update fixes a few more typos, removes a couple of spaces that make the HTML rendering look odd. </revremark>
</revision>
<revision>
<revnumber>v2.2.1</revnumber>
<date>2002-10-09</date>
<authorinitials>sa</authorinitials>
<revremark> Fixed the URL to the Sample Files. </revremark>
</revision>
<revision>
<revnumber>v2.2</revnumber>
<date>2002-09-29</date>
<authorinitials>as</authorinitials>
<revremark> Minor corrections to the Cocoon section. </revremark>
</revision>
<revision>
<revnumber>v2.1</revnumber>
<date>2002-09-15</date>
<authorinitials>sa</authorinitials>
<revremark> Minor corrections to the Cocoon section. </revremark>
</revision>
<revision>
<revnumber>v2.0</revnumber>
<date>2002-09-10</date>
<authorinitials>sa</authorinitials>
<revremark> Added the section on serving DocBook XML 4.1.2 content using Tomcat + Cocoon. </revremark>
</revision>
<revision>
<revnumber>v1.5</revnumber>
<date>2002-08-11</date>
<authorinitials>sa</authorinitials>
<revremark> Added the XML section and the sample XML file. </revremark>
</revision>
<revision>
<revnumber>v1.4</revnumber>
<date>2002-08-08</date>
<authorinitials>sa</authorinitials>
<revremark> Many valuable modifications/corrections suggested by Lloyd D Budd. Thanks Lloyd. :) </revremark>
</revision>
<revision>
<revnumber>v1.3</revnumber>
<date>2002-08-02</date>
<authorinitials>sa</authorinitials>
<revremark> Added the "Additional Resources" section. </revremark>
</revision>
<revision>
<revnumber>v1.2</revnumber>
<date>2002-07-23</date>
<authorinitials>sa</authorinitials>
<revremark> Added the section on converting HTML -&gt; PDF using HTMLDOC. Thanks to Luc De Louw for the suggestion. </revremark>
</revision>
<revision>
<revnumber>v1.1</revnumber>
<date>2002-07-19</date>
<authorinitials>KET</authorinitials>
<revremark> Fixed grammatical errors, numbered processes. </revremark>
</revision>
<revision>
<revnumber>v1.0</revnumber>
<date>2002-06-29</date>
<authorinitials>sa</authorinitials>
<revremark> Initial public release. </revremark>
</revision>
</revhistory>
<abstract>
<para>This HOWTO explains setting up OpenJade to process SGML/XML DocBook documents.</para>
</abstract>
</articleinfo>
<sect1 id="intro">
<title>Introduction</title>
<para>Some Acronyms:</para>
<orderedlist>
<listitem>
<para>SGML - Standard Generalized Markup Language</para>
</listitem>
<listitem>
<para>XML - Extensible Markup Language</para>
</listitem>
<listitem>
<para>RTF - Rich Text Format</para>
</listitem>
<listitem>
<para>HTML - HyperText Markup Language</para>
</listitem>
<listitem>
<para>PDF - Portable Document Format</para>
</listitem>
</orderedlist>
<para> The objective of this document is to setup OpenJade to convert DocBook 3.2 and 4.2 Standard Generalized Markup Language (SGML) and Extensible Markup Language (XML) documents to HyperText Markup Language (HTML), Rich Text Format (RTF), and Portable Document Format (PDF).</para>
<sect2 id="copyright">
<title>Copyright and License</title>
<para> This document is Copyright 2001 by Saqib Ali. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is available at <ulink url="http://www.gnu.org/copyleft/fdl.html">http://www.gnu.org/copyleft/fdl.html</ulink>. </para>
</sect2>
<sect2>
<title>Credits</title>
<para>All praise is due to <emphasis role="strong"><emphasis></emphasis>Allah</emphasis>, <emphasis role="strong">The Lord of the Worlds</emphasis>. All credits go to <emphasis role="strong">Allah</emphasis>. Any mistake in this document is my own fault.</para>
<para>Additionally, I would like to acknowledge the following people for their valuable contributions to this document:</para>
<orderedlist>
<listitem>
<para> Eric Safern <email>esafern (at) lrn.com</email> - For updates related to Cocoon and JRE. <ulink url="http://www.timebytes.com/">http://www.timebytes.com/</ulink></para>
</listitem>
<listitem>
<para>Greg Ferguson <email>gferg (at) hoop.timonium.sgi.com</email> - for very helpful hints/suggestions on the docbook mailing list</para>
</listitem>
<listitem>
<para>Kristin Thomas <email>kristint (at) us.ibm.com</email> - For the initial review of this document.</para>
</listitem>
<listitem>
<para>Luc de Louw <email>luc (@) delouw.ch</email> - For suggesting the HTMLDOC (PDF -&gt; HTML) section.</para>
</listitem>
<listitem>
<para>Lloyd D Budd <email>ldp (@) foolswisdom.org</email> - For suggestions on improving most of the sections of the document.</para>
</listitem>
<listitem>
<para>Andrew Shugg <email>andrew (@) neep.com.au</email> - For fixing errors in the ver 2.0 of this document. <ulink url="http://www.neep.com.au/">Neep Consulting</ulink></para>
</listitem>
</orderedlist>
</sect2>
<sect2>
<title>What is DocBook?</title>
<para> DocBook is a document type definition (DTD). A DTD defines the syntax of a document. DocBook describes the types of structure and formats to use in technical documents. It is commonly used because of its simplicity and completeness. </para>
<para> A DTD defines the syntax of a document - essentially it is a 'rule book' that describes the sets of tags and attributes that will be used to describe specific kinds of content. So DocBook is a "rule book" that is used for writing documents. Every tag that is used in writing the document, must be defined very specifically and formally in the DTD. </para>
</sect2>
<sect2>
<title>What is DSSSL?</title>
<para>A Document Style Semantics and Specification Language (DSSSL) defines how to convert an Standard Generalized Markup Language (SGML) document into a human-readable viewing format such as HTML, RTF and PDF.</para>
</sect2>
<sect2>
<title>What do we need?</title>
<para>The tools needed to set up OpenJade for converting SGML and XML are: </para>
<itemizedlist>
<listitem>
<para>OpenJade</para>
</listitem>
<listitem>
<para>DocBook DTDs</para>
</listitem>
<listitem>
<para>ISO Entities</para>
</listitem>
<listitem>
<para>Norman Walsh's DSSSL</para>
</listitem>
<listitem>
<para>LDP DSL</para>
</listitem>
<listitem>
<para>HTMLDOC (optional)</para>
</listitem>
<listitem>
<para>Norman Walsh's XSL (optional)</para>
</listitem>
<listitem>
<para>LDP XSL (optional)</para>
</listitem>
</itemizedlist>
<note>
<title>Note</title>
<para>All of these packages are free and available for download on the net. The next chapter explains how to download these packages.</para>
</note>
</sect2>
<sect2>
<title>Assumptions</title>
<para> This document assumes that you have the following already installed on your system. </para>
<itemizedlist>
<listitem>
<para>gzip - available from <ulink url="http://www.gnu.org/directory/">http://www.gnu.org/directory/</ulink></para>
</listitem>
<listitem>
<para>gcc and GNU make - available from <ulink url="http://www.gnu.org/directory/">http://www.gnu.org/directory/</ulink></para>
</listitem>
<listitem>
<para>unzip - available from <ulink url="http://www.info-zip.org/pub/infozip/">http://www.info-zip.org/pub/infozip/</ulink></para>
</listitem>
<listitem>
<para>Standard Unix utilities - tar, mkdir, mv ...</para>
</listitem>
</itemizedlist>
</sect2>
</sect1>
<sect1 id="requirements">
<title>Requirements</title>
<para>You'll have to download and compile only one package (OpenJade). This HOWTO will explain the compilation process, but you should be familiar with installing from source code. </para>
<para>Most of the packages that we need are located at <ulink url="http://www.tldp.org/authors/index.html#resources">The Linux Documentation Project (TLDP)</ulink> website.</para>
<sect2>
<title>Pre-requirements</title>
<para> Create a directory <filename class="directory">/tmp/downloads</filename>. We will use this directory to store the downloaded source code. </para>
</sect2>
<sect2>
<title>OpenJade</title>
<para>OpenJade will be used to process DocBook documents. OpenJade can be downloaded from: <ulink url="http://openjade.sourceforge.net/">http://openjade.sourceforge.net/</ulink>. </para>
<para>At the time of writing this document OpenJade 1.3.1 was available. Download the openjade-1.3.x.tar.gz file.</para>
</sect2>
<sect2>
<title>DocBook DTDs</title>
<para>All the DocBook DTDs are available from The Linux Documentation Project website at <ulink url="http://www.tldp.org/authors/index.html#resources">http://www.tldp.org/authors/index.html#resources</ulink></para>
<para>Please download <ulink url="http://www.tldp.org/authors/tools/docbk41.zip">DocBook SGML v4.1</ulink>, <ulink url="http://www.tldp.org/authors/tools/docbk31.zip">DocBook SGML v3.1</ulink>, and <ulink url="http://www.tldp.org/authors/tools/docbkx412.zip">DocBook XML v4.1.2</ulink>. </para>
<note>
<title>Note</title>
<para>Please download all the zip archives.</para>
</note>
</sect2>
<sect2>
<title>ISO Entities</title>
<para> <ulink url="http://www.tldp.org">The Linux Documentation Project</ulink> has packaged all the Entities into one big tar file and placed it at <ulink url="http://www.tldp.org/authors/tools/entities.tar.gz">http://www.tldp.org/authors/tools/entities.tar.gz</ulink> for the convenience of the users. Thanks to TLDP for this. </para>
</sect2>
<sect2>
<title>Norman Walsh's DSSSL</title>
<para>Norman Walsh's DSSSL can be downloaded from the DocBook project website at <ulink url="http://sourceforge.net/project/showfiles.php?group_id=21935">http://sourceforge.net/project/showfiles.php?group_id=21935</ulink>. </para>
<para> At the time of writing this document docbook-dsssl-1.7.6 was available. </para>
</sect2>
<sect2>
<title> LDP customized DSL stylesheets</title>
<para> LDP DSL is a customized style sheet used by <ulink url="http://www.tldp.org">The Linux Documentation Project (TLDP)</ulink>. It is an extension to Norman Walsh's DSSSL. It add things like background and Table of Contents. It can be downloaded from <ulink url="http://www.tldp.org/authors/tools/ldp.dsl">http://www.tldp.org/authors/tools/ldp.dsl</ulink>. </para>
<para>ldp.dsl requires Normal Walsh's DSSSL</para>
</sect2>
<sect2>
<title>HTMLDOC (Optional)</title>
<para>HTMLDOC can be used for converting the HTML to PDF. If you would like to produce PDF documents, please download HTMLDOC from <ulink url="http://www.easysw.com/htmldoc/software.php">http://www.easysw.com/htmldoc/software.php</ulink> </para>
</sect2>
<sect2>
<title>Norman Walsh's XSL (Optional)</title>
<para>This is not necessary. But if you would like to serve DocBook 4.1.2 XML content using Tomcat + Cocoon, you will need Norman Walsh's XML Style Sheets.</para>
<para>The Style Sheets are available for download at <ulink url="http://sourceforge.net/projects/docbook/">http://sourceforge.net/projects/docbook/</ulink>.</para>
<para>Please download the package called docbook-xsl.</para>
<note>
<title>Note</title>
<para>Recently docbook-xsl ver. 1.57.0 was released. This document is verified with the latest version, and appropriate modifications have been made. If you still encounter any errors please email me @ <email>saqib@seagate.com</email></para>
</note>
</sect2>
<sect2>
<title>LDP Customized XSL (Optional)</title>
<para>Also download the LDP Customized XSL from <ulink url="http://my.core.com/~dhorton/docbook/tldp-xsl/">http://my.core.com/~dhorton/docbook/tldp-xsl/</ulink></para>
</sect2>
</sect1>
<sect1 id="inst-openjade">
<title>Installing Processing Tools - OpenJade</title>
<para>In this section we will install all the tools in the appropriate directories. All the tools go in the <filename class="directory">/usr/local/dbtools/</filename> directory. Create this directory using the following command:</para>
<screen>
<command># mkdir /usr/local/dbtools</command>
</screen>
<sect2>
<title>Installing OpenJade</title>
<para>This process is the easy part, but the most time consuming one too. Keep in mind that OpenJade take a long time to compile. To install OpenJade, complete the following steps:</para>
<orderedlist>
<listitem>
<para>Change directories to <filename class="directory">/tmp/downloads</filename>. </para>
<screen>
<command># cd /tmp/downloads</command>
</screen>
</listitem>
<listitem>
<para>Unzip the file. </para>
<screen>
<command># gzip -d openjade-1.3.x.tar.gz</command>
</screen>
</listitem>
<listitem>
<para>Untar the file.</para>
<screen>
<command># tar -xvf openjade-1.3.x.tar</command>
</screen>
</listitem>
<listitem>
<para>Change directories to <filename class="directory">openjade-1.3</filename></para>
<screen>
<command># cd openjade-1.3.x</command>
</screen>
</listitem>
<listitem>
<para>Run the <command>./configure</command> command.</para>
<screen>
<command># ./configure --prefix=/usr/local/dbtools/openjade</command>
</screen>
</listitem>
<listitem>
<para>Run the <command>make</command> command.</para>
<screen>
<command># make</command>
</screen>
</listitem>
<listitem>
<para>Run the <command>make install</command> command. After this step the OpenJade binaries will be installed under <filename class="directory">/usr/local/dbtools/openjade</filename>.</para>
<screen>
<command># make install</command>
</screen>
</listitem>
<listitem>
<para>Copy the <filename class="directory">dsssl</filename> directory from <filename class="directory">/tmp/downloads/openjade-1.3.x to /usr/local/dbtools/openjade</filename> </para>
<screen>
<command># cp -dpR dsssl /usr/local/dbtools/openjade/</command>
</screen>
</listitem>
</orderedlist>
</sect2>
<sect2>
<title>Installing Norman Walsh's DSSSL</title>
<para> In this step we will install Norman Walsh's DSSSL in an appropriate place. The DSSSL does not have to be compiled. </para>
<orderedlist>
<listitem>
<para>Change directories to <filename class="directory">/tmp/downloads</filename></para>
<screen>
<command># cd /tmp/downloads</command>
</screen>
</listitem>
<listitem>
<para>Unzip the file.</para>
<screen>
<command># gzip -d docbook-dsssl-1.76.tar.gz</command>
</screen>
</listitem>
<listitem>
<para>Untar the file.</para>
<screen>
<command># tar -xvf docbook-dsssl-1.76.tar</command>
</screen>
</listitem>
<listitem>
<para>Move the file to the <filename class="directory">/usr/local/dbtools/docbook-dsssl</filename>.</para>
<screen>
<command># mv docbook-dsssl-1.76 /usr/local/dbtools/docbook-dsssl</command>
</screen>
</listitem>
</orderedlist>
</sect2>
<sect2>
<title>Installing DocBook DTDs</title>
<para>In this section we will install the DocBook DTDs. </para>
<orderedlist>
<listitem>
<para>Change directories to <filename class="directory">/usr/local/dbtools</filename>.</para>
<screen>
<command># cd /usr/local/dbtools</command>
</screen>
</listitem>
<listitem>
<para>Create three new directories called <filename class="directory">dtd3.1</filename>, <filename class="directory">dtd4.1</filename>, and <filename class="directory">dtd4.1.2</filename>.</para>
<screen>
<command># mkdir dtd3.1</command>
<command># mkdir dtd4.1</command>
<command># mkdir dtd4.1.2</command>
</screen>
</listitem>
<listitem>
<para>Change directories to the <filename class="directory">dtd3.1</filename>.</para>
<screen>
<command># cd dtd3.1</command>
</screen>
</listitem>
<listitem>
<para>Unzip the file DocBook SGML v3.1 in this directory.</para>
<screen>
<command># unzip /tmp/downloads/docbk31.zip</command>
</screen>
</listitem>
<listitem>
<para>Change directories to the <filename class="directory">dtd4.1</filename>.</para>
<screen>
<command># cd ../dtd4.1</command>
</screen>
</listitem>
<listitem>
<para>Unzip the file DocBook SGML v4.1 in this directory.</para>
<screen>
<command># unzip /tmp/downloads/docbk41.zip</command>
</screen>
</listitem>
<listitem>
<para>Change directories to the <filename class="directory">dtd4.1.2</filename>.</para>
<screen>
<command># cd ../dtd4.1.2</command>
</screen>
</listitem>
<listitem>
<para>Unzip the file DocBook XML v4.1.2 in this directory.</para>
<screen>
<command># unzip /tmp/downloads/docbk412.zip</command>
</screen>
</listitem>
</orderedlist>
</sect2>
<sect2>
<title>Installing the ISO Entities</title>
<para>In this section we will install the ISO entities that we downloaded from the LDP website.</para>
<para>First we install the ISO Entities for the 3.1 SGML DTD.</para>
<orderedlist>
<listitem>
<para>Change directories to the <filename class="directory">/usr/local/dbtools/dtd3.1</filename> directory.</para>
<screen>
<command># cd /usr/local/dbtools/dtd3.1</command>
</screen>
</listitem>
<listitem>
<para>Copy <filename>/tmp/download/entities.tar.gz</filename> to this directory.</para>
<screen>
<command># cp /tmp/download/entities.tar.gz .</command>
</screen>
</listitem>
<listitem>
<para>Unzip the file.</para>
<screen>
<command># gzip -d entities.tar.gz</command>
</screen>
</listitem>
<listitem>
<para>Untar the file.</para>
<screen>
<command># tar -xvf entities.tar</command>
</screen>
</listitem>
</orderedlist>
<para>Next we install the ISO Entities for the 4.1 SGML DTD.</para>
<orderedlist>
<listitem>
<para>Change directories to the <filename class="directory">/usr/local/dbtools/dtd4.1</filename> directory.</para>
<screen>
<command># cd /usr/local/dbtools/dtd4.1</command>
</screen>
</listitem>
<listitem>
<para>Copy <filename>/tmp/download/entities.tar.gz</filename> to this directory.</para>
<screen>
<command># cp /tmp/download/entities.tar.gz .</command>
</screen>
</listitem>
<listitem>
<para>Unzip the file.</para>
<screen>
<command># gzip -d entities.tar.gz</command>
</screen>
</listitem>
<listitem>
<para>Untar the file.</para>
<screen>
<command># tar -xvf entities.tar</command>
</screen>
</listitem>
</orderedlist>
</sect2>
<sect2>
<title>Installing the LDP DSL</title>
<para>Finally we install the customised LDP stylesheet.</para>
<orderedlist>
<listitem>
<para>Change directories to the <filename class="directory">/tmp/download</filename> directory.</para>
<screen>
<command># cd /tmp/download </command>
</screen>
</listitem>
<listitem>
<para>Copy the <filename>ldp.dsl</filename> file to the <filename class="directory"> /usr/local/dbtools/docbook-dsssl/print/ldp.dsl</filename> directory.</para>
<screen>
<command># cp ldp.dsl /usr/local/dbtools/docbook-dsssl/print/ldp.dsl</command>
</screen>
</listitem>
<listitem>
<para>Copy the <filename>ldp.dsl</filename> file to the <filename class="directory"> /usr/local/dbtools/docbook-dsssl/html/ldp.dsl</filename> directory.</para>
<screen>
<command># cp ldp.dsl /usr/local/dbtools/docbook-dsssl/html/ldp.dsl</command>
</screen>
</listitem>
</orderedlist>
</sect2>
<sect2>
<title>Installing HTMLDOC</title>
<para>This step is optional. It is only required if you want to produce PDF documents from HTML.</para>
<para>Change back to the downloads directory.</para>
<screen>
<command># Change to /tmp/download directory</command>
</screen>
<para>Untar the source code for HTMLDOC.</para>
<screen>
<command># gzip -d htmldoc-1.8.xx-source.tar.gz </command>
<command># tar -xvf htmldoc-1.8.xx-source.tar </command>
<command># cd htmldoc-1.8.xx-1</command>
</screen>
<para>Run configure to set the installation location.</para>
<screen>
<command># ./configure --prefix=/usr/local/dbtools/htmldoc</command>
<command># make</command>
</screen>
<para>At the time of writing this document HTMLDOC ver 1.8.20-1 was available. This version had a little problem in the fonts Makefile. It would complain while installing the fonts, because the correct fonts were not available on the system.</para>
<para>Here is the error you will get while running <command>make install</command>:</para>
<screen>
<command># make install</command>
Making all in htmldoc...
Making all in doc...
Installing in fonts...
Installing font files in /usr/local/dbtools/htmldoc/share/htmldoc/fonts...
/bin/cp: cannot stat `ZapfChancery.afm': No such file or directory
/bin/cp: cannot stat `ZapfChancery.pfa': No such file or directory
/bin/cp: cannot stat `ZapfDingbats.afm': No such file or directory
/bin/cp: cannot stat `ZapfDingbats.pfa': No such file or directory
make[1]: *** [install] Error 1
</screen>
<para> To fix this installation issue, please edit <filename>fonts/Makefile</filename> and comment out the lines with references to ZapfChancery and ZapfDingbats fonts.</para>
<para>Then execute the install:</para>
<screen>
<command># make install</command>
Making all in htmldoc...
Making all in doc...
Installing in fonts...
Installing font files in /usr/local/dbtools/htmldoc/share/htmldoc/fonts...
Installing in data...
Installing in doc...
Installing in htmldoc...
</screen>
</sect2>
</sect1>
<sect1>
<title>Using OpenJade</title>
<para>In this section we will use OpenJade to convert DocBook SGML/XML documents to HTML, RTF, and PDF.</para>
<sect2>
<title>Processing SGML</title>
<sect3>
<title>Setting the SGML_CATALOG_FILES Environmental Variable for SGML</title>
<para>The SGML_CATALOG_FILES variable must be set to point to appropriate catalog files. To set the variable, use the following command for the Bourne shell:</para>
<screen>
<command># export SGML_CATALOG_FILES=/usr/local/dbtools/openjade/dsssl/catalog:/usr/local/dbtools/dtd3.1/docbook.cat:/usr/local/dbtools/docbook-dsssl/catalog</command>
</screen>
<para>Use the following command for the C shell:</para>
<screen>
<command># setenv SGML_CATALOG_FILES /usr/local/dbtools/openjade/dsssl/catalog:/usr/local/dbtools/dtd3.1/docbook.cat:/usr/local/dbtools/docbook-dsssl/catalog</command>
</screen>
</sect3>
<sect3>
<title>SGML to HTML</title>
<para>To convert from SGML to HTML, use the following command: </para>
<screen>
<command># /usr/local/dbtools/openjade/bin/openjade -t sgml -d /usr/local/dbtools/docbook-dsssl/html/ldp.dsl#html DocBook-OpenJade-SGML-XML-HOWTO.sgml </command>
</screen>
<para>To create a non-chunked (all in one) output:</para>
<screen>
<command># /usr/local/dbtools/openjade/bin/openjade -V nochunks -t sgml -d /usr/local/dbtools/docbook-dsssl/html/ldp.dsl#html DocBook-OpenJade-SGML-XML-HOWTO.sgml </command>
</screen>
</sect3>
<sect3>
<title>SGML to RTF</title>
<para> To convert from SGML to RTF, use the following command: </para>
<screen>
<command># /usr/local/dbtools/openjade/bin/openjade -t rtf -d /usr/local/dbtools/docbook-dsssl/print/ldp.dsl#print DocBook-OpenJade-SGML-XML-HOWTO.sgml </command>
</screen>
</sect3>
</sect2>
<sect2>
<title>Processing XML</title>
<para> You can download a sample DocBook 4.1.2 XML file from <ulink url="http://www.xml-dev.com:8080/cocoon/mount/docbook/openjade.xml">http://www.xml-dev.com:8080/cocoon/mount/docbook/openjade.xml</ulink></para>
<sect3>
<title>Setting the SGML_CATALOG_FILES Environmental Variable for XML</title>
<para>The SGML_CATALOG_FILES variable must be set to point to appropriate catalog files. To set the variable, use the following command for the Bourne shell:</para>
<screen>
<command># export SGML_CATALOG_FILES=/usr/local/dbtools/openjade/dsssl/catalog:/usr/local/dbtools/dtd4.1.2/docbook.cat:/usr/local/dbtools/docbook-dsssl/catalog</command>
</screen>
<para>Use the following command for the C shell:</para>
<screen>
<command># setenv SGML_CATALOG_FILES /usr/local/dbtools/openjade/dsssl/catalog:/usr/local/dbtools/dtd4.1.2/docbook.cat:/usr/local/dbtools/docbook-dsssl/catalog</command>
</screen>
</sect3>
<sect3>
<title>XML to HTML</title>
<para> To convert from XML to HTML, use the following command:</para>
<screen>
<command># /usr/local/dbtools/openjade/bin/openjade -t xml -d /usr/local/dbtools/docbook-dsssl/html/ldp.dsl#html /usr/local/dbtools/docbook-dsssl/dtds/decls/xml.dcl DocBook-OpenJade-SGML-XML-HOWTO.xml</command>
</screen>
</sect3>
<sect3>
<title>XML to RTF</title>
<para> To convert from XML to HTML, use the following command:</para>
<screen>
<command># /usr/local/dbtools/openjade/bin/openjade -t rtf -d /usr/local/dbtools/docbook-dsssl/print/ldp.dsl#print /usr/local/dbtools/docbook-dsssl/dtds/decls/xml.dcl DocBook-OpenJade-SGML-XML-HOWTO.xml</command>
</screen>
</sect3>
</sect2>
<sect2>
<title>HTML to PDF (optional)</title>
<para> To convert HTML to PDF we must use HTMLDOC. First create non-chunked HTML output of the SGML:</para>
<screen>
<command># /usr/local/dbtools/openjade/bin/openjade -V nochunks -t sgml -d /usr/local/dbtools/docbook-dsssl/html/ldp.dsl#html DocBook-OpenJade-SGML-XML-HOWTO.sgml </command>
</screen>
<para>Then run HTMLDOC to produce PDF.</para>
<screen>
<command># /usr/local/dbtools/htmldoc/bin/htmldoc -f outfile.pdf input.html</command>
</screen>
</sect2>
</sect1>
<sect1>
<title>Serving DocBook 4.1.2 XML</title>
<para>There are 3 ways to serve DocBook 4.1.2 XML from a web server:</para>
<itemizedlist>
<listitem>
<para>Command line Pre-processed Open Jade, XSLT</para>
</listitem>
<listitem>
<para>Scripting - PHP, Perl, Python</para>
</listitem>
<listitem>
<para>Application server - Tomcat + Cocoon</para>
</listitem>
</itemizedlist>
<para>Using an application server like Cocoon is the best the option.</para>
<note>
<title>Cocoon in Action</title>
<para>To see an example of web server running Tomcat + Cocoon serving DocBook 4.1.2 XML content, please visit <ulink url="http://www.xml-dev.com:8080/cocoon/mount/docbook/">http://www.xml-dev.com:8080/cocoon/mount/docbook/</ulink></para>
</note>
<para> In this section we will see how to serve DocBook 4.1.2 XML content using Tomcat + Cocoon.</para>
<sect2>
<title>Tomcat + Cocoon</title>
<para>Tomcat is the Java Servlet Container. For more information please visit <ulink url="http://jakarta.apache.org/tomcat/index.html">http://jakarta.apache.org/tomcat/index.html</ulink>.</para>
<para>Apache Cocoon is an XML publishing framework. For more information please visit <ulink url="http://xml.apache.org/cocoon/index.html">http://xml.apache.org/cocoon/index.html</ulink>.</para>
<para>This HOWTO will not go into details of setting up Tomcat + Cocoon, since it is already explained in the document <ulink url="http://xml.apache.org/cocoon/installing/index.html">http://xml.apache.org/cocoon/installing/index.html</ulink>. Setting up Tomcat + Cocoon is an easy process and should take less than five minutes.</para>
<para>Once you have the Cocoon + Tomcat setup and working, please follow the next the sections to server DocBook 4.1.2 XML content.</para>
<note><para>One important caveat: users in the field have experienced compatibility issues with the DocBook stylesheets and some versions of the Xalan XML parser. Xalan is the parser bundled with Sun's JRE, so that's what you're using by default. </para></note>
<para><emphasis>At the very least, make sure you're using the latest JRE from Sun (at this writing, 1.4.2).</emphasis></para>
<para>Also consider upgrading the Xalan parser to the latest release. At this writing, the latest Sun JRE, 1.4.2, is bundled with Xalan 2.4.1, while Xalan itself is up to version 2.5.1.</para>
<para>To check the version currently installed, type</para>
<screen><command> # java org.apache.xalan.xslt.EnvironmentCheck</command></screen>
<para>For more info, visit <ulink url="http://xml.apache.org/xalan-j/faq.html">http://xml.apache.org/xalan-j/faq.html</ulink> .</para>
</sect2>
<sect2>
<title>Installing Norman Walsh's XSL</title>
<para>In this step we will install the Norman Walsh's XSL under the <filename class="directory">/usr/local/dbtools/</filename> directory.</para>
<para>Change to the <filename class="directory">/tmp/downloads</filename> directory and untar the docbook-xsl file.</para>
<screen><command># cd /tmp/downloads/</command></screen>
<screen><command># gzip -d docbook-xsl-1.53.0.tar.gz</command></screen>
<screen><command># tar -xvf docbook-xsl-1.53.0.tar</command></screen>
<para>To install the docbook-xsl please move the files to the <filename class="directory">/usr/local/dbtools</filename>.</para>
<screen><command># mv docbook-xsl-1.53.0 /usr/local/dbtool/docbook-xsl</command></screen>
<para>Next install the LDP XSL.</para>
</sect2>
<sect2>
<title>Installing LDP XSL</title>
<para>Unzip the <filename>tldp-xsl-xxxxx.tar.gz</filename> and the copy all the files to the <filename class="directory">/usr/local/dbtools/docbook-xsl/html</filename> directory.</para>
<screen><command># cd /tmp/downloads</command></screen>
<screen><command># gzip tldp-xsl-xxxxx.tar.gz</command></screen>
<screen><command># gzip tldp-xsl-xxxxx.tar</command></screen>
<screen><command># mv tldp-html*.xsl /usr/local/dbtools/docbook-xsl/html</command></screen>
</sect2>
<sect2>
<title>Setting up sitemap.xmap</title>
<para>$COCOON_HOME points to the Cocoon Web Application Directory. This directory is typically <filename class="directory">/usr/local/jakarta-tomcat-4.1.9/webapps/cocoon/</filename></para>
<para>Create a directory named <filename class="directory">docbook</filename> under the <filename class="directory">$COCOON_HOME/mount</filename>. This is where we will put all our DocBook XML 4.1.2 content.</para>
<screen><command># mkdir $COCOON_HOME/mount/docbook</command></screen>
<para>Create a file name sitemap.xmap in the <filename class="directory">$COCOON_HOME/mount/docbook</filename> with the following content:</para>
<screen><command># cd $COCOON_HOME/mount/docbook</command></screen>
<screen><command># vi sitemap.xmap</command></screen>
<screen>
&lt;map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"&gt;
&lt;!-- use the standard components --&gt;
&lt;map:components&gt;
&lt;map:generators default="file"/&gt;
&lt;map:transformers default="xslt"/&gt;
&lt;map:readers default="resource"/&gt;
&lt;map:serializers default="html"/&gt;
&lt;map:selectors default="browser"/&gt;
&lt;map:matchers default="wildcard"/&gt;
&lt;map:transformers default="xslt"/&gt;
&lt;/map:components&gt;
&lt;map:pipelines&gt;
&lt;map:pipeline&gt;
&lt;map:match pattern=""&gt;
&lt;map:generate src="samples.xml"/&gt;
&lt;map:transform src="/usr/local/jakarta-tomcat-4.1.9/webapps/cocoon/mount/editor/stylesheets/simple-page2html.xsl"/&gt;
&lt;map:serialize/&gt;
&lt;/map:match&gt;
&lt;!-- respond to *.html requests with
our docs processed by .xsl --&gt;
&lt;map:match pattern="*.html"&gt;
&lt;map:generate src="{1}.xml"/&gt;
&lt;map:transform src="/usr/local/dbtools/docbook-xsl/html/tldp-html.xsl"/&gt;
&lt;map:serialize type="html"/&gt;
&lt;/map:match&gt;
&lt;!-- later, respond to *.pdf requests with
our docs processed by doc2pdf.xsl --&gt;
&lt;map:match pattern="*.pdf"&gt;
&lt;map:generate src="{1}.xml"/&gt;
&lt;map:transform src="/usr/local/dbtools/docbook-xsl/fo/docbook.xsl"/&gt;
&lt;map:serialize type="fo2pdf"/&gt;
&lt;/map:match&gt;
&lt;map:match pattern="*.xml"&gt;
&lt;map:generate src="{1}.xml"/&gt;
&lt;map:serialize type="xml"/&gt;
&lt;/map:match&gt;
&lt;/map:pipeline&gt;
&lt;/map:pipelines&gt;
&lt;/map:sitemap&gt;
</screen>
</sect2>
<sect2>
<title>Accessing DocBook 4.1.2 XML Content from a Web Browser</title>
<para>Place a DocBook 4.1.2 XML file in the <filename class="directory">$COCOON_HOME/mount/docbook/</filename> directory.</para>
<para>A sample file is available from <ulink url="http://www.xml-dev.com:8080/cocoon/mount/docbook/openjade.xml">http://www.xml-dev.com:8080/cocoon/mount/docbook/openjade.xml</ulink>.</para>
<para>Now you can access the document using a browser at http://localhost:8080/cocoon/mount/sample.html (HTML) or http://localhost:8080/cocoon/mount/sample.pdf (PDF).</para>
</sect2>
</sect1>
<sect1>
<title>Further Information</title>
<para>This section has some pointers to related resources on the Internet.</para>
<para> If you would like to suggest additional resources for this section, please email me at <email>saqib@seagate.com</email>. Thanks.</para>
<sect2>
<title>News groups</title>
<para>Some of the news groups of interest are:</para>
<orderedlist>
<listitem>
<para>comp.text.sgml (easily accessible from <ulink url="http://groups.google.com/groups?group=comp.text.sgml">Google! Groups</ulink>)</para>
</listitem>
<listitem>
<para>comp.text.xml (easily accessible from <ulink url="http://groups.google.com/groups?group=comp.text.xml">Google! Groups</ulink>)</para>
</listitem>
<listitem>
<para>htmldoc.general (server - <ulink url="nttp://news.easysw.com">news.easysw.com</ulink>)</para>
</listitem>
</orderedlist>
</sect2>
<sect2>
<title>Mailing Lists</title>
<para>Here are some relevant mailing lists.</para>
<orderedlist>
<listitem>
<para>DocBook mailing list @ OASIS. Visit <ulink url="http://www.oasis-open.org/committees/docbook/mailinglist/index.shtml">http://www.oasis-open.org/committees/docbook/mailinglist/index.shtml</ulink> for more info.</para>
</listitem>
<listitem>
<para>DocBook mailing list @ TLDP. Visit <ulink url="http://www.tldp.org/mailinfo.html">http://www.tldp.org/mailinfo.html</ulink> for more info.</para>
</listitem>
<listitem>
<para>xml-doc @ Yahoo Groups. Visit <ulink url="http://groups.yahoo.com/group/xml-doc/">http://groups.yahoo.com/group/xml-doc/</ulink> for more info.</para>
</listitem>
</orderedlist>
</sect2>
<sect2>
<title>IRC</title>
<orderedlist>
<listitem>
<para>DocBook IRC Channel. #docbook on <ulink url="irc://irc.openprojects.net">irc://irc.openprojects.net</ulink></para>
</listitem>
</orderedlist>
</sect2>
<sect2>
<title>Web Sites</title>
<orderedlist>
<listitem>
<para><ulink url="http://www.oasis-open.org/">http://www.oasis-open.org/</ulink> OASIS maintains various DocBook DTDs</para>
</listitem>
<listitem>
<para><ulink url="http://www.xml-dev.com/blog/">http://www.xml-dev.com/blog/</ulink> XML / XHTML WebLog</para>
</listitem>
<listitem>
<para><ulink url="http://docbook.org/wiki/moin.cgi/">http://docbook.org/wiki/moin.cgi/</ulink> The DocBook Wiki</para>
</listitem>
<listitem>
<para><ulink url="http://www.docbook.org/tdg/en/">http://www.docbook.org/tdg/en/</ulink> Online version of DocBook: The Definitive Guide</para>
</listitem>
<listitem>
<para><ulink url="http://www.bureau-cornavin.com/opensource/crash-course/index.html">http://www.bureau-cornavin.com/opensource/crash-course/index.html</ulink> Writing Documentation Using DocBook: A Crash Course</para>
</listitem>
<listitem>
<para><ulink url="http://www-106.ibm.com/developerworks/library/l-docbk.html">http://www-106.ibm.com/developerworks/library/l-docbk.html</ulink> A gentle guide to DocBook (very good introduction).</para>
</listitem>
<listitem>
<para><ulink url="http://www.tldp.org/LDP/LDP-Author-Guide/index.html">http://www.tldp.org/LDP/LDP-Author-Guide/index.html</ulink> The Linux Documentation Project (TLDP) Author Guide</para>
</listitem>
<listitem>
<para><ulink url="http://www.tldp.org/authors/index.html#resources">http://www.tldp.org/authors/index.html#resources</ulink> DocBook resources provided by TLDP</para>
</listitem>
<listitem>
<para><ulink url="http://www.tldp.org/HOWTO/DocBook-Demystification-HOWTO/">http://www.tldp.org/HOWTO/DocBook-Demystification-HOWTO/</ulink> Eric Raymond's DocBook Demystification HOWTO</para>
</listitem>
<listitem>
<para><ulink url="http://www.xml-dev.com:8080/cocoon/mount/docbook/">http://www.xml-dev.com:8080/cocoon/mount/docbook/</ulink>Tomcat + Cocoon + DocBook Setup Sample Site</para>
</listitem>
</orderedlist>
</sect2>
<sect2>
<title>XML Authoring / Modeling Applications</title>
<note>
<title>Note</title>
<para> <emphasis role="strong">A comprehensive list of XML editors can be found at <ulink url="http://www.xml-dev.com/blog/#19">http://www.xml-dev.com/blog/#19</ulink></emphasis></para>
</note>
<orderedlist>
<listitem>
<para>eXchaNGeR - The XML Browser (and XML Editor)<ulink url="http://xngr.org/">http://xngr.org/</ulink></para>
</listitem>
<listitem>
<para>XERLIN - XML Modeling Application<ulink url="http://www.xerlin.org/">http://www.xerlin.org/</ulink></para>
</listitem>
<listitem>
<para>DocPro by Command Prompt, INC. <ulink url="http://www.commandprompt.com/entry.lxp?lxpe=2">http://www.commandprompt.com/entry.lxp?lxpe=2</ulink></para>
</listitem>
<listitem>
<para>YAWC Pro by XML Workshop LTD. <ulink url="http://www.yawcpro.com/">http://www.yawcpro.com/</ulink>. Can be used for converting MS Word to Simple DocBook XML. </para>
</listitem>
<listitem>
<para>Logictran RTF Converter. <ulink url="http://www.logictran.com/">http://www.logictran.com/</ulink>. Word/RTF to HTML/XML.</para>
</listitem>
<listitem>
<para>MajiX - Word to XML converter. <ulink url="http://tetrasys.dhs.org/">http://tetrasys.dhs.org/</ulink></para>
</listitem>
<listitem>
<para>XMETAL by SoftQuad <ulink url="http://www.softquad.com/">http://www.softquad.com/</ulink> </para>
</listitem>
<listitem>
<para>Tagless Editor by i4i (DocBook DTD not supported) <ulink url="http://www.i4i.com/">http://www.i4i.com/</ulink></para>
</listitem>
<listitem>
<para>XML Editor by XMLmind <ulink url="http://www.xmlmind.com/xmleditor/">http://www.xmlmind.com/xmleditor/</ulink></para>
</listitem>
<listitem>
<para>upCast and downCast by Inifinity Loop <ulink url="http://www.infinity-loop.de/en/products.html">http://www.infinity-loop.de/en/products.html</ulink></para>
</listitem>
<listitem>
<para>W2XML by DocSoft<ulink url="http://www.docsoft.com/w2xmlv2.htm">http://www.docsoft.com/w2xmlv2.htm</ulink></para>
</listitem>
<listitem>
<para>XMLWrite by Wattle Software<ulink url="http://xmlwriter.net/">http://xmlwriter.net/</ulink></para>
</listitem>
<listitem>
<para>oXygen XML Editor - Java Based<ulink url="http://www.oxygenxml.com/">http://www.oxygenxml.com/</ulink></para>
</listitem>
<listitem>
<para>Xeena by IBM<ulink url="http://www.alphaworks.ibm.com/tech/xeena">http://www.alphaworks.ibm.com/tech/xeena</ulink></para>
</listitem>
<listitem>
<para>Excosoft XML Client<ulink url="http://www.excosoft.se/eweb/site/exc_pd.html">http://www.excosoft.se/eweb/site/exc_pd.html</ulink></para>
</listitem>
<listitem>
<para>Timelux Xpress<ulink url="http://www.timelux.lu/html/Xpress2001.html">http://www.timelux.lu/html/Xpress2001.html</ulink></para>
</listitem>
<listitem>
<para>Morphon<ulink url="http://www.morphon.com/">http://www.morphon.com/</ulink></para>
</listitem>
<listitem>
<para>Conglomerate<ulink url="http://conglomerate.org/">http://conglomerate.org/</ulink></para>
</listitem>
</orderedlist>
</sect2>
</sect1>
</article>