<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!-- Change this to fool CVS -->
<book id="DocBookSys">
  <bookinfo>
    <title>Installing And Using An <acronym>XML</acronym>/<acronym>SGML</acronym> DocBook Editing Suite</title>
    <subtitle>Setting Up A Free <acronym>XML</acronym>/<acronym>SGML</acronym> DocBook Editing Suite For Windows And Unix/Linux/BSD</subtitle>

    <authorgroup>
      <author>
      <firstname>Ashley</firstname>
      <othername>J.S</othername>
      <surname>Mills</surname>
       	<affiliation>
	         <address><email>ashley@ashleymills.com</email></address>
	       </affiliation>
      </author>
    </authorgroup>

    <legalnotice>
      <para>
	       Copyright (c) 2002 The University Of Birmingham 
      </para>
    </legalnotice>

    <revhistory>
      <revision>
        <revnumber>0.8</revnumber>
        <date>03/07/2002</date>
        <revremark>Alpha Release</revremark>
      </revision>
      <revision>
        <revnumber>0.8</revnumber>
        <date>12/07/2002</date>
        <revremark>Beta1 Release</revremark>
      </revision>
      <revision>
        <revnumber>0.9</revnumber>
        <date>22/07/2002</date>
        <revremark>Beta2 Release</revremark>
      </revision>
      <revision>
        <revnumber>1.0</revnumber>
        <date>13/10/02</date>
        <revremark>First real release</revremark>
      </revision>
    </revhistory>
  </bookinfo>

  <part id="DocBookSys-SettingUp"><title>Setting Up Your System To Author DocBook Documents</title>
    <chapter id="DocBookSys-Chapter1-Introduction"><title>Introduction</title>
  <sect1 id="DocBookSys-Chapter1-Introduction-Introduction"><title>Introduction</title>
    <para> 
      <ulink url="http://www.docbook.org/">DocBook</ulink> is a <acronym>DTD</acronym> (Document Type Definition) defined in either <ulink url="http://www.w3.org/MarkUp/SGML/"><acronym>SGML</acronym></ulink> (Standard Generalised Markup Language) or <acronym>XML</acronym> (Extensible Markup Language).  <ulink url="http://www.w3.org/MarkUp/"><acronym>HTML</acronym></ulink> (Hypertext Markup Language) is another <acronym>DTD</acronym> defined in <acronym>SGML</acronym>.  The <acronym>DTD</acronym> specifies how certain components of the language should be interpreted for example: 
    </para>
 
    <programlisting>
&lt;html&gt;
  &lt;head&gt;&lt;title&gt;HelloWorld&lt;/title&gt;&lt;/head&gt; <co id="html-ex-title"/>
  &lt;body&gt;
    &lt;p&gt;
    &lt;b&gt;Hello World!&lt;/b&gt; <co id="html-ex-bold"/>
    &lt;/p&gt;
  &lt;/body&gt;
&lt;html&gt;
    </programlisting>

    <calloutlist>
      <callout arearefs="html-ex-title">
        <para>HTML must start with a head element containing the title element.</para> 
      </callout>

      <callout arearefs="html-ex-bold">
        <para>The text &quot;Hello World&quot; is encased in bold tags, which are allowed within the &lt;p&gt; tag.</para>
      </callout>
    </calloutlist>

    <para>
      DocBook is a <acronym>DTD</acronym> particularly suited to technical writing but it is not limited to it.  One of the advantages of using DocBook as apposed to using some other text processing system is that DocBook can be converted into many other formats. DocBook's popularity is increasing but it has already been used in many documentation projects such as:
    </para>

    <itemizedlist>
      <listitem>
        <para><ulink url="http://www.freebsd.org/docproj/">The FreeBSD Documentation Project</ulink></para>
      </listitem>

      <listitem>
        <para><ulink url="http://i18n.kde.org/doc/">The KDE Documentation Project</ulink></para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://developer.gnome.org/projects/gdp/">The GNOME Documentation Project</ulink>
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://www.debian.org/doc/ddp"> The Debian Documentation Project</ulink>
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://www.opensource.apple.com/projects/documentation/"> The Darwin Documentation Project</ulink>
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://linuxdoc.org/">The Linux Documentation Project</ulink>
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://www.theprojects.org/phpdoc/howto/">The PHP Documentation Project</ulink>
        </para>
      </listitem>
    </itemizedlist> 
  </sect1>

  <sect1 id="DocBookSys-Chapter1-Introduction-SGML-VS-XML"><title><acronym>SGML</acronym> vs <acronym>XML</acronym></title>
    <para>
      The DocBook <acronym>DTD</acronym> has been defined in both <acronym>XML</acronym> and <acronym>SGML</acronym>, it is possible to author DocBook documents using either format and produce identical results.  <acronym>SGML</acronym> is the grand-daddy of all markup languages, <acronym>XML</acronym> is a subset of <acronym>SGML</acronym> with an intent on being <emphasis>the</emphasis> format for use on the Internet.  <acronym>XML</acronym> attempts to fill the gap between <acronym>SGML</acronym>, which can be used for just about anything, and <acronym>HTML</acronym> which is severely limited and currently being abused because of this.  The idea is that <acronym>XML</acronym> will be a universal way to mark up documents so that just-in-time conversion to <acronym>XHTML</acronym> can occur and so that information can be exchanged over the Internet in a standard format.  For more about the use of XML and the future of the Internet see <citetitle>XML, Java, and the future of the Web</citetitle>; <ulink url="http://www.ibiblio.org/pub/sun-info/standards/xml/why/xmlapps.htm">http://www.ibiblio.org/pub/sun-info/standards/xml/why/xmlapps.htm</ulink>
    </para>

    <para>
      There is much debate about the virtues of <acronym>XML</acronym> over <acronym>SGML</acronym> and vice-versa. This tutorial will outline both <acronym>XML</acronym> DocBook and <acronym>SGML</acronym> DocBook. It has been announced that DocBook 5.0 will be <acronym>XML</acronym> compliant, this does not mean that one will have to stop using <acronym>SGML</acronym> DocBook just that if one wants the latest support and integration with the latest technologies, one will have to make the switch sometime. I suggest that new users go straight to <acronym>XML</acronym> and ignore the <acronym>SGML</acronym> stuff.
    </para>

    <note>
      <para> 
        The markup of DocBook with <acronym>SGML</acronym> and <acronym>XML</acronym> is almost identical, it does not take much effort to switch to authoring from one to the other.  For more information about <acronym>XML</acronym> and <acronym>SGML</acronym> see <ulink url="http://www.ucc.ie/xml/">http://www.ucc.ie/xml/</ulink> and <ulink url="http://www.oasis-open.org/cover/general.html">http://www.oasis-open.org/cover/general.html</ulink> respectively, for a comparison see <ulink url="http://www.w3.org/TR/NOTE-sgml-xml">http://www.w3.org/TR/NOTE-sgml-xml</ulink>.
      </para>
    </note>
  </sect1> 

  <sect1 id="DocBookSys-Chapter1-Introduction-Preliminary"><title>Preliminary Requirements</title>
    <para>
      In order to understand what is going on in this tutorial one should browse this section to get a brief idea of how the components of the DocBook system interact.  An <acronym>SGML</acronym>/<acronym>XML</acronym> document starts with the DOCTYPE declaration, it looks like this:
    </para>
   
    <programlisting>&lt;!DOCTYPE name FORMALID &quot;Owner//Keyword Description//Language&quot; &gt;,</programlisting>
   
    <para>
      This tells the <acronym>SGML</acronym>/<acronym>XML</acronym> manipulation tools the <acronym>DTD</acronym> in use.  Where <emphasis>name</emphasis> is the name of the root element in the document, i.e.  the tag that encompasses the rest of the document, the tags allowed by a specific <acronym>DTD</acronym> are specified therein.  FORMALID is replaced with either PUBLIC or SYSTEM identifier or both. PUBLIC identifiers identify the <acronym>DTD</acronym> that the document conforms to. SYSTEM identifiers explicitly state the location of the <acronym>DTD</acronym> used in the document by means of a <acronym>URI</acronym> (Uniform Resource Indicator). PUBLIC and SYSTEM IDs are usually both present in the DOCTYPE declaration. See <ulink url="http://www.docbook.org/tdg/en/html/ch02.html#s-pid-sid-catalogs"><citetitle>Public Identifiers, System Identifiers, and Catalog Files</citetitle></ulink>
    </para>

    <para>
      One could write a DocBook document according to the DocBook <acronym>DTD</acronym> and then one could use <acronym>SGML</acronym>/<acronym>XML</acronym> tools to validate and convert the document to other formats.  Generally conversion requires that we apply a stylesheet, stylesheets are written in languages such as DynaText, Panorama, <acronym>SPICE</acronym>, <acronym>JSSS</acronym>, <acronym>FOSI</acronym>,<acronym>CSS</acronym> and <acronym>DSSSL</acronym>. Stylesheets describe how the source document should be transformed to the respective output formats.
    </para>
      
    <para> 
      <acronym>SGML</acronym> DocBook uses <ulink url="http://www.jclark.com/dsssl/"><acronym>DSSSL</acronym></ulink> (Document Style Semantics and Specification Language), <acronym>XML</acronym> DocBook uses <ulink url="http://www.w3.org/Style/XSL/"><acronym>XSL</acronym></ulink> (Extensible Stylesheet Language) <acronym>HTML</acronym> uses <ulink url="http://www.w3.org/Style/CSS/">CSS</ulink> (Cascading Style Sheets).  The stylesheet defines how certain elements should look when converted to various formats, for instance, one may wish that, when converted to <acronym>HTML</acronym>, each sub section of the document should be displayed in Bold 20 point Times New Roman font and that when converted to PostScript each sub section should be displayed in some other font. The stylesheet defines how the converted DocBook document will look.
    </para>

    <para>
      For more information see the <link linkend="DocBookSys-Chapter11-References">reference page</link> and checkout the DocBook FAQ: <ulink url="http://www.dpawson.co.uk/docbook/">http://www.dpawson.co.uk/docbook/</ulink>
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter1-Introduction-About"><title>About this guide</title>
    <para>
      The intent of this document is to provide a set of generic instructions that should enable the average computer user to set up a system for authoring <acronym>SGML</acronym> DocBook and/or <acronym>XML</acronym> documents. A key resource for getting going with DocBook is <citetitle>DocBook: The Definitive guide</citetitle> by Norman Walsh, <ulink url="http://www.docbook.org/tdg/en/html/docbook.html">http://www.docbook.org/tdg/en/html/docbook.html</ulink> This is definitely a recommended read.
    </para>

    <para>
      There are already many guides on the Internet which describe how to set up systems for authoring DocBook in <acronym>XML</acronym>/<acronym>SGML</acronym> and is is advised that one browses these as well in order to get a more comprehensive view of what is going on and how all the system components are interacting, if it is suggested that you should read something, it is probably worth while to do so, but hopefully this guide should be enough to get you started. 
    </para>

    <para>Other tutorials for setting up DocBook or authoring with DocBook:</para>

    <itemizedlist>
      <listitem>
        <para>
          <ulink url="http://ourworld.compuserve.com/homepages/hoenicka_markus/ntsgml.html">http://ourworld.compuserve.com/homepages/hoenicka_markus/ntsgml.html</ulink>.
        </para>

	       <para>
	         <literallayout>
SGML for Windows NT
Setting up a free SGML/XML editing and publishing system on the Windows platform
Markus Hoenicka
          </literallayout>
       	</para>
      </listitem>

      <listitem>
        <para>
          Mark Galassi's <ulink url="http://nis-www.lanl.gov/~rosalia/mydocs/docbook-intro.html"> http://nis-www.lanl.gov/~rosalia/mydocs/docbook-intro.html</ulink>
	       </para>
	       <para>
	         <literallayout>
Get Going With DocBook
Notes for Hackers
Mark Galassi
Cygnus Solutions

Copyright 1998 by Mark Galassi
          </literallayout>
        </para>
      </listitem>

      <listitem>
        <para>
	         <ulink url="http://www.tldp.org/LDP/LDP-Author-Guide/">http://www.tldp.org/LDP/LDP-Author-Guide/</ulink>
	       </para>
        <para>
	         <literallayout>
LDP Author Guide
Mark F. Komarinski
Jorge Godoy
David C. Merrill
          </literallayout>
        </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>
	       </para>

	       <para>
	         <literallayout>
Writing Documentation Using DocBook
A Crash Course
David Rugge
Mark Galassi
Eric Bischoff
          </literallayout>
        </para>
      </listitem>
    </itemizedlist>

    <para>More useful web pages can be found in the <link linkend="DocBookSys-Chapter11-References">reference page</link>.</para>
  </sect1>
</chapter>
    <chapter id="DocBookSys-Chapter2-SGML-Install"><title>Installing And Configuring An <acronym>SGML</acronym> DocBook Authoring System For Windows</title>
    <sect1 id="DocBookSys-Chapter2-SGML-Install-Overview"><title>Overview Of Required Tools</title>
    <itemizedlist>
      <listitem><para><ulink url="http://openjade.sourceforge.net/">OpenJade</ulink> ; for validating and converting <acronym>SGML</acronym> files.</para></listitem>

      <listitem><para><ulink url="http://www.tug.org/texlive.html">TexLive</ulink> ; for the JadeTeX and PdfJadeTeX macro packs.</para></listitem>

      <listitem><para><ulink url="http://www.oasis-open.org/cover/ISOEnts.zip">ISO-Entities</ulink> ; These are required to use the DocBook <acronym>DTD</acronym> properly.</para></listitem> 
      
      <listitem><para><ulink url="http://www.oasis-open.org/docbook/sgml/4.1/">The DocBook <acronym>DTD</acronym></ulink> ; The actual definition of DocBook, used to validate <acronym>SGML</acronym> Docbook sources.</para></listitem>

      <listitem><para><ulink url="http://sourceforge.net/projects/docbook/">The DocBook <acronym>DSSSL</acronym> Stylesheets and Documentation</ulink> ; The stylesheets, specifies how to render <acronym>SGML</acronym> DocBook source to various output formats.</para></listitem>

      <listitem><para><ulink url="http://www.cs.wisc.edu/~ghost/doc/AFPL/get704.htm">GhostScript</ulink> ; Used to manipulate PostScript files.</para></listitem>

      <listitem><para><ulink url="ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/ghostgum/gsv43w32.exe">GhostView</ulink> ; Used to view PostScript files.</para></listitem>
    </itemizedlist>
  </sect1>

  <sect1 id="DocBookSys-Chapter2-SGML-Install-Environment"><title>Setting Up Environment Variables</title>
    <para>
      This installation requires a basic understanding of the target operating system, an understanding of how to change the operating environment etc. This is covered this in documents entitled <ulink url="../winenvars/winenvarshome.html"><citetitle>Configuring A Windows Working Environment</citetitle></ulink> and <ulink url="../unixenvars/unixenvarshome.html"><citetitle>Configuring A Unix Working Environment</citetitle></ulink>.
    </para>

    <note>
      <para>This installation uses the notation &quot;/path/to/where/you/installed/program&quot; to refer to the location the program was installed at, forward slashes are always used but for Windows systems these should be replaced with backslashes and prefixed with &quot;c:&quot;.</para>
    </note>
  </sect1>

  <sect1 id="DocBookSys-Chapter2-SGML-Install-OpenJade"><title>Install OpenJade</title>
    <para>
      Quoting the website <ulink url="http://www.jclark.com/jade/">http://www.jclark.com/jade/</ulink>: <quote>Jade is an implementation of the <acronym>DSSSL</acronym> style language</quote>. Jade stands for James' <acronym>DSSSL</acronym> Engine. Openjade is the continuation of the work started by James Clark, the &quot;Open&quot; bit distinguishes it from the original Jade written by James. More information about OpenJade can be found here: <ulink url="http://openjade.sourceforge.net/">http://openjade.sourceforge.net/</ulink>.
    </para>

    <para>
      OpenJade provides some of the tools required to validate and convert <acronym>SGML</acronym> DocBook files to other formats. The first step is to install OpenJade; download a distribution and do what ever is necessary to install the software.
    </para>

    <sect2 id="DocBookSys-Chapter2-Install-OpenJade-Win"><title>Windows</title>
      <para>
        Download the latest version of OpenJade from <ulink url="http://sourceforge.net/projects/openjade/">http://sourceforge.net/projects/openjade/</ulink>, follow the link to OpenJade and then download the most recent distribution that contains the string &quot;bin&quot; this indicates the windows binaries, the file needed should look something like this:
      </para>

      <para><filename>openjade-1_3_1-2-bin.zip</filename></para>

      <note><para>The version number may be different, depending on how recently updated this document is.</para></note>

      <para>Unzip the archive to a suitable location.</para>

      <para>Append <filename>/path/to/where/you/unzipped/openjade/bin</filename> to the <envar>PATH</envar> environment variable.</para>
    </sect2>

    <sect2 id="DocBookSys-Chapter2-Install-OpenJade-Unix"><title>Unix/Linux/BSD</title>
      <para>
        Get the latest <emphasis>openjade</emphasis> rpm for your Unix/Linux/BSD distribution from <ulink url="http://rpmfind.net/">http://rpmfind.net/</ulink>, install the rpm:
      </para>

      <screen><userinput><command>rpm</command> <option>-ivh</option> <filename>xxx.rpm</filename> (for an install)</userinput>
      <userinput><command>rpm</command> <option>-Uvh</option> <filename>xxx.rpm</filename> (for an upgrade)</userinput></screen>

      <para>
        Here is a page which goes into RPM in more detail: <ulink url="http://www.linux-mandrake.com/en/howtos/mdk-rpm/">http://www.linux-mandrake.com/en/howtos/mdk-rpm/</ulink>.
      </para>

      <para>
        Alternatively, download the source from <ulink url="http://sourceforge.net/projects/openjade/">http://sourceforge.net/projects/openjade/</ulink> and build it in the manner specified in the installation instructions that come with the file. The default installation directory for openjade is (probably) <filename>/usr/local/share/sgml</filename>.
      </para>
    </sect2>
  </sect1>

  <sect1 id="DocBookSys-Chapter2-SGML-Install-Catfiles"><title>Setup <envar>SGML_CATALOG_FILES</envar> environment variable</title>
    <para>
      Catalog files provide the means to map a PUBLIC or SYSTEM identifier in a DOCTYPE declaration to a <acronym>DTD</acronym> (Document Type Definition), note that one may use a catalog file to redirect a SYSTEM identifier. One may exploit and include the official PUBLIC and SYSTEM identifiers of the DOCTYPE in the declaration yet have these mapped to a local copy of the DTD, this enables one to represent the DOCTYPE consistently across multiple machines. The environment variable <envar>SGML_CATALOG_FILES</envar> specifies the location of the catalog file or files.
    </para>

    <note>
      <para>
        It is not obligatory to define the location of catalog files via environment variables, <command>openjade</command> allows, by means of the <option>-c</option> option, the user to specify where the catalog files can be found at runtime.  This can be useful for overriding catalog files.
      </para>
    </note>
    
    <para>An example catalog file entry is shown below:</para>

    <programlisting>
PUBLIC &quot;-//OASIS//DTD DocBook V4.1//EN&quot; &quot;docbook.dtd&quot;
    </programlisting>

    <para>
      Which states that any document that has the PUBLIC ID shown above conforms to the <acronym>DTD</acronym> specified by the second parameter. If one does not setup <envar>SGML_CATALOG_FILES</envar> correctly or does not provide a catalog file to use, when using <command>onsgmls</command> (used to validate <acronym>SGML</acronym> files), one will get an error similar to this:
    </para>

    <screen>onsgmls:somefile.sgml:1:57:W: cannot generate system identifier for public text &quot;-//OASIS//DTD DocBook V4.1//EN&quot;</screen>

    <para>
      Create a new environment variable called <envar>SGML_CATALOG_FILES</envar> in the local environment section. Set it to:
    </para>

    <para><filename>./catalog;/path/to/where/you/unzipped/openjade/dsssl/catalog</filename></para>

    <para>
      <filename>./catalog</filename> ensures that the working directory is included in the catalog file list so if that one may override a catalog file locally if one needs to.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter2-SGML-Install-DTD"><title>Install The <acronym>SGML</acronym> DocBook <acronym>DTD</acronym></title>
    <para>
      In order to use <acronym>SGML</acronym> DocBook one needs a copy of the <acronym>SGML</acronym> DocBook <acronym>DTD</acronym>. This can be obtained from <ulink url="http://www.oasis-open.org/docbook/sgml/4.1/">http://www.oasis-open.org/docbook/sgml/4.1/</ulink> Download.
    </para>

    <para>
      Download the zip archive <ulink url="http://www.oasis-open.org/docbook/sgml/4.1/docbk41.zip">http://www.oasis-open.org/docbook/sgml/4.1/docbk41.zip</ulink> and unzip it to some suitable location.  Append <filename>/path/to/where/you/unzipped/docbk41/docbook.cat</filename> to the <envar>SGML_CATALOG_FILES</envar> environment variable.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter2-SGML-Install-ISO"><title>Install The <acronym>ISO</acronym>-Entities</title>
    <para>
      One must install the ISO Entities: <ulink url="http://www.oasis-open.org/cover/ISOEnts.zip">http://www.oasis-open.org/cover/ISOEnts.zip</ulink>.  The DocBook catalog file references these files, a normal installation seems to produce an error, this is because the format of the <acronym>ISO</acronym> entities is not the same as specified in the DocBook catalog file, for example docbook.cat says:
    </para>

    <programlisting>
PUBLIC &quot;-ISO 8879:1986//ENTITIES Diacritical Marks//EN&quot; &quot;iso-dia.gml&quot;
    </programlisting>

    <para>
      But this file is actually called ISOdia.  In order to fix this I moved these <acronym>ISO</acronym> entities and placed them in the same directory as my DocBook DTD and renamed them so they coordinated with the DocBook catalog file, this solved the error messages produced by <command>onsgmls</command>. One could alternatively change the entries in the catalog file to point to the actual files on the system.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter2-SGML-Install-DSSSL"><title>Install The <acronym>SGML</acronym> DocBook Stylesheets</title>
    <para>
      To render ones <acronym>SGML</acronym> DocBook sources to other file formats one must install stylesheets in order to specify how this rendering is done. Norman Walsh has produced an excellent set of stylesheets to be used with <acronym>SGML</acronym> DocBook, these can be obtained from <ulink url="http://sourceforge.net/project/showfiles.php?group_id=21935">http://sourceforge.net/project/showfiles.php?group_id=21935</ulink> 
    </para>

    <para>
      Download the latest zip version of the file (currently <filename>docbook-dsssl-1.76.zip</filename>) and unzip it to some suitable directory.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter2-SGML-Install-TeX"><title>Install TeX</title>
    <sect2 id="DocBookSys-Chapter2-SGML-Install-TeX-Win"><title>Windows</title>
      <para>
        TeX is a powerful typesetting system created by Donald Knuth of Stanford University.  It is used to produce high-quality technical books and papers. TeX is particularly good at handling complex mathematical expressions. There is a macro package for TeX known as <command>JadeTeX</command> which provides the ability to convert TeX outputted by other formatting tools from <acronym>SGML</acronym> DocBook sources to PDF and PostScript.
      </para>

      <para>
        TeXLive is an excellent all-in-one TeX package, download the installation program from here: <ulink url="ftp://ftp.dante.de/pub/fptex/current/TeXSetup.exe">ftp://ftp.dante.de/pub/fptex/current/TeXSetup.exe</ulink>, execute the program and follow the instructions making sure to install the program in a suitable loaction. Install the <citetitle>Generic recommend TeXLive scheme</citetitle> but check the box that says <quote>I want to customize the selected scheme</quote>. Select the package <filename>tex-htmlxml</filename> because this includes the JadeTeX macros. Also select <filename>tex-extrabin</filename>, <filename>tex-fontbin</filename>, <filename>tex-fontsextra</filename>, <filename>tex-mathextra</filename>, <filename>tex-psfonts</filename> and <filename>tex-psutils</filename>.
      </para>

      <note>
        <para>
          During the TeXLive setup, when on the <citetitle>Root of installation page</citetitle>, to avoid later problems, only to change the <quote>Root directory</quote> field (the others will update automatically), leave the <citetitle>Extra TeXMF tree</citetitle> and <citetitle>Home TeXMF Tree</citetitle> alone.  In other words, do not check the box that says <quote>You can change the default configuration for the main directories.</quote>.
        </para>
      </note>
    </sect2>

    <sect2 id="DocBookSys-Chapter2-SGML-Install-TeX-Unix"><title>Unix/Linux/BSD</title>
      <para>
        There are a number of schools of thought on which is the best TeX distribution to install. A good one is <ulink url="http://www.tug.org/texlive.html">TeXLive</ulink> unfortunately the Unix distribution only comes on CDROM, this is ok, as the CDROM is available free and can be downloaded as an ISO-Image to be burned.  An alternative is teTeX whose homepage is <ulink url="http://www.tug.org/teTeX/">http://www.tug.org/teTeX</ulink>, it is available to download from ftp.
      </para>

      <para>
        The TeXLive distribution allows the installation of the JadeTex macros as an option during installation. They are in the package <filename>tex-htmlxml</filename>. The packages <filename>tex-extrabin</filename>, <filename>tex-fontbin</filename>, <filename>tex-fontsextra</filename>, <filename>tex-mathextra</filename>, <filename>tex-psfonts</filename> and <filename>tex-psutils</filename> should also be installed.
      </para>
    </sect2>
  </sect1>

  <sect1 id="DocBookSys-Chapter2-SGML-Install-Win-JadeTeX"><title>Install JadeTeX</title>
    <para>
      JadeTeX is a set of TeX macros that can convert pseudo-TeX files created by <command>openjade</command> to PostScript and PDF formats.
    </para>

    <para>
      TeXLive comes with JadeTex if it is installed as described above, if the above procedure was not adhered to or a different TeX distribution was installed and it did not come with the JadeTex macros they can be obtained from <ulink url="http://sourceforge.net/projects/jadetex/">http://sourceforge.net/projects/jadetex/</ulink>.  Follow the installation guide at <ulink url="http://jadetex.sourceforge.net/">http://jadetex.sourceforge.net</ulink>.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter2-SGML-Install-Ghost"><title>Install Ghostscript and GhostView</title>
    <sect2 id="DocBookSys-Chapter2-SGML-Install-Ghost-Win"><title>Windows</title>
      <para>
        GhostScript and GhostView are used to view and manipulate PostScript files. Download GhostScript from here <ulink url="http://www.cs.wisc.edu/~ghost/doc/AFPL/get704.htm">http://www.cs.wisc.edu/~ghost/doc/AFPL/get704.htm</ulink> and GhostView from here <ulink url="ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/ghostgum/gsv43w32.exe">ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/ghostgum/gsv43w32.exe</ulink> Follow the installation instructions, it does not matter where you install these files as we do not execute the program from the command line and we do not use its location for anything.  If you want you can setup the <envar>PATH</envar> so that you <emphasis>can</emphasis> use these tools from the command line but there should be no need to.
      </para>
    </sect2>

    <sect2 id="DocBookSys-Chapter2-SGML-Install-Ghost-Unix"><title>Unix/Linux/BSD</title>
      <para> 
        Download GhostScript from: <ulink url="http://sourceforge.net/projects/ghostscript/">http://sourceforge.net/projects/ghostscript/</ulink> and GhostView from: <ulink url="http://www.cs.wisc.edu/~ghost/doc/AFPL/get704.htm">http://www.cs.wisc.edu/~ghost/doc/AFPL/get704.htm</ulink>. This resource page provides some more information: <ulink url="http://www.cs.wisc.edu/~ghost/">http://www.cs.wisc.edu/~ghost/</ulink>. Source code and RPM installations are available.
      </para>
    </sect2>
  </sect1>

  <sect1 id="DocBookSys-Install-Win-CustomStyleSheets"><title>Install The Custom Style-Sheets</title>
    <para>
      It is useful to add a customisation layer on top of the <acronym>DSSSL</acronym> style-sheets so that it is easy to override options specific to a certain type of output without having to rewrite the stylesheets themselves
    </para>

    <para>
      I have produced a custom stylesheet that provides a customisation layer for the <acronym>DSSSL</acronym> stylesheets.  Download it here: <ulink url="files/custom.dsl">custom.dsl</ulink> and save it in the directory <filename>/path/to/where/you/installed/the/stylesheets/commom/</filename>
    </para>

    <para>
      For usage instructions see <link linkend="DocBookSys-Chapter4-SGML-ToolUse-Custom-DSSSL"><citetitle>Chapter 4, Using the custom <acronym>DSSSL</acronym> style-sheets</citetitle></link>.
    </para>
  </sect1> 
</chapter>
    <chapter id="DocBookSys-Chapter3-XML-Install"><title>Installing And Configuring An <acronym>XML</acronym> DocBook System For Windows</title>
  <sect1 id="DocBookSys-Chapter3-XML-Install-Introduction"><title>Introduction</title>
    <para>
      There are a number of different toolchains that can be used to process <acronym>XML</acronym> DocBook documents. For <acronym>XHTML</acronym> output, Saxon or xsltproc can be used (there are others like xalan which is not mentioned here). For <acronym>PDF</acronym> output there are about three routes, one must first produce a <acronym>FO</acronym> intermediate file from the <acronym>XML</acronym> DocBook source, Saxon or xsltproc can be used to do this. The <acronym>FO</acronym> output can then either be rendered to <acronym>PDF</acronym> via the <emphasis>xmlpdftex</emphasis> macros or rendered to <acronym>PDF</acronym> via <acronym>FOP</acronym>. The preferred route is:
    </para>

    <programlisting>(XML DocBook Source) --- (Saxon or xsltproc) ---&gt; (FO) --- (FOP) ---&gt; (PDF)</programlisting>

    <para>
      I personally prefer xsltproc but I tend to adjust my preference depending on the current state of the tools (for instance one might have support for a particular feature that the other does not), although generally this is not the case. The installation instructions for the less popular tool chains have been included to afford some redundancy to this file.
    </para>

    <para>
      Setting up a system for <acronym>XML</acronym> Docbook authoring is similar in some respects to the process of setting up a system for <acronym>SGML</acronym> DocBook authoring, some of the steps are identical:
    </para>

    <orderedlist>
      <listitem><para><link linkend="DocBookSys-Chapter2-SGML-Install-TeX">Install a TeX distribution</link></para></listitem>
      <listitem><para><link linkend="DocBookSys-Chapter2-SGML-Install-Ghost">Install GhostView</link></para></listitem>
    </orderedlist>

    <para>
      This installation requires a basic understanding of the target operating system, an understanding of how to change the operating environment etc. This is covered this in documents entitled <ulink url="../winenvars/winenvarshome.html"><citetitle>Configuring A Windows Working Environment</citetitle></ulink> and <ulink url="../unixenvars/unixenvarshome.html"><citetitle>Configuring A Unix Working Environment</citetitle></ulink>.
    </para>

    <note>
      <para>This installation uses the notation &quot;/path/to/where/you/installed/program&quot; to refer to the location the program was installed at, forward slashes are always used but for Windows systems these should be replaced with backslashes and prefixed with &quot;c:&quot;.</para>
    </note>
  </sect1>

  <sect1 id="DocBookSys-Chapter3-XML-Install-Java"><title>Installing the JAVA Runtime Environment</title>
    <para>
      Saxon and <acronym>FOP</acronym> are written in Java, this is primarily because Java has a nice Unicode implementation and <acronym>XML</acronym> uses Unicode so it is slightly easier to program <acronym>XML</acronym> processing tools in Java.  Java is a byte compiled language, this means that it is compiled to a sort of Java-machine-language which is then interpreted by the Java runtime environment, this is for portability reasons.  At the moment there are no official machine-level compilers for the Java programming language so there are no executables of the tools written in Java that can be run natively, hence it is necessary to install the Java runtime environment in order to execute Java programs.
    </para>
    
    <para>
      Download the the Java runtime environment from <ulink url="http://java.sun.com/j2se/downloads.html">http://java.sun.com/j2se/downloads.html</ulink>. Follow the installation instructions. 
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter3-XML-Install-libxml"><title><command>libxml</command></title>
    <para>
      Within this tutorial the primary purpose for installing the libxml C library will be to gain access the tools that come with it. The tools provide the means to validate and transform <acronym>XML</acronym> files. In this tutorial, the program <command>xmllint</command> will be used to validate <acronym>XML</acronym> DocBook files before processing. The program <command>xsltproc</command> can be used to transform <acronym>XML</acronym> files. It is a program which uses <acronym>XSLT</acronym>.
    </para>

    <sect2 id="DocBookSys-Chapter3-XML-Install-libxml-Windows"><title>Windows</title>
      <para>
        To install <emphasis role="strong">libxml</emphasis> on a Windows machine one needs to download the Windows binaries and libraries. These can be obtained from <ulink url="http://www.zlatkovic.com/pub/libxml/">http://www.zlatkovic.com/pub/libxml/</ulink>. Download the following:
      </para>
  
      <itemizedlist>
        <listitem><para><ulink url="http://www.zlatkovic.com/pub/libxml/libxml2-2.6.2+.win32.zip">libxml2-2.6.2+.win32.zip</ulink></para></listitem>
        <listitem><para><ulink url="http://www.zlatkovic.com/pub/libxml/libxslt-1.1.0.win32.zip">libxslt-1.1.0.win32.zip</ulink></para></listitem>
        <listitem><para><ulink url="http://www.zlatkovic.com/pub/libxml/iconv-1.9.1.win32.zip">iconv-1.9.1.win32.zip</ulink></para></listitem>
      </itemizedlist>
  
      <note>
        <para>
          The three links shown immediately above may be broken since it is common practice to remove old versions from a download page when they are obsoleted. Goto <ulink url="http://www.zlatkovic.com/pub/libxml/">http://www.zlatkovic.com/pub/libxml/</ulink> instead and download the <filename>libxml2...</filename>, <filename>libxslt...</filename>, and <filename>iconv...</filename> files with the highest version numbers. Some older versions are available in the directory <filename>oldreleases</filename> on that server, should one desire them.
        </para>
      </note>
  
      <para>
        It is not necessary to extract the content of these zips entirely, instead the required functionality will be extracted. Create a suitable directory to contain the stuff that is about to be extracted. For example, on my home machine. If I am running a Windows system I have a directory called <filename>c:\tools</filename> which contains all the tools I install. Within <filename>c:\tools</filename> I have a directory called <filename>libxml</filename> that contains the stuff I want from these zips. Create a suitable directory to extract the desired content from the zips into.
      </para>
 
      <para>Extract the following files from the <filename>libxml</filename> archive into the directory.</para>
  
      <itemizedlist>
        <listitem><para><filename>libxml2.dll</filename></para></listitem>
        <listitem><para><filename>xmllint.exe</filename></para></listitem>
      </itemizedlist>
  
      <para>Extract the following files from the <filename>libxslt</filename> archive into the directory.</para>

      <itemizedlist>
        <listitem><para><filename>libexslt.dll</filename></para></listitem>
        <listitem><para><filename>libxslt.dll</filename></para></listitem>
        <listitem><para><filename>xsltproc.exe</filename></para></listitem>
      </itemizedlist>
  
      <para>Extract the following files from the <filename>iconv</filename> archive into the directory.</para>

      <itemizedlist>
        <listitem><para><filename>iconv.dll</filename></para></listitem>
        <listitem><para><filename>iconv.exe</filename></para></listitem>
      </itemizedlist>
  
      <para>
        Append <filename>\directory\you\just\unzipped\everything\to</filename> to the <envar>PATH</envar> environment variable.
      </para>
  
      <para>
        You might not use <emphasis>all</emphasis> the tools but they are worth having around in case you decide you need them.
      </para>
    </sect2> 

    <sect2 id="DocBookSys-Chapter3-XML-Install-libxml-Unix"><title>Linux/Unix/BSD</title>
      <para>
          These files are probably already installed on your system, as most modern distributions of these operating systems use <acronym>XML</acronym> processing for some of  the more popular components. But you may wish to get the latest versions, in which case, goto <ulink url="ftp://xmlsoft.org/">ftp://xmlsoft.org/</ulink> and get the latest <emphasis role="strong">libxml2</emphasis> and <emphasis>libxslt</emphasis>. There are gzipped tars and <acronym>RPM</acronym>s available, download whichever you prefer. A list of the latest files at the time of writing is shown below:
      </para>

      <programlisting>
        <filename>libxml2-2.4.25.tar.gz</filename>
        <filename>libxml2-2.4.25-1.i386.rpm</filename>
        <filename>libxml2-2.4.25-1.src.rpm</filename>
        <filename>libxslt-1.0.21.tar.gz</filename>
        <filename>libxslt-1.0.21-1.i386.rpm</filename>
        <filename>libxslt-1.0.21-1.src.rpm</filename>
      </programlisting>

      <para>
        The ftp directory also contains <emphasis>devel</emphasis> versions of the software, this is for people who want to develop with libxml.
      </para>
    </sect2>
  </sect1>

  <sect1 id="DocBookSys-Chapter3-XML-Install-Saxon"><title>Install Saxon</title>
    <orderedlist>
      <listitem>
        <para>
          Download the latest distribution of Saxon from <ulink url="http://saxon.sourceforge.net/">http://saxon.sourceforge.net/</ulink> and unzip the zip to a suitable location.
        </para>
      </listitem>

      <listitem>
        <para>
          Append <filename>/directory/you/unzipped/saxon/saxon.jar</filename> to the <envar>CLASSPATH</envar> environment variable. If integration with <acronym>FOP</acronym> is desired, append <filename>/directory/you/unzipped/saxon/saxon-fop.jar</filename> to the <envar>CLASSPATH</envar> environment variable. If integration with JDOM is desired, append <filename>/path/to/where/you/unzipped/saxon/saxon-jdom.jar</filename> to the <envar>CLASSPATH</envar> environment variable.
        </para>
      </listitem>
    </orderedlist>
    <sect2 id="DocBookSys-Chapter3-XML-Install-Saxon-Resolver"><title>Setup Catalog Resolver</title>
      <para>
        A catalog resolver provides a way to use catalog files with Java tools like Saxon, the details of this can be found in the documentation that comes with the installation download.
      </para>

      <orderedlist>
        <listitem>
          <para>
            Download the <acronym>XML</acronym> Entity and <acronym>URI</acronym> Resolvers package from <ulink url="http://wwws.sun.com/software/xml/developers/resolver/">http://wwws.sun.com/software/xml/developers/resolver/</ulink>. You have to register to download.
          </para>
        </listitem>
        <listitem>
          <para>
            Unzip the package to some suitable location, add the file <filename>resolver.jar</filename> to your <envar>CLASSPATH</envar> environment variable.
          </para>
        </listitem>

        <listitem>
          <para>
            Append the directory where the resolver tool was unzipped to the <envar>CLASSPATH</envar> environment variable.
          </para>
        </listitem>
      </orderedlist>

      <para>
        The Resolver is now ready to use with Saxon but by default it uses the AElfred <acronym>XML</acronym> parser that comes with Saxon. This has a few problems so it is best to invoke Saxon and specify that xerces should be used instead. Note that this requires that xerces be installed, usually this consists of having the file <filename>xerces.jar</filename> in the <envar>CLASSPATH</envar>. It is likely that if other tools such as <acronym>FOP</acronym> have been installed that this is already the case, if it is not, download and install xerces from <ulink url="http://xml.apache.org/xerces-j/">http://xml.apache.org/xerces-j/</ulink>.
      </para>

      <para>One invokes Saxon and specifies that xerces should be used as the <acronym>XML</acronym> parser like this:</para>


      <screen>
        <userinput>
          java -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
               -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
               -Djavax.xml.transform.TransformerFactory=com.icl.saxon.TransformerFactoryImpl
               com.icl.saxon.StyleSheet
        </userinput>
      </screen>

      <para>
        This must all be input on one line, this is where Ant (<ulink url="http://jakarta.apache.org/ant/">http://jakarta.apache.org/ant/</ulink>) comes in very useful. The resolver uses a file called <filename>CatalogManager.properties</filename> to specify various options, this must be present somewhere on the <envar>CLASSPATH</envar>. By default this file resides in the root directory of the resolver zip extraction, hence the adding of this directory to the <envar>CLASSPATH</envar> in step three of the installtion above. Details on setting up <filename>CatalogManager.properties</filename> can be found in the documentation that comes in the downloaded archive. A simple example is shown below:
      </para>

      <programlisting>
#CatalogManager.properties
verbosity=1

# Always use semicolons in this list
catalogs=/lib/docbook-xml-4.2/catalog

# Prefer PUBLIC identifiers over SYSTEM identifiers
prefer=public
      </programlisting>

      <para>This sets up the resolver to use the catalog file specified.</para>
    </sect2>
  </sect1>

  <sect1 id="DocBookSys-Chapter3-XML-Install-Fop"><title><acronym>FOP</acronym></title>
    <para>
      <acronym>FOP</acronym>(Formatting Objects Processor) is used to transform <acronym>FO</acronym> files to files of other formats. In this tutorial it is used to transform <acronym>FO</acronym> output produced by <command>xsltproc</command> into <acronym>PDF</acronym> which is a well known format considered by many to be aesthetically pleasing. The Unix and Windows installation paths are very similar, the differences will be mentioned where appropriate.
    </para>

    <para>
      Download the latest version of the Fop application, from <ulink url="http://ftp.plig.org/pub/apache/dist/xml/fop/">http://ftp.plig.org/pub/apache/dist/xml/fop/</ulink>. Download the zip or tar with <emphasis>bin</emphasis> as a substring of its name to some suitable location.
    </para>

    <para>
      On Windows, append <filename>/directory/where/you/unzipped/fop/fop.bat</filename> to the <envar>PATH</envar> environment variable.
    </para>

    <para>
      On Unix, append <filename>/directory/where/you/unzipped/fop/fop.sh</filename> to the <envar>PATH</envar> environment variable.
    </para>

    <sect2 id="DocBookSys-Chapter3-XML-Install-Fop-Jimi"><title>Install Jimi</title>
      <para>
        Jimi is needed if you want to use <acronym>PNG</acronym> images with <acronym>FOP</acronym>, download it from <ulink url="http://java.sun.com/products/jimi/#">http://java.sun.com/products/jimi/#</ulink> and open the archive.
      </para>

      <para>
        On Windows, rename <filename>JimiProClasses.zip</filename> from the archive to <filename>jimi-1.0.jar</filename> and place it in the <filename>/directory/where/you/unzipped/fop/lib</filename> directory.
      </para>

      <para>
        On Unix, rename <filename>JimiProClasses.zip</filename> from the archive to <filename>JimiProClasses.jar</filename>and place it in the <filename>/directory/where/you/unzipped/fop/lib</filename> directory.
      </para>
    </sect2>
  </sect1>

  <sect1 id="DocBookSys-Chapter3-XML-Install-DocBook"><title>DocBook <acronym>DTD</acronym></title>
    <para>
      The DocBook <acronym>DTD</acronym>(Document Type Definition) contains rules which specify the structure of a valid DocBook document, for example, the order that elements may appear and valid attributes etc. If one has a document which one claims is written in DocBook, it is not written in DocBook unless it conforms to the DocBook <acronym>DTD</acronym>. The <acronym>DTD</acronym> is used by tools like <command>xsltproc</command> in transforming DocBook documents.
    </para>
      
    <para>
      <acronym>DTD</acronym>'s are especially useful when one wants to validate a document to check that it conforms to the <acronym>DTD</acronym> one claims it conforms to. Validation is beneficial because a valid document is less likely to break processing tools (if a valid document does break a processing tool it is likely that the processing tool is broken and not the document). Hence, the DocBook <acronym>DTD</acronym> can be used to validate that a purported DocBook document <emphasis>really is</emphasis> a DocBook document.
    </para>

    <para>
      The latest version, at the time of writing, is called <emphasis role="strong">DocBook XML 4.2</emphasis>, it is distributed from <ulink url="http://www.docbook.org/xml/4.2/index.html">http://www.docbook.org/xml/4.2/index.html</ulink>.
    </para>

    <para>
      Download the zipped archive, <ulink url="http://www.docbook.org/xml/4.2/docbook-xml-4.2.zip">http://www.docbook.org/xml/4.2/docbook-xml-4.2.zip</ulink> and unzip it to some suitable location. For example if I was running the Windows operating system I would unzip it to a directory like <filename>c:\lib\docbook-xml-4.2</filename>, this is the same as the name of the zip file. If I was running a Unix, Linux, or BSD operating system I would unzip it to a directory like <filename>/lib/docbook/docbook-xml-4.2</filename>. You might have noticed on the webpage or in the zip, other files apart from <acronym>DTD</acronym> files, these are auxiliary files and are necessary.
    </para>

    <sect2 id="DocBookSys-Chapter3-XML-Install-DocBook-Catalog"><title>Catalog Files</title>
      <para>
        When one writes a DocBook document in <acronym>XML</acronym> one inserts a DocType declaration at the top of the document to specify that the document is written in DocBook. This declaration specifies the version of DocBook being used with a <emphasis role="strong">PUBLIC</emphasis> ID in the declaration, a <emphasis role="strong">SYSTEM</emphasis> ID in the header specifies where one can find the <acronym>DTD</acronym> for DocBook. In the case of DocBook, usually this <emphasis role="strong">SYSTEM</emphasis> ID points to some location on the <acronym>OASIS</acronym>(Organization for the Advancement of Structured Information Standards) website because this is where DocBook's official home is. Some tools used for processing DocBook use the <acronym>DTD</acronym> at this location, this is no good when one wants to process a DocBook document on a computer that does not have Internet access or where accessing the Internet is undesirable.
      </para>

      <para>
        To overcome the necessity to access the Internet to process DocBook documents one can use a <emphasis>catalog</emphasis> file. A <emphasis>catalog</emphasis> file maps <emphasis role="strong">PUBLIC</emphasis> or <emphasis role="strong">SYSTEM</emphasis> IDs to alternate locations. Taking the example from above, one would process the DocBook document that contained the <emphasis role="strong">SYSTEM</emphasis> ID pointing to the Internet with a tool and specify a catalog file to use. The catalog file would map the <emphasis role="strong">SYSTEM</emphasis> ID pointing to the Internet to a copy of the <acronym>DTD</acronym> on the local system, thus circumventing the need for any Internet access.
      </para>

      <para>
        The DocBook zip that was just downloaded does actually contain it's own catalog file (<filename>catalog.xml</filename>. This does not seem to provide the desired functionality without modification. Instead of modifying that catalog file, create a new one called <filename>catalog</filename> in the <filename>docbook-xml-4.2</filename> directory. Put the following content into it:
      </para>

      <programlisting>
&lt;catalog xmlns=&quot;urn:oasis:names:tc:entity:xmlns:xml:catalog&quot;&gt;
  &lt;group xml:base=&quot;.&quot; prefer=&quot;public&quot; &gt;
  &lt;public publicId=&quot;-//OASIS//DTD DocBook XML V4.2//EN&quot; uri=&quot;file:///c:/lib/docbook-xml-4.2/docbookx.dtd&quot;/&gt;
  &lt;/group&gt;
&lt;/catalog&gt;
      </programlisting>

      <para>
        This maps the <emphasis role="strong">PUBLIC</emphasis> ID for DocBook <acronym>XML</acronym> V4.2 to a local copy of it's <acronym>DTD</acronym>. The example above was taken from a Windows system, modify the value of the <emphasis>uri</emphasis> attribute to point to the location of the <acronym>DTD</acronym> on your system. On a Unix system this could be <filename>file:///lib/docbook/docbook-xml-4.2/docbookx.dtd</filename>.
      </para>

      <para>
        The processing tools must know where this catalog file is in order to use the functionality it provides. This is achieved via an environment variable called <envar>XML_CATALOG_FILES</envar>, create this environment variable and make it point to the catalog file you just created. You could add similar entries to the catalog file shown above to map other <acronym>DTD</acronym>s you desire to use to local copies of their <acronym>DTD</acronym>'s.
      </para>
    </sect2>
  </sect1>

  <sect1 id="DocBookSys-Chapter3-XML-Install-StyleSheets"><title><acronym>XSL</acronym> StyleSheets</title>
    <para>
      <acronym>XSL</acronym> stylesheets dictate how a document written in <acronym>XML</acronym> should be transformed using <acronym>XSLT</acronym> to a particular output format.  In the case of DocBook, Norman Walsh has already written, and regularly maintains some stylesheets for DocBook that provide rules for transformations from an <acronym>XML</acronym> DocBook document to the most commonly desirable output formats such as <acronym>XHTML</acronym> and <acronym>PDF</acronym>. The installation for Unix and Windows machines is the same.
    </para>

    <para>
      Download the latest stylesheets from <ulink url="http://sourceforge.net/project/showfiles.php?group_id=21935">http://sourceforge.net/project/showfiles.php?group_id=21935</ulink> and unzip the zip or gzipped tar to some suitable location. If I was running a Windows system I would use <filename>c:\lib\docbook-xsl\</filename>, if I was using a Unix system I would use <filename>c:\lib\docbook\docbook-xsl</filename>. The stylesheets are now ready to use.
    </para>

    <sect2 id="DocBookSys-Chapter3-XML-Install-StyleSheets-Custom"><title>Custom StyleSheets</title>
      <para>
        The output produced by the stylesheets mentioned above is reasonable but the stylesheets mentioned above are a standard distribution and as a consequence seem to be designed to cater for the needs of the many, which is sensible, unfortunately. One may modify the stylesheets directly but more often one creates a customisation layer which imports the standard stylesheets and then one overrides specific aspects of the standard stylesheets or adds extra functionality within the customisation layer according to ones tastes. I have created a customisation layer which looks good enough for standard applications and am offering it to download.
      </para>

      <para>
        This is particularly pertinent if you study at The University Of Birmingham because any documentation created by me there in DocBook uses this customisation layer, all the tutorials I have written conform to these stylesheets. If you your documents to have the same style as the tutorials then use this customisation layer. It is probably worth downloading the customisation layer anyway so you can see how one goes about creating a customisation layer. Here is the zipped customisation layer: <ulink url="files/custom-stylesheets.zip">custom-stylesheets.zip</ulink>.
      </para>

      <para>
        Unzip the zip to where you want the customisation layer to be situated, this could be within the stylesheets directory or in separate directory. If you unzip it to the stylesheets directory the customisation layer will unzip into the directories <filename>common</filename>, <filename>fo</filename> and <filename>xhtml</filename>. If you unzip to a separate directory these directories will be created.
      </para>

      <para>
        Wherever you unzip the zip, it is important to change the references of the imports in the files so that they reflect the state of your system, the files <filename>fo/customfo.xsl</filename>, <filename>xhtml/customxhtml.xsl</filename> and <filename>xhtml/customchunk.xsl</filename> all have references that may need to be modified. For example, the file <filename>fo/customfo.xsl</filename> has the import line:
      </para>

      <programlisting>
&lt;!-- Import standard fo style-sheet --&gt;
&lt;xsl:import href=&quot;file:///c:/lib/docbook-xsl/fo/docbook.xsl&quot;/&gt;
      </programlisting>

      <para>Change this to point to <filename>/where/you/put/the/stylesheets/fo/docbook.xsl</filename></para>

      <para>
        Similarly, change the entry in <filename>customchunk.xsl</filename> to point to <filename>/where/you/put/the/stylesheets/xhtml/chunk.xsl</filename> and the entry in <filename>customxhtml.xsl</filename> to point to <filename>/where/you/put/the/stylesheets/xhtml/docbook.xsl</filename>. The advantage of unzipping the zip in the same location as the standard stylesheets is that the import links may be relative (the import links can always be relative assuming the stylesheets are on the same machine, but for clarity if I am using a different directory for the customisation stylesheets I will make the import references absolute).
      </para>

      <para>
        I have only provided customisations for <acronym>FO</acronym> and <acronym>XHTML</acronym>. It will become apparent how to use the customisation layer in the section on using the tools later. The provided customisations are listed below:
        </para>

      <itemizedlist>
        <listitem><para><filename>fo/customfo.xsl</filename> - Use this to generate custom <acronym>FO</acronym></para></listitem>
        <listitem><para><filename>xhtml/customxhtml.xsl</filename> - Use this to generate custom <acronym>XHTML</acronym> (segmented)</para></listitem>
        <listitem><para><filename>xhtml/customxchunk.xsl</filename> - Use this to generate custom <acronym>XHTML</acronym> (chunked)</para></listitem>
      </itemizedlist>

      <para>
        More information about customising stylesheets can be found at <ulink url="http://www.sagehill.net/xml/docbookxsl/">http://www.sagehill.net/xml/docbookxsl/</ulink>.
      </para>
    </sect2>
  </sect1>
</chapter>
    <chapter id="DocBookSys-Chapter4-SGML-ToolUse"><title>Using The <acronym>SGML</acronym> Tools</title>
  <sect1 id="DocBookSys-Chapter4-SGML-ToolUse-About"><title>About this chapter</title>
    <para>
      This chapter provides concrete examples of how to use the tools associated with the processing of <acronym>SGML</acronym> DocBook source files.
    </para>

    <para>Conventions used throughout this chapter:</para>

    <itemizedlist>
      <listitem>
        <para><filename>in.sgml</filename> is used to represent the input <acronym>SGML</acronym> DocBook source file.</para>
      </listitem>

      <listitem>
        <para><filename>out.xxx</filename> is used to represent the output of some operation, where xxx is some extension.</para>
      </listitem>

      <listitem>
        <para>
          In most of the examples, command sequences are used that are non operating system specific. The notation <filename>/path/to/.../</filename> maybe used as a prefix to the location of certain files, the real directory location should substitute the generic terms and the file separators should be replaced with those used on the target operating system.
        </para>
      </listitem>
    </itemizedlist>

    <note>
      <para>
        When one uses the tools to produce <acronym>PDF</acronym> output, if callout or admonition graphics were used, one should first copy the <filename>images</filename> directory into the build directory. If one does not do this, the <acronym>PDF</acronym> tools will not be able to find the images and hence problems will occur. The production of <acronym>HTML</acronym> output formats does not require this as the images are not actually required to build the output but are referenced from outputted <acronym>HTML</acronym> pages, hence the referencing of images is controlled via the output tools and embedded into the <acronym>HTML</acronym> page. The location of the callout and admonitions graphics can be set in the stylesheets or via command line parameters.
      </para>
    </note>
  </sect1>

  <sect1 id="DocBookSys-Chapter4-SGML-ToolUse-SGML-Validation"><title>Validating an <acronym>SGML</acronym> DocBook Document with <command>onsgmls</command></title>
    <para>
      It is useful to validate an <acronym>SGML</acronym> DocBook document against the DocBook <acronym>DTD</acronym> before attempting to process the <acronym>SGML</acronym> DocBook source because if the document conforms to the <acronym>DTD</acronym> there should be no errors during processing. If there are errors during processing and the document is valid, one can infer that the problem is very unlikely to lie with the document but somewhere else such as the processing tool. <command>onsgmls</command> is used to validate <acronym>SGML</acronym> DocBook documents.
    </para>
     
    <screen><userinput><command>onsgmls</command> <option>-s</option> <filename>in.sgml</filename></userinput></screen>

    <para>
      <anchor id="DocBookSys-Chapter4-SGML-ToolUse-Onsgmls-Error-Description"/> If no errors occur, <command>onsgmls</command> will exit silently (indicative of the <option>-s</option> option). If there are errors messages will be output describing where in the input file each error occurred and a short description of the error. An example <command>onsgmls</command> error message is shown below:
    </para>

    <screen>
      onsgmls:sgmlsys-chapter3.sgml:73:9:E: end tag for &quot;PROGRAMLISTING&quot; omitted, but its
      declaration does not permit this.
    </screen>

    <para><command>onsgmls</command> error messages take the following form:</para>

    <programlisting>
    program-name : input-file : line-number : column-number : error-type : error-description
    </programlisting>
  </sect1>

  <sect1 id="DocBookSys-Chapter4-SGML-ToolUse-SGMLtoTeX"><title>Using <application>OpenJade</application> to convert <acronym>SGML</acronym> DocBook source to an intermediate TeX format</title>

    <screen><userinput><command>openjade</command> <option>-t</option> tex <option>-d</option> <filename>/path/to/stylesheets/print/docbook.dsl</filename> <filename>in.sgml</filename></userinput></screen>
 
    <para>
      This will create the file <filename>in.tex</filename>.  The stylesheet to be used for the operation is specified using the <option>-d</option> option. In this case, Norman Walsh's stylesheet for print output was chosen. The output type was specified using the <option>-t</option> option. It is possible to redirect the output to a file of your choice (by default<command>openjade</command> will use the same name as <filename>in.sgml</filename> and create <filename>in.tex</filename>. Redirection is performed in the usual manner that redirection is performed on the target operating system.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter4-SGML-ToolUse-SGMLtoHTMLSing"><title>Using <application>OpenJade</application> to convert <acronym>SGML</acronym> DocBook source to (single file)<acronym>HTML</acronym></title>

    <screen><userinput><command>openjade</command> <option>-t&gt;</option> sgml <option>-V</option> nochunks <option>-d</option> <filename>/path/to/dsssl/html/docbook.dsl</filename> <filename>in.sgml</filename> &gt; <filename>out.html</filename></userinput></screen>

    <para>Notice that the output from the <command>openjade</command> was redirected to a desired output file, if this is not done <command>openjade</command> outputs to the standard output stream.</para>
  </sect1>

  <sect1 id="DocBookSys-Chapter4-SGML-ToolUse-SGMLtoHTMLSep"><title>Using <application>OpenJade</application> to convert <acronym>SGML</acronym> DocBook source to (Chunked) <acronym>HTML</acronym></title>

    <screen><userinput><command>openjade</command> <option>-t</option> sgml <option>-d</option> <filename>/path/to/stylesheets/html/docbook.dsl</filename> <filename>in.sgml</filename></userinput></screen>

    <para>
      This produces the output file <filename>t1.html</filename>, as well as a number of other auxiliary files. The type of the output is specified as <acronym>SGML</acronym> because <acronym>HTML</acronym> is defined in <acronym>SGML</acronym>. Norman Walsh's <acronym>HTML</acronym> output stylesheet was used.y. The <acronym>HTML</acronym> produced is segmented, a new <acronym>HTML</acronym> page is generated for each each section and an <filename>index.html</filename> file is generated as the entry point into the document.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter4-SGML-ToolUse-SGMLtoRTF"><title>Using <command>openjade</command> to convert <acronym>SGML</acronym> DocBook source to <acronym>RTF</acronym></title>

    <screen><userinput><command>openjade</command> <option>-t</option> <option>-d</option> <filename>/path/to/stylesheets/print/docbook.dsl</filename> <filename>in.sgml</filename></userinput></screen>
  </sect1>

  <sect1 id="DocBookSys-Chapter4-SGML-ToolUse-TeXtoDVI"><title>Using <command>jadetex</command> to convert (<command>openjade</command> created) TeX to <acronym>DVI</acronym></title>

    <para>
      The TeX files produced by <command>openjade</command> cannot be processed using the standard TeX processing tools, the JadeTeX macro pack must be used.
    </para>

    <para>Unix/Linux/BSD users should probably use the following command sequence:</para>

    <screen><userinput><command>jadetex</command> <filename>in.tex</filename></userinput></screen>

    <para>
      This should work fine. Sometimes one can get errors associated with memory usage when using this command, a recent installation of jadetex should not have this problem. If the <command>jadetex</command> command does not exist try:
    </para>

    <screen><userinput><command>hugelatex</command> &quot;&amp;jadetex&quot; <filename>in.tex</filename></userinput></screen>

    <para>Windows users should use the following command sequence:</para>

    <screen><userinput><command>jadetex</command> <filename>in.tex</filename></userinput></screen>

    <para id="DocBookSys-Chapter4-SGML-ToolUse-TeX-Memory-Errors">
      Unix users may encounter memory usage errors when using the above commands, some TeX distributions come with the command <command>hugelatex</command> which uses larger memory parameters.  If <command>hugelatex</command> is not installed or the memory parameters are too small, TeX may generate an error like this: 
    </para>

    <screen>! TeX capacity exceeded, sorry [pool size=21903].</screen>
        
    <para>
      To fix this, one can alter the memory pool size in the file <filename>texmf.cnf</filename> (situated in the <filename>web2c</filename> directory of the TeX installation). Here is a <filename>texmf.cnf</filename> file from a working installation of TeX and jadetex:
    </para>

    <programlisting>
main_memory.latex =			1500000
param_size.latex =			1500
stack_size.latex =			1500
hash_extra.latex =			15000
string_vacancies.latex =		45000
pool_free.latex =			47500
nest_size.latex =			500
save_size.latex =			5000
pool_size.latex =			1250000
max_strings.latex =			55000
font_mem_size.latex=			400000

main_memory.jadetex =			1500000
param_size.jadetex =			1500
stack_size.jadetex =			1500
hash_extra.jadetex =			15000
string_vacancies.jadetex =		45000
pool_free.jadetex =			47500
nest_size.jadetex =			500
save_size.jadetex =			5000
pool_size.jadetex =			1250000
max_strings.jadetex =			55000
font_mem_size.jadetex=			400000


main_memory.pdfjadetex =		2500000
param_size.pdfjadetex =			1500
stack_size.pdfjadetex =			1500
hash_extra.pdfjadetex =			50000
string_vacancies.pdfjadetex =		55000
pool_free.pdfjadetex =			47500
nest_size.pdfjadetex =			500
save_size.pdfjadetex =			5000
pool_size.pdfjadetex =			1250000
max_strings.pdfjadetex =		55000
    </programlisting>

    <para>
      This is how the file came upon installation, the memory allocated is relatively huge, indicating that any modern TeX installation should not have any memory problems.  Increase the values in the above file that are indicated as being too small by the error messages produced if necessary.
    </para>

    <para>
      The command sequence will produce <filename>in.dvi</filename>, <filename>hello.aux</filename> and <filename>hello.log</filename>. It is recommended that this command sequence be executed at least 3 times, this is so that the <filename>in.aux</filename> is correctly updated with page numbers.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter4-SGML-ToolUse-TeXtoPDF"><title>Using JadeTeX to convert (<command>openjade</command> created)TeX to <acronym>PDF</acronym></title>

    <para>Unix users should try using the following command sequence:</para>

    <screen><userinput><command>pdfjadetex</command> <filename>in.tex</filename></userinput></screen>

    <para>If the above command did not exist, try:</para>

    <screen><userinput>%<command>hugelatex</command> &quot;&amp;pdfjadetex&quot; <filename>in.tex</filename></userinput></screen>

    <para>Windows users should use the following command sequence:</para>

    <screen><userinput><command>pdfjadetex</command> <filename>in.tex</filename></userinput></screen>

    <para>
      It is recommended that this command sequence be executed at least 3 times, this is so that the <filename>in.aux</filename> is correctly updated with page numbers.  This produces the files <filename>in.aux</filename> and <filename>in.pdf</filename>.
    </para>

    <para>
      If memory usage error messages were output see the <link linkend="DocBookSys-Chapter4-SGML-ToolUse-TeX-Memory-Errors">secion on memory problems</link>.  Alternatively one can use the command <command>ps2pdf</command> which comes with GhostScript to convert files from PostScript to <acronym>PDF</acronym>:
    </para>

    <screen><userinput><command>ps2pdf</command> <filename>in.ps</filename></userinput></screen>
  </sect1>

  <sect1 id="DocBookSys-Chapter4-SGML-ToolUse-DVItoPS"><title>Using <command>dvips</command>to convert <acronym>DVI</acronym> to <acronym>PS</acronym></title>

    <screen><userinput><command>dvips</command> <filename>in.dvi</filename> <option>-o</option> <filename>out.ps</filename></userinput></screen>

    <para>This will produce the PostScript file <filename>out.ps</filename>.</para>
  </sect1>

  <sect1 id="DocBookSys-Chapter4-SGML-ToolUse-SGMLtoXML"><title>Using <command>osx</command> to convert <acronym>SGML</acronym> DocBook source to an <acronym>XML</acronym> tree</title>

    <screen><userinput><command>osx</command> <filename>in.sgml</filename> &gt; <filename>out.xml</filename></userinput></screen>
    <para>
      This will produce the output file <filename>in.xml</filename>, redirection can be used to redirect the output to a specific file.
    </para>

    <para>
      There is the possibility that the conversion could generate errors because <acronym>XML</acronym> does not allow the use of certain <acronym>SGML</acronym> idiosyncrasies. This may be due to use of characters that <acronym>XML</acronym> does not allow unless referenced via their Unicode number.
    </para>

    <para>
      In <acronym>XML</acronym> you would have to use a <emphasis>data entity</emphasis> instead, where a character is referenced numerically (&amp;#123;) or hexadecimally (&amp;#x12AB). See <ulink url="http://www.w3.org/TR/xml-infoset/#infoitem.character">http://www.w3.org/TR/xml-infoset/#infoitem.character</ulink>
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter4-SGML-ToolUse-Custom-DSSSL"><title>Using the custom <acronym>DSSSL</acronym> stylesheets</title>
    <para>
      To use the custom stylesheets one specifies the custom stylesheet as the stylesheet that <command>openjade</command> should use. More than one output format is included in the single custom stylesheet provided in the installation section, the <option>-i</option> option is used to determine which of the output fromats should be used. The generation of <acronym>HTML</acronym> output is shown below:
    </para>

    <screen><userinput><command>openjade</command> <option>-i</option> <filename>output.html</filename> <option>-t</option> sgml <option>-d</option> <filename>/path/to/stylesheets/common/custom.dsl</filename> <filename>in.sgml</filename></userinput></screen>

    <para>
      <acronym>HTML</acronym> output was specified using the <option>-i</option> option with the value <emphasis>output.html</emphasis>. The custom stylesheet was specified using the <option>-d</option>. The generation of intermediate TeX format is shown below:
    </para> 

    <screen><userinput><command>openjade</command> <option>-i</option> <filename>output.print</filename> <option>-t</option> tex <option>-d</option> <filename>/path/to/docbookdsssl/common/custom.dsl</filename> <filename>in.sgml</filename></userinput></screen>

    <para>
      <acronym>HTML</acronym> was specified using the <option>-i</option> with the <emphasis>output.print</emphasis> value.  The custom stylesheet was specified using the <option>-d</option>.  <acronym>RTF</acronym> can be produced by specifying the <acronym>RTF</acronym> backend with the <option>-t</option> option.
    </para>

    <para>It is worth taking a look at the custom stylesheets to see how a customisation layer can be created.</para>
  </sect1>
</chapter>
    <chapter id="DocBookSys-Chapter5-XML-ToolUse"><title>Using the <acronym>XML</acronym> Tools</title>
  <sect1 id="DocBookSys-Chapter5-XML-ToolUse-About"><title>About this chapter</title>
    <para>
      This chapter provides concrete examples of how to use the tools associated with the processing of <acronym>SGML</acronym> DocBook source files.
    </para>

    <para>Conventions used throughout this chapter:</para>

    <itemizedlist>
      <listitem>
        <para><filename>in.sgml</filename> is used to represent the input <acronym>SGML</acronym> DocBook source file.</para>
      </listitem>

      <listitem>
        <para><filename>out.xxx</filename> is used to represent the output of some operation, where xxx is some extension.</para>
      </listitem>

      <listitem>
        <para>
          In most of the examples, command sequences are used that are non operating system specific. The notation <filename>/path/to/.../</filename> maybe used as a prefix to the location of certain files, the real directory location should substitute the generic terms and the file separators should be replaced with those used on the target operating system.
        </para>
      </listitem>
    </itemizedlist>

    <note>
      <para>
        When one uses the tools to produce <acronym>PDF</acronym> output, if callout or admonition graphics were used, one should first copy the <filename>images</filename> directory into the build directory. If one does not do this, the <acronym>PDF</acronym> tools will not be able to find the images and hence problems will occur. The production of <acronym>HTML</acronym> output formats does not require this as the images are not actually required to build the output but are referenced from outputted <acronym>HTML</acronym> pages, hence the referencing of images is controlled via the output tools and embedded into the <acronym>HTML</acronym> page. The location of the callout and admonitions graphics can be set in the stylesheets or via command line parameters.
      </para>
    </note>
  </sect1>

  <sect1 id="DocBookSys-Chapter5-XML-ToolUse-xmllint"><title>Using <command>xmllint</command> to validate an <acronym>XML</acronym> DocBook document</title>
    <para>
      In order to check the syntactic accordance of a DocBook document with the DocBook <acronym>DTD</acronym> one may use <command>xmllint</command>.
    </para>

    <screen><userinput><command>xmllint</command> <option>--valid</option> <option>--noout</option> <filename>in.xml</filename></userinput></screen>

    <para>
      The <option>--valid</option> option specifies that <command>xmllint</command> should validate the document against the <acronym>DTD</acronym> and the <option>--noout</option> option specifies that no output should be produced if there are no errors, hence if the document being validated is valid, <command>xmllint</command> will exit silently. If the document is invalid <command>xmllint</command> will output an error similar to this:
    </para>

    <screen>
      docbook.xml:1: error: Start tag expected, '&lt; not found
      ?xml version=&quot;1.0&quot; encoding='ISO-8859-15'?&gt;
      ^
    </screen>

    <para>Which specifies that there is a missing start tag on line one.</para>

    <note>
      <para>
        The <option>--loaddtd</option> option can be used to specify an external <acronym>DTD</acronym> to validate the input document with.
      </para>
    </note>
  </sect1>

  <sect1 id="DocBookSys-Chapter5-XML-ToolUse-XMLtoXHTMLSing"><title>Using <command>xsltproc</command> to generate (Single file)<acronym>XHTML</acronym> output from an <acronym>XML</acronym> Docbook document</title>

    <screen><userinput><command>xsltproc</command> <filename>file:///path/to/docbook-xsl/xhtml/docbook.xsl</filename> <filename>in.xml</filename> &gt; <filename>out.html</filename></userinput></screen>

    <para>This will produce a single <acronym>XHTML</acronym> file according to the <acronym>XSL</acronym> stylesheet specifications.</para>
  </sect1>

  <sect1 id="DocBookSys-Chapter5-XML-ToolUse-XMLtoXHTMLSep"><title>Using <command>xsltproc</command> to generate <acronym>XHTML</acronym>(Segmented) output from an <acronym>XML</acronym> Docbook document</title>

    <screen><userinput><command>xsltproc</command> <filename>file:///path/to/docbook-xsl/xhtml/chunk.xsl</filename> <filename>in.xml</filename></userinput></screen>

    <para>
      This will produce a set of <acronym>XHTML</acronym> files of the document where each section is on a separate <acronym>HTML</acronym> page.  The layout will accord to the <acronym>XSL</acronym> stylesheet specified. The separate files will be given unique names that correspond to the different sections of the book, e.g <filename>index.html</filename>, <filename>ar01s02.html</filename> and <filename>ar01s03.html</filename>.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter5-XML-ToolUse-ToolUse-XMLtoFO"><title>Using <command>xsltproc</command> to generate <acronym>FO</acronym> output from an <acronym>XML</acronym> Docbook document</title>

    <screen><userinput><command>xsltproc</command> <filename>file:///path/to/docbook-xsl/fo/docbook.xsl</filename> <filename>in.xml</filename> &gt; <filename>out.fo</filename></userinput></screen>

    <para>
      This will produce output as an <acronym>XSL</acronym> <acronym>FO</acronym>(Formatting object), this is an intermediate file type that can be used by other programs to generate other types of output, such as <acronym>PDF</acronym>.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter5-XML-ToolUse-XMLtoHTMLHelp"><title>Using <command>xsltproc</command> to generate <acronym>HTML</acronym>help output from <acronym>XML</acronym> Docbook source</title>

    <screen><userinput><command>xsltproc</command> <filename>file:///path/to/docbook-xsl/htmlhelp/htmlhelp.xsl</filename> <filename>in.xml</filename></userinput></screen>

    <para>
      This will produce a set of <acronym>HTML</acronym> files of the document where each section is on a separate <acronym>HTML</acronym> page. This will also generate <filename>htmlhelp.hhp</filename> and <filename>toc.hhc</filename>.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter5-XML-ToolUse-XMLtoJavaHelp"><title>Using <command>xsltproc</command> to generate Javahelp output from <acronym>XML</acronym> Docbook source</title>

    <screen><userinput><command>xsltproc</command> <filename>file:///path/to/docbook-xsl/javahelp/javahelp.xsl</filename> <filename>in.xml</filename></userinput></screen>

    <para>
      This will produce a set of <acronym>HTML</acronym> files of the document where each section is on a separate <acronym>HTML</acronym> page. This will also generate the JavaHelp helpset file <filename>jhelpset.hs</filename>, the JavaHelp table of contents file <filename>jhelptoc.xml</filename>, the JavaHelp map file <filename>jhelpmap.jhm</filename> and the JavaHelp index file <filename>jhelpidx.xml</filename>.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter5-XML-ToolUse-XMLtoHTMLSing-Saxon"><title>Using <command>Saxon</command> to generate (Single file) <acronym>HTML</acronym> output from <acronym>XML</acronym> DocBook source</title>

    <screen><userinput><command>java</command> com.icl.saxon.StyleSheet <option>-o</option> <filename>out.html</filename> <filename>in.xml</filename> <filename>file:///path/to/docbook-xsl/html/docbook.xsl</filename></userinput></screen>

    <para>This will produce a single <acronym>HTML</acronym> file output according to <acronym>XSL</acronym> stylesheet specified.</para>
  </sect1>

  <sect1 id="DocBookSys-Chapter5-XML-ToolUse-XMLtoXHTMLSing-Saxon"><title>Using <command>Saxon</command> to generate (Single file) <acronym>XHTML</acronym> output from <acronym>XML</acronym> DocBook source</title>

    <screen><userinput><command>java</command> com.icl.saxon.StyleSheet <option>-o</option> <filename>out.html</filename> <filename>in.xml</filename> <filename>file:///path/to/docbook-xsl/xhtml/docbook.xsl</filename></userinput></screen>

    <para>This will produce a single <acronym>XHTML</acronym> file output according to <acronym>XSL</acronym> stylesheet specified.</para>
  </sect1>

  <sect1 id="DocBookSys-Chapter5-XML-ToolUse-XMLtoFO-Saxon"><title>Using <command>Saxon</command> to generate <acronym>FO</acronym> output from <acronym>XML</acronym> Docbook source</title>

    <screen><userinput><command>java</command> com.icl.saxon.StyleSheet <option>-o</option> <filename>in.xml</filename> <filename>file:///path/to/docbook-xsl/fo/docbook.xsl</filename></userinput></screen>

    <para>
      This will produce output as an <acronym>XSL</acronym> <acronym>FO</acronym>(Formatting object), this is an intermediate file type that can be used by other programs to generate other types of output, such as <acronym>PDF</acronym>.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter5-XML-ToolUse-XSLFOtoPDFFOP"><title>Using <command>FOP</command> to generate <acronym>PDF</acronym> output from <acronym>XSL</acronym> <acronym>FO</acronym> input</title>

    <para>
      In order to execute this conversion you will need to have generated <acronym>XSL</acronym> <acronym>FO</acronym> output by using <command>xsltproc</command> or some other tool capable of doing so.
    </para>

    <screen><userinput><command>fop.bat</command> <filename>in.fo</filename> <filename>out.pdf</filename></userinput></screen>

    <para>
       Substituting <filename>fop.sh</filename> for <filename>fop.bat</filename> on Unix derivatives.  This will generate a <acronym>PDF</acronym> file named according to the name provided as the second argument. <acronym>FOP</acronym> will probably generate lots of warnings about un-implemented features whilst generating this output, this is normal and can be ignored.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter5-XML-ToolUse-XSLFOtoPDF"><title>Using <command>pdfxmltex</command> to generate <acronym>PDF</acronym> output from <acronym>XSL</acronym> <acronym>FO</acronym> input</title>

    <screen><userinput><command>pdfxmltex</command> <filename>in.fo</filename></userinput></screen>
    
    <para>
      It is recommended that this command sequence be executed at least 3 times that <filename>in.aux</filename> is correctly updated with page numbers.  This will produce the files <filename>in.aux</filename> and <filename>in.pdf</filename>.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter5-XML-ToolUse-General"><title>General Usage</title>
    <para>
      Assume that a file called <filename>test.xml</filename> has been created in <acronym>XML</acronym> DocBook. Assume that the stylesheets are located in a directory called <filename>/lib/docbook-xsl/</filename> One would create <acronym>XHTML</acronym> output like this:
    </para>

    <screen><userinput><command>xsltproc</command> <filename>file:///lib/docbook-xsl/xhtml/docbook.xsl</filename> <filename>test.xml</filename> &gt; <filename>test.html</filename></userinput></screen>

    <para>
      One would create <acronym>PDF</acronym> output in two steps, first create the <acronym>FO</acronym> output using <command>xsltproc</command>:
    </para>

    <screen><userinput><command>xsltproc</command> <filename>file:///lib/docbook-xsl/fo/docbook.xsl</filename> <filename>test.xml</filename> &gt; <filename>test.fo</filename></userinput></screen>

    <para>
      Next, process the <acronym>FO</acronym> output with <acronym>FOP</acronym> to produce the <acronym>PDF</acronym> file:
    </para>

    <screen><userinput><command>fop.bat</command> <filename>in.fo</filename> <filename>out.pdf</filename></userinput></screen>

    <para>
      If you want to use the custom stylesheets you simply modify the stylesheet parameter so that it points to the custom stylesheet you want to use. Assuming an install of the customisation layer mentioned above in the same location as the standard stylesheets one could generate <acronym>XHTML</acronym> output that conformed to the custom stylesheet for <acronym>XHTML</acronym> like this:
    </para>

    <screen><userinput><command>xsltproc</command> <filename>file:///lib/docbook-xsl/xhtml/customxhtml.xsl</filename> <filename>test.xml</filename> &gt; <filename>test.html</filename></userinput></screen>

    <para>Similarly, <acronym>FO</acronym> output could be produced.</para>
  </sect1>
</chapter>
    <chapter id="DocBookSys-Chapter6-XMLwithSGMLtools"><title>Using The <acronym>SGML</acronym> Tools To Process <acronym>XML</acronym> DocBook Documents</title>
  <sect1 id="DocBookSys-Chapter6-XMLwithSGMLtools-About"><title>About This Chapter</title>
    <para>
      It is possible to use the <acronym>SGML</acronym> tools to process <acronym>XML</acronym> DocBook documents, this can be useful if the <acronym>XML</acronym> tools are currently broken or it is preferable to use the <acronym>SGML</acronym> tools, for example, <command>onsgmls</command> is considered to produce more meaningful error messages than <command>xmllint</command>. The rest of this chapter provides some concrete examples.
    </para>

    <para>Conventions used throughout this chapter:</para>

    <itemizedlist>
      <listitem>
        <para><filename>in.sgml</filename> is used to represent the input <acronym>SGML</acronym> DocBook source file.</para>
      </listitem>

      <listitem>
        <para><filename>out.xxx</filename> is used to represent the output of some operation, where xxx is some extension.</para>
      </listitem>

      <listitem>
        <para>
          In most of the examples, command sequences are used that are non operating system specific. The notation <filename>/path/to/.../</filename> maybe used as a prefix to the location of certain files, the real directory location should substitute the generic terms and the file separators should be replaced with those used on the target operating system.
        </para>
      </listitem>
    </itemizedlist>

    <para>
      When one uses the tools to produce <acronym>PDF</acronym> output, if callout or admonition graphics were used, one should first copy the <filename>images</filename> directory into the build directory. If one does not do this, the <acronym>PDF</acronym> tools will not be able to find the images and hence problems will occur. The production of <acronym>HTML</acronym> output formats does not require this as the images are not actually required to build the output but are referenced from outputted <acronym>HTML</acronym> pages, hence the referencing of images is controlled via the output tools and embedded into the <acronym>HTML</acronym> page. The location of the callout and admonitions graphics can be set in the stylesheets or via command line parameters.
    </para>

    <note>
      <para>
        When one uses <acronym>SGML</acronym> tools to process <acronym>XML</acronym> documents there may be slight differences in the way that filenames are specified, for example, <command>xmllint</command>, and <command>xsltproc</command> implements a true <acronym>URI</acronym> scheme, more about which can be found at <ulink url="http://www.ietf.org/rfc/rfc2396.txt">http://www.ietf.org/rfc/rfc2396.txt</ulink>, an example of a <acronym>URI</acronym> is shown below:.
      </para>

      <programlisting>file:///path/to/wherever/</programlisting>

      <para>
        Most of the <acronym>SGML</acronym> tools do not employ this scheme and it is only necessary to specify the filename like this:
      </para>

      <programlisting>/path/to/wherever/</programlisting>

      <para>
        To process <acronym>XML</acronym> files the <acronym>SGML</acronym> tools reference a file called <filename>xml.dcl</filename> which is the <acronym>XML</acronym> declaration, this is bundled with the OpenJade suite in the <filename>pubtext</filename> directory, it may be a good idea to put this somewhere more convenient.
      </para>
    </note>
  </sect1>

  <sect1 id="DocBookSys-Chapter6-XMLwithSGMLtools-Validation"><title>Using <command>onsgsmls</command> to validate <acronym>XML</acronym> DocBook documents</title>

    <screen><userinput><command>onsgmls</command> <option>-s</option> <filename>/path/to/openjade-1.3.1/pubtext/xml.dcl</filename> <filename>test.xml</filename></userinput></screen>

    <para>
      If the document is valid the program will exit silently, otherwise errors will be produced. See <link linkend="DocBookSys-Chapter4-SGML-ToolUse-Onsgmls-Error-Description"> error descriptions</link>
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter6-XMLwithSGMLtools-XMLtoHTMLSep"><title>Using <command>openjade</command> to convert <acronym>XML</acronym> DocBook to (segmented) <acronym>HTML</acronym></title>

    <screen><userinput><command>openjade</command> <option>-t</option> xml <option> -d </option> <filename>/path/to/dssslstylesheets/html/docbook.dsl</filename> <filename>/path/to/openjadedir/pubtext/xml.dcl</filename> <filename>in.xml</filename></userinput></screen>

    <para>
      The fact an <acronym>XML</acronym> file was being processed was specified using the <option>-t</option> option and Norman Walsh's <acronym>DSSSL</acronym> <acronym>HTML</acronym> stylesheet was specified using the <option>-d</option>. After this, the <acronym>XML</acronym> declaration was passed to <command>openjade</command> so that openjade knew how to deal with the <acronym>XML</acronym> document it was about to receive which was passed in as the last parameter.  This produces the <acronym>HTML</acronym> output in chunked format. 
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter6-XMLwithSGMLtools-XMLtoHTMLSing"><title>Using <command>openjade</command> to convert <acronym>XML</acronym> DocBook to (single file) <acronym>HTML</acronym></title>

    <screen><userinput><command>openjade</command> <option>-V</option> nochunks <option>-t</option> xml <option> -d </option> <filename>/path/to/dssslstylesheets/html/docbook.dsl</filename> <filename>/path/to/openjadedir/pubtext/xml.dcl</filename> <filename>in.xml</filename></userinput></screen>

    <para>
      Single file <acronym>HTML</acronym> output was selected using the <option>-V</option> nochunks option. The fact an <acronym>XML</acronym> file was being processed was specified using the <option>-t</option> option and Norman Walsh's <acronym>DSSSL</acronym> <acronym>HTML</acronym> stylesheet was specified using the <option>-d</option>. After this, the <acronym>XML</acronym> declaration was passed to <command>openjade</command> so that openjade knew how to deal with the <acronym>XML</acronym> document it was about to receive which was passed in as the last parameter.  This produces the <acronym>HTML</acronym> output in single file format. 
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter6-XMLwithSGMLtools-XMLtoTeX"><title>Using <command>openjade</command> to convert from <acronym>XML</acronym> DocBook to intermediate TeX format</title>

    <screen><userinput><command>openjade</command> <option>-t</option> tex <option> -d </option> <filename>/path/to/dssslstylesheets/print/docbook.dsl</filename> <filename>/path/to/openjadedir/pubtext/xml.dcl</filename> <filename> in.xml</filename></userinput></screen>

    <para>
      The TeX input file type was specified using the <option>-t</option> option. Norman Walsh's <acronym>DSSSL</acronym> print stylesheet was specified using the <option>-d</option> option. After this, the <acronym>XML</acronym> declaration was passed to <command>openjade</command> so that openjade knew how to deal with the <acronym>XML</acronym> document it was about to receive which was passed in as the parameter after. The output <filename>.tex</filename> will have to be processed with special TeX macros in order to produce other output formats. 
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter6-XMLwithSGMLtools-XMLtoRTF"><title>Using <command>openjade</command> to convert from <acronym>XML</acronym> DocBook to <acronym>RTF</acronym></title>

    <screen><userinput><command>openjade</command> <option>-t</option> rtf <option> -d </option> <filename>/path/to/dssslstylesheets/print/docbook.dsl</filename> <filename>/path/to/openjadedir/pubtext/xml.dcl</filename> <filename> in.xml</filename></userinput></screen>

    <para>
      The <acronym>RTF</acronym> input type was specified using the <option>-t</option> option and Norman Walsh's <acronym>DSSSL</acronym> print stylesheet was specified using the <option>-d</option> option. After this, the <acronym>XML</acronym> declaration was passed to <command>openjade</command> so that openjade knew how to deal with the <acronym>XML</acronym> document it was about to receive which was passed in as the parameter after.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter6-XMLwithSGMLtools-TeXtoDVI"><title>Using <command>jadetex</command> to convert from (<command>openjade</command> created) intermediate TeX format to <acronym>DVI</acronym></title>

    <para>
      The TeX files produced by <command>openjade</command> cannot be processed using the standard TeX commands, instead, the JadeTeX macro pack is used.
    </para>

    <para>Unix users should try using the following command sequence:</para>

    <screen><userinput><command>jadetex</command> <filename>in.tex</filename></userinput></screen>

    <para>If the above command did not exist, try:</para>

    <screen><userinput><command>hugelatex</command> &quot;&amp;jadetex&quot; <filename>in.tex</filename></userinput></screen>

    <para>Windows users should use the following command sequence:</para>

    <screen><userinput><command>jadetex</command> <filename>in.tex</filename></userinput></screen>

    <para>
      It is recommended that this command sequence be executed at least 3 times, this is so that the <filename>in.aux</filename> is correctly updated with page numbers.  This produces the files <filename>in.dvi</filename>, <filename>hello.aux</filename> and <filename>hello.log</filename>.
    </para>

    <para>
      If memory usage error messages were output see the <link linkend="DocBookSys-Chapter4-SGML-ToolUse-TeX-Memory-Errors">secion on memory problems</link>.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter6-XMLWithSGMLTools-TeXtoPDF"><title>Using JadeTeX to convert (<command>openjade</command> created)TeX to <acronym>PDF</acronym></title>

    <para>Unix users should try using the following command sequence:</para>

    <screen><userinput><command>pdfjadetex</command> <filename>in.tex</filename></userinput></screen>

    <para>If the above command did not exist, try:</para>

    <screen><userinput>%<command>hugelatex</command> &quot;&amp;pdfjadetex&quot; <filename>in.tex</filename></userinput></screen>

    <para>Windows users should use the following command sequence:</para>

    <screen><userinput><command>pdfjadetex</command> <filename>in.tex</filename></userinput></screen>

    <para>
      It is recommended that this command sequence be executed at least 3 times, this is so that the <filename>in.aux</filename> is correctly updated with page numbers.  This produces the files <filename>in.aux</filename> and <filename>in.pdf</filename>.
    </para>

    <para>
      If memory usage error messages were output see the <link linkend="DocBookSys-Chapter4-SGML-ToolUse-TeX-Memory-Errors">secion on memory problems</link>.  Alternatively one can use the command <command>ps2pdf</command> which comes with GhostScript to convert files from PostScript to <acronym>PDF</acronym>:
    </para>

    <screen><userinput><command>ps2pdf</command> <filename>in.ps</filename></userinput></screen>
  </sect1>

  <sect1 id="DocBookSys-Chapter6-XMLwithSGMLtools-DVItoPS"><title>Using <command>dvips</command> to convert from <acronym>DVI</acronym> to <acronym>PS</acronym></title>

    <screen><userinput><command>dvips</command> <filename>in.dvi</filename> <option>-o</option> <filename>out.ps</filename></userinput></screen>

    <para>This produces the PostScript file <filename>out.ps</filename>.</para>
  </sect1>
</chapter>
  </part>

  <part id="DocBookSys-Authoring"><title>Introduction To Authoring DocBook Documents</title>
    <chapter id="DocBookSys-Chapter7-SGML-Creating"><title>Creating An <acronym>SGML</acronym> DocBook Document</title>
  <sect1 id="DocBookSys-Chapter7-SGML-Creating-SGMLDec"><title>Declaring the document type</title> 
    <para>
      When marking up documents in a <acronym>DTD</acronym> it is standard practice to include a DOCTYPE declaration so that the processing tools 'know' what <acronym>DTD</acronym> the document being processed conforms to.  A typical DOCTYPE declaration for a document marked up in DocBook <acronym>SGML</acronym> can be seen below:
    </para>

    <programlisting>&lt;!DOCTYPE chapter PUBLIC &quot;-//OASIS//DTD DocBook V4.1//EN&quot;&gt;</programlisting>

    <para>Notice that the markup is enclosed within:</para>

    <programlisting>&lt;! ... &gt;</programlisting>

    <para>
      These are <acronym>SGML</acronym> directives so are enclosed within the special tags <emphasis>&lt;!</emphasis> and <emphasis>&gt;</emphasis>. The distinguishing feature is that an exclamation mark follows the '&lt;' which opens the directive section.  The <acronym>SGML</acronym> directives define various aspects of the <acronym>SGML</acronym> document itself. The DOCTYPE declaration as a whole is known as the prologue.
    </para>

    <para>
      Immediately following the opening of the prologue is the keyword <emphasis>DOCTYPE</emphasis> then a word such as <emphasis>chapter</emphasis> or <emphasis>book</emphasis>, this specifies the root element of the document and is exactly the name of the tag that will be used to open and close the markup after the prologue. Example: 
    </para> 
    
    <programlisting>
&lt;!DOCTYPE chapter PUBLIC &quot;-//OASIS//DTD DocBook V4.1//EN&quot;&gt;
&lt;chapter&gt;&lt;title&gt;The Theory Of Special Relativity&lt;/title&gt;
  &lt;para&gt;
    The principle of the physical relativity of all uniform motion...
  &lt;/para&gt;
&lt;/chapter&gt;
    </programlisting>

    <para>
      Notice that the start and end tags of the document are defined by the root element specified in the DOCTYPE declaration in the prologue of the document.
    </para>

    <para>
      What follows is the keyword <emphasis>PUBLIC</emphasis> this specifies that what follows that is a public identifier, which is described in more detail in the next section, but essentially defines what type of document this is.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter7-SGML-Creating-PUBLICID"><title>The use of PUBLIC identifiers in <acronym>SGML</acronym></title>
    <para>
      A public identifier is an indirect way of specifying what <acronym>DTD</acronym> a document was created under. (The markup language that was used to write the document). A particular document type is associated with a particular <acronym>DTD</acronym> which specifies the particular details of how this type of document should be structured. Hence processing tools can know how to parse and validate your document by examining this <acronym>DTD</acronym>. 
    </para>

    <para>
      The processing tools can use the public identifier, along with catalog file which maps the public identifier to a <acronym>DTD</acronym>. An example from a catalog file called <filename>docbook.cat</filename> is shown below:
    </para>

    <programlisting>
 -- DocBook driver file .................................................. --

PUBLIC &quot;-//OASIS//DTD DocBook V4.1//EN&quot; &quot;docbook.dtd&quot;
    </programlisting>

    <para>
      The whole of the OpenJade catalog file found in the <filename>dsssl</filename> subdirectory can be seen below:
    </para>

    <programlisting>
PUBLIC &quot;-//James Clark//DTD DSSSL Flow Object Tree//EN&quot; &quot;fot.dtd&quot;
PUBLIC &quot;ISO/IEC 10179:1996//DTD DSSSL Architecture//EN&quot; &quot;dsssl.dtd&quot;
PUBLIC &quot;-//James Clark//DTD DSSSL Style Sheet//EN&quot; &quot;style-sheet.dtd&quot;
PUBLIC &quot;-//OpenJade//DTD DSSSL Style Sheet//EN&quot; &quot;style-sheet.dtd&quot;
SYSTEM &quot;builtins.dsl&quot; &quot;builtins.dsl&quot;
    </programlisting>

    <para> 
      Notice that each public identifier is mapped to a SYSTEM identifier which specifies the location of the actual <acronym>DTD</acronym> for the DOCTYPE, in these cases, they happen to be in the same directory as the catalog file but they do not have to.  The locations of the files here are not defined by formal <acronym>URI</acronym>s because it is not necessary.
    </para>

    <para>A PUBLIC identifier is essentially of the format</para> 

    <programlisting>
      prefix//owner-identifier//text-class text-description//language//display version
    </programlisting>

    <para>
      For more information see <citetitle>Public Identifiers, System Identifiers, and Catalog Files</citetitle> <ulink url="http://www.docbook.org/tdg/en/html/ch02.html#s-pid-sid-catalogs">http://www.docbook.org/tdg/en/html/ch02.html#s-pid-sid-catalogs</ulink>.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter7-SGML-Creating-SYSTEMID"><title>The use of SYSTEM identifiers in <acronym>SGML</acronym></title>
    <para>
      A SYSTEM identifier specifies the exact location of the <acronym>DTD</acronym> that the document conforms to. SYSTEM identifiers may follow PUBLIC identifiers as in the example below:
    </para>

    <programlisting>
&lt;!DOCTYPE book PUBLIC &quot;-//OASIS//DTD DocBook V4.1//EN&quot; &quot;docbook.dtd&quot;&gt;
    </programlisting>

    <para>Or they may occur on their own:</para>

    <programlisting>
&lt;!DOCTYPE book SYSTEM &quot;customdocbook.dtd&quot;&gt;
    </programlisting>

    <para>
      The above example specifies that the document conforms to the <acronym>DTD</acronym> defined in the file &quot;customdocbook.dtd&quot;. More information about <acronym>SGML</acronym> declarations can be found here: <ulink url="http://www.oasis-open.org/cover/wlw11.html">http://www.oasis-open.org/cover/wlw11.html</ulink>.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter7-SGML-Creating-ExampleArticle"><title>An <acronym>SGML</acronym> DocBook article template</title>

    <programlisting>
&lt;!DOCTYPE article PUBLIC &quot;-//OASIS//DTD DocBook V4.1//EN&quot;&gt;
&lt;article&gt;
  &lt;articleinfo&gt;
    &lt;title&gt;Your title here&lt;/title&gt;
        
    &lt;author&gt;
      &lt;firstname&gt;Your first name&lt;/firstname&gt;
      &lt;surname&gt;Your surname&lt;/surname&gt;
      &lt;affiliation&gt;
        &lt;address&gt;&lt;email&gt;Your e-mail address&lt;/email&gt;&lt;/address&gt;
      &lt;/affiliation&gt;
    &lt;/author&gt;
    
    &lt;copyright&gt;
      &lt;year&gt;1998&lt;/year&gt;
      &lt;holder role=&quot;mailto:your e-mail address&quot;&gt;Your name&lt;/holder&gt;
    &lt;/copyright&gt;
  
    &lt;pubdate role=&quot;rcs&quot;&gt;$Date: 2003/01/08 10:27:39 $&lt;/pubdate&gt;
   
    &lt;releaseinfo&gt;$Id: DocBookSys-Chapter7-SGML-Creating.xml,v 1.1.1.1 2003/01/08 10:27:39 ug55axm Exp $&lt;/releaseinfo&gt;
    
    &lt;abstract&gt;
      &lt;para&gt;Include an abstract of the article&amp;apos;s contents here.&lt;/para&gt;
    &lt;/abstract&gt;
  &lt;/articleinfo&gt;

  &lt;sect1&gt;&lt;title&gt;Section 1&lt;/title&gt;
    &lt;para&gt;
      My first article!
    &lt;/para&gt;
  &lt;/sect1&gt;

  &lt;sect2&gt;&lt;title&gt;Section 2&lt;/title&gt;
    &lt;para&gt;
      Brilliant!
    &lt;/para&gt;
  &lt;/sect2&gt;  
&lt;/article&gt;
    </programlisting>

    <para>
      This is an article template and illustrates some of the features of docbook.  The file can be validated using <command>onsgmls</command> like this:
    </para>
    
    <screen><userinput><command>onsgmls</command> <option>-s</option> <filename>articletemplate.sgml</filename></userinput></screen>

    <para>
      This should produce no errors and exit silently because the document is structured correctly. Chunked <acronym>HTML</acronym> output can be generated from this file like this:
    </para>

    <screen><userinput><command>openjade</command> <option>-t</option> sgml <option>-d</option> <filename>/path/to/docbook/dbdsssl/html/docbook.dsl</filename> <filename>articletemplate.sgml</filename></userinput></screen>
  </sect1>

  <sect1 id="DocBookSys-Chapter7-SGML-Creating-ExampleBook"><title>An <acronym>SGML</acronym> DocBook book template</title> 
    <para> 
      DocBook books are generally for projects over 25 pages long, they allow the inclusion of chapters and parts, a template for a book is shown below:
    </para>

    <programlisting>
&lt;!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook V4.1//EN'&gt;
&lt;book&gt;
  &lt;bookinfo&gt;
    &lt;title&gt;Your title here&lt;/title&gt;
      
    &lt;author&gt;
      &lt;firstname&gt;Your first name&lt;/firstname&gt;
      &lt;surname&gt;Your surname&lt;/surname&gt;
      &lt;affiliation&gt;
        &lt;address&gt;&lt;email&gt;Your e-mail address&lt;/email&gt;&lt;/address&gt;
      &lt;/affiliation&gt;
    &lt;/author&gt;
   
    &lt;copyright&gt;
      &lt;year&gt;1998&lt;/year&gt;
      &lt;holder role='mailto:your e-mail address'&gt;Your name&lt;/holder&gt;
    &lt;/copyright&gt;
    
    &lt;pubdate role='rcs'&gt;$Date: 2003/01/08 10:27:39 $&lt;/pubdate&gt;
  
    &lt;releaseinfo&gt;$Id: DocBookSys-Chapter7-SGML-Creating.xml,v 1.1.1.1 2003/01/08 10:27:39 ug55axm Exp $&lt;/releaseinfo&gt;
  
    &lt;abstract&gt;
      &lt;para&gt;Include an abstract of the book&amp;apos;s contents here.&lt;/para&gt;
    &lt;/abstract&gt;
  &lt;/bookinfo&gt;
  
  &lt;part&gt;&lt;title&gt;Part1&lt;/title&gt;
    &lt;chapter&gt;&lt;title&gt;Part 1, Chapter 1&lt;/title&gt;
      &lt;sect1&gt;&lt;title&gt;Part1, Chapter 1, Section1&lt;/title&gt;
        &lt;para&gt;
	  Hello there!
	&lt;para&gt;
      &lt;/sect1&gt; 
    &lt;/chapter&gt;

    &lt;chapter&gt;&lt;title&gt;Part 1, Chapter 2&lt;/title&gt;
      &lt;sect1&gt;&lt;title&gt;Part1, Chapter 2, Section 1&lt;/title&gt;
        &lt;para&gt;
	  Hi there!
	&lt;para&gt;
      &lt;/sect1&gt; 
    &lt;/chapter&gt;
  &lt;/part&gt;

  &lt;part&gt;&lt;title&gt;Part2&lt;/title&gt;
    &lt;chapter&gt;&lt;title&gt;Part 2, Chapter 1&lt;/title&gt;
      &lt;sect1&gt;&lt;title&gt;Part 2, Chapter 1, Section1&lt;/title&gt;
        &lt;para&gt;
	  GoodDay there!
	&lt;para&gt;
      &lt;/sect1&gt; 

      &lt;sect1&gt;&lt;title&gt;Part2, Chapter1, Section2&lt;/title&gt;
        &lt;para&gt;
	  GoodNight there! 
	&lt;para&gt;
      &lt;/sect1&gt; 
    &lt;/chapter&gt;
  &lt;/part&gt;
&lt;/book&gt;
    </programlisting>

    <para>This file can be validated using <command>onsgmls</command> like this:</para>
    
    <screen><userinput><command>onsgmls</command> <option>-s</option> <filename>booktemplate.sgml</filename></userinput></screen>

    <para>
      This should produce no errors and exit silently because the document is structured correctly. <acronym>RTF</acronym> output can be generated like this:
    </para>

    <screen><userinput><command>openjade</command> <option>-t</option> rtf <option>-d</option> <filename>/path/to/docbook/dbdsssl/print/docbook.dsl</filename> <filename>booktemplate.sgml</filename></userinput></screen>

    <para>
      There is a DocBook element quick reference card available from <ulink url="http://www.dpawson.co.uk/docbook/reference.html#d3e60">http://www.dpawson.co.uk/docbook/reference.html#d3e60</ulink>.
    </para>
  </sect1>
</chapter>
    <chapter id="DocBookSys-Chapter8-XML-Creating"><title>Creating an <acronym>XML</acronym> DocBook document</title>
  <sect1 id="DocBookSys-Chapter8-XML-Creating-XMLDec"><title>Declaring The Document Type</title> 
    <para><acronym>XML</acronym> documents must declare that they are <acronym>XML</acronym> documents like this:</para>

    <programlisting>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</programlisting>

    <para>
      When marking up documents in a <acronym>DTD</acronym> it is standard practice to include a DOCTYPE declaration so that the processing tools 'know' what <acronym>DTD</acronym> the document being processed conforms to.  A typical DOCTYPE declaration for a document marked up in DocBook <acronym>XML</acronym> can be seen below:
    </para>

    <programlisting>
&lt;!DOCTYPE article PUBLIC &quot;-//OASIS//DTD DocBook XML V4.2//EN&quot; 
&quot;http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd&quot;&gt;
    </programlisting>

    <para>Notice that the markup is enclosed within:</para>

    <programlisting>&lt;! ... &gt;</programlisting>

    <para>
      These are <acronym>XML</acronym> directives so are enclosed within the special tags <emphasis>&lt;!</emphasis> and <emphasis>&gt;</emphasis>. The distinguishing feature is that an exclamation mark follows the '&lt;' symbol which opens the directive section. The <acronym>XML</acronym> directives define various aspects of the <acronym>XML</acronym> document.
    </para>

    <para>
      Immediately following the opening of the prologue is the keyword <emphasis>DOCTYPE</emphasis> then a word such as <emphasis>chapter</emphasis> or <emphasis>book</emphasis>, this specifies the root element of the document and is exactly the name of the tag that will be used to open and close the markup of the document which appears after the prologue. An example is shown below:
    </para> 
    
    <programlisting>
&lt;!DOCTYPE chapter PUBLIC &quot;-//OASIS//DTD DocBook XML V4.2//EN&quot;
&quot;http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd&quot;&gt; 
&lt;chapter&gt;&lt;title&gt;The Theory Of Special Relativity&lt;/title&gt;
  &lt;para&gt; 
    The principle of the physical relativity of all uniform motion...
  &lt;/para&gt;
&lt;/chapter&gt;
    </programlisting>

    <para>
      Notice that the start and end tags of the document are defined by the root element specified in the DOCTYPE declaration in the prologue of the document.
    </para>

    <para>
      What follows is the keyword <emphasis>PUBLIC</emphasis>, this specifies that what follows that is a public identifier, which defines what type of document the document is.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter8-XML-Creating-Identifiers"><title>The use of PUBLIC and SYSTEM identifiers in <acronym>XML</acronym></title>
    <para>
      A public identifier is an indirect way of specifying what <acronym>DTD</acronym> a document was created under. (The markup language that was used to write the document). A particular document type is associated with a particular <acronym>DTD</acronym> which specifies the particular details of how this type of document should be structured. Hence processing tools can know how to parse and validate your document by examining this <acronym>DTD</acronym>. 
    </para>

    <para>
      The processing tools can use the public identifier, along with catalog file which maps the public identifier to a <acronym>DTD</acronym>. An example catalog file is shown below:
    </para>

    <programlisting>
&lt;catalog xmlns='urn:oasis:names:tc:entity:xmlns:xml:catalog'&gt;
  &lt;group xml:base='/usr/share/xml/' prefer='public' &gt;
       &lt;public 
         publicId='-//OASIS//DTD DocBook XML V4.2//EN'
         uri='file:///path/to/docbook/docbook-V4.2/docbookx.dtd'/&gt;
  &lt;/group&gt;
&lt;/catalog&gt;
    </programlisting>

    <para>
      This catalog file maps the PUBLIC ID &quot;;-//OASIS//DTD DocBook XML V4.2//EN&quot;, which might be present in the prologue of a DocBook document, to the file &quot;file:///path/to/docbook/docbook-V4.2/docbookx.dtd&quot;.
    </para>

    <para>
      <acronym>XML</acronym> requires that if one uses a PUBLIC ID one also provides a SYSTEM ID. Usually the official <acronym>URL</acronym> of the <acronym>DTD</acronym> on the Internet is used as the SYSTEM identifier in the actual document, following the PUBLIC identifier. If the processing tools fail to find a mapping from the PUBLIC identifier to a SYSTEM identifier in the catalog file(s) they will fall back to using the SYSTEM identifier specified in the document.
    </para>

    <para>A PUBLIC identifier is essentially of the format</para> 

    <programlisting>prefix//owner-identifier//text-class text-description//language//display version</programlisting>

    <para>
      For more information see <citetitle>Public Identifiers, System Identifiers, and Catalog Files</citetitle> <ulink url="http://www.docbook.org/tdg/en/html/ch02.html#s-pid-sid-catalogs"> http://www.docbook.org/tdg/en/html/ch02.html#s-pid-sid-catalogs</ulink>.
    </para>

    <para>
      A SYSTEM identifier specifies the exact location of the <acronym>DTD</acronym> that the document conforms to. SYSTEM identifiers may follow PUBLIC identifiers as in the example below:
    </para>

    <programlisting>
&lt;!DOCTYPE book PUBLIC &quot;-//OASIS//DTD DocBook V4.1//EN&quot; &quot;docbook.dtd&quot;&gt;
    </programlisting>

    <para>Or they may occur on their own:</para>

    <programlisting>
&lt;!DOCTYPE book SYSTEM &quot;customdocbook.dtd&quot;&gt;
    </programlisting>

    <para>
      The above example specifies that the document conforms to the <acronym>DTD</acronym> defined in the file &quot;customdocbook.dtd&quot;.
    </para>
  </sect1>

  <sect1 id="UniDocBook-Creating"><title>Creating an <acronym>XML</acronym> DocBook document</title>
    <para>
      For the ultimate reference guide see <ulink url="http://www.docbook.org/tdg/en/html/docbook.html"><citetitle>DocBook: The Definitive Guide</citetitle></ulink>. A template for a DocBook <emphasis>article</emphasis> is shown below:
    </para>

    <note>
      <para>The output illustrated in this section was produced using a customisation of the stylesheets hence output on systems not implementing the same customisations may differ.</para>
    </note>

    <sect2 id="UniDocBook-Creating-Article-Template"><title>An <emphasis>article</emphasis> template</title>
      <programlisting>
&lt;?xml version=&quot;1.0&quot; encoding='UTF-8'?&gt;
&lt;!DOCTYPE article PUBLIC &quot;-//OASIS//DTD DocBook XML V4.2//EN&quot;
  &quot;http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd&quot;&gt;
&lt;article&gt;
  &lt;articleinfo&gt;
    &lt;title&gt;Your title here&lt;/title&gt;
        
    &lt;author&gt;
      &lt;firstname&gt;Your first name&lt;/firstname&gt;
      &lt;surname&gt;Your surname&lt;/surname&gt;
      &lt;affiliation&gt;
        &lt;address&gt;&lt;email&gt;Your e-mail address&lt;/email&gt;&lt;/address&gt;
      &lt;/affiliation&gt;
    &lt;/author&gt;
    
    &lt;copyright&gt;
      &lt;year&gt;2002&lt;/year&gt;
      &lt;holder role=&quot;mailto:your e-mail address&quot;&gt;Your name&lt;/holder&gt;
    &lt;/copyright&gt;
  
    &lt;abstract&gt;
      &lt;para&gt;Include an abstract of the article's contents here.&lt;/para&gt;
    &lt;/abstract&gt;
  &lt;/articleinfo&gt;

  &lt;sect1&gt;&lt;title&gt;Section 1&lt;/title&gt;
    &lt;para&gt;
      blah blah blah
    &lt;/para&gt;
  &lt;/sect1&gt;

  &lt;sect1&gt;&lt;title&gt;Section 2&lt;/title&gt;
    &lt;para&gt;
      blah blah blah
    &lt;/para&gt;
  &lt;/sect1&gt;  
&lt;/article&gt;
      </programlisting>
    </sect2>

    <sect2 id="DocBookSys-Chapter8-XML-Creating-ExampleBook"><title>An example <acronym>XML</acronym> DocBook Book</title> 
      <para> 
        DocBook books are generally for projects over 25 pages long, they allow the inclusion of chapters and parts, a book template is shown below:
      </para>

      <programlisting>
&lt;!DOCTYPE book PUBLIC &quot;-//OASIS//DTD DocBook V4.2//EN&quot;
&quot;http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd&quot;&gt;
&lt;book&gt;
  &lt;bookinfo&gt;
    &lt;title&gt;Your title here&lt;/title&gt;
      
    &lt;author&gt;
      &lt;firstname&gt;Your first name&lt;/firstname&gt;
      &lt;surname&gt;Your surname&lt;/surname&gt;
      &lt;affiliation&gt;
        &lt;address&gt;&lt;email&gt;Your e-mail address&lt;/email&gt;&lt;/address&gt;
      &lt;/affiliation&gt;
    &lt;/author&gt;
   
    &lt;copyright&gt;
      &lt;year&gt;1998&lt;/year&gt;
      &lt;holder role=&quot;mailto:your e-mail address&quot;&gt;Your name&lt;/holder&gt;
    &lt;/copyright&gt;
    
    &lt;pubdate role=&quot;rcs&quot;&gt;$Date: 2003/01/08 10:27:39 $&lt;/pubdate&gt;
  
    &lt;releaseinfo&gt;$Id: DocBookSys-Chapter8-XML-Creating.xml,v 1.1.1.1 2003/01/08 10:27:39 ug55axm Exp $&lt;/releaseinfo&gt;
  
    &lt;abstract&gt;
      &lt;para&gt;Include an abstract of the book&amp;apos;s contents here.&lt;/para&gt;
    &lt;/abstract&gt;
  &lt;/bookinfo&gt;
  
  &lt;part&gt;&lt;title&gt;Part1&lt;/title&gt;
    &lt;chapter&gt;&lt;title&gt;Part 1, Chapter 1&lt;/title&gt;
      &lt;sect1&gt;&lt;title&gt;Part1, Chapter 1, Section1&lt;/title&gt;
        &lt;para&gt;
	  Hello there!
	&lt;para&gt;
      &lt;/sect1&gt; 
    &lt;/chapter&gt;

    &lt;chapter&gt;&lt;title&gt;Part 1, Chapter 2&lt;/title&gt;
      &lt;sect1&gt;&lt;title&gt;Part1, Chapter 2, Section 1&lt;/title&gt;
        &lt;para&gt;
	  Hi there!
	&lt;para&gt;
      &lt;/sect1&gt; 
    &lt;/chapter&gt;
  &lt;/part&gt;

  &lt;part&gt;&lt;title&gt;Part2&lt;/title&gt;
    &lt;chapter&gt;&lt;title&gt;Part 2, Chapter 1&lt;/title&gt;
      &lt;sect1&gt;&lt;title&gt;Part 2, Chapter 1, Section1&lt;/title&gt;
        &lt;para&gt;
	  GoodDay there!
	&lt;para&gt;
      &lt;/sect1&gt; 

      &lt;sect1&gt;&lt;title&gt;Part2, Chapter1, Section2&lt;/title&gt;
        &lt;para&gt;
	  GoodNight there! 
	&lt;para&gt;
      &lt;/sect1&gt; 
    &lt;/chapter&gt;
  &lt;/part&gt;
&lt;/book&gt;
      </programlisting>

      <para>This can be validated using <command>xmllint</command> like this:</para>
    
      <screen><userinput><command>xmllint</command> <option>--valid</option> <option>--noout</option><filename>articletemplatewin.xml</filename></userinput></screen>

      <para>
        This should produce no errors and exit silently because the document is structured correctly. Chunked <acronym>XHTML</acronym> output can be generated like this:
      </para>

      <screen><userinput><command>xsltproc</command> <filename>file:///path/to/docbook-xsl/xhtml/chunk.dsl</filename> <filename>articletemplate.xml</filename></userinput></screen>

      <para>
        There is a DocBook element quick reference card available from <ulink url="http://www.dpawson.co.uk/docbook/reference.html#d3e60">http://www.dpawson.co.uk/docbook/reference.html#d3e60</ulink>.
      </para>
    </sect2>
  </sect1>
</chapter>
    <chapter id="DocBookSys-Chapter9-DocBookDocs"><title>DocBook Document Examples</title>
  <sect1 id="DocBookSys-Chapter9-DocBookDocs-Common-Elements"><title>Common DocBook Elements</title>
    <sect2 id="DocBookSys-Chapter9-DocBookDocs-Common-Elements-Para"><title><emphasis>&lt;para&gt;</emphasis></title>
      <para>
        The reference page for the <emphasis>para</emphasis> element can be found here: <ulink url="http://www.docbook.org/tdg/en/html/para.html">http://www.docbook.org/tdg/en/html/para.html</ulink>. <emphasis>para</emphasis> is one of the most commonly used elements of all the DocBook elements. <emphasis>para</emphasis>'s can contain block elements such as <emphasis>itemizedlist</emphasis> and <emphasis>mediaobject</emphasis> and can contain almost all inline elements. There is some debate about whether or not it is best to separate block elements from <emphasis>para</emphasis> elements, it is probably better to do so however because some processing systems have problems processing block elements within <emphasis>para</emphasis> elements. An example of a para element containing some inline elements is shown below:
      </para>

      <programlisting>
          &lt;para&gt;
            &lt;quote&gt;Behold the superfluous. They are always sick. They vomit their gall and call it a newspaper.&lt;/quote&gt;
            - Friedrich Wilhelm Nietzsche, &lt;citetitle&gt;Twilight of the Idols&lt;/citetitle&gt;
          &lt;/para&gt;
      </programlisting>

      <para>Looks like this:</para>

      <para>
        <quote>Behold the superfluous. They are always sick. They vomit their gall and call it a newspaper.</quote>
        - Friedrich Wilhelm Nietzsche, <citetitle>Twilight of the Idols</citetitle>
      </para>
    </sect2>

    <sect2 id="DocBookSys-Chapter9-DocBookDocs-Common-Elements-Programlisting"><title><emphasis>&lt;programlisting&gt;</emphasis></title>
      <para>
        The reference page for the <emphasis>programlisting</emphasis> element can be found here: <ulink url="http://www.docbook.org/tdg/en/html/programlisting.html">http://www.docbook.org/tdg/en/html/programlisting.html</ulink>. The <emphasis>programlisting</emphasis> element is used to display information that should be output verbatim, that is, white space is significant. An example is shown below:
      </para>

      <programlisting>
  &lt;programlisting&gt;
public class HelloWorld {
   public static void main(String args[]) {
      System.out.println(&amp;quot;Hello World!&amp;quot;);
   }
}
  &lt;/programlisting&gt;
      </programlisting>

      <para>Is output as:</para>

      <programlisting>
public class HelloWorld {
   public static void main(String args[]) {
      System.out.println(&quot;Hello World!&quot;);
   }
}
      </programlisting>

      <para>
        Notice the use of (&amp;quot;) to represent the (&quot;) character, this is know as a character entity and is used to represent a character that is not allowed to be used directly in the document, this is because these characters are used by the <acronym>XML</acronym> part of the document for special purposes. These special characters are known as <emphasis role="strong">CDATA</emphasis> as apposed to <emphasis role="strong">PCDATA</emphasis>, the latter standing for <emphasis>Parsed Character DATA</emphasis>. If one wants to use lots of <emphasis>CDATA</emphasis> characters in a document then one can wrap the section in a CDATA section like this:
      </para>

      <programlisting>
  &lt;programlisting&gt;
    &lt;![CDATA[
      One can get away with using lots of &amp;&amp;&amp; &quot;&quot;&quot; ''' &lt;&lt;&lt; &gt;&gt;&gt; 
      characters that would normally require being marked up as entities.
    ]]&gt;
  &lt;/programlisting&gt;
      </programlisting>

      <para>Is displayed as:</para>

      <programlisting>
        One can get away with using lots of &amp;&amp;&amp; &quot;&quot;&quot; ''' &lt;&lt;&lt; &gt;&gt;&gt; characters that would normally have to be marked up as entities.
      </programlisting>

      <para>For more information about the available entities see the next section.</para>
    </sect2>

    <sect2 id="DocBookSys-Chapter9-DocBookDocs-Common-Elements-Entities"><title>Entities for special characters</title>
      <para>
        The following entities are provided for special characters, they must always be used unless they are used in a section that has been marked as a CDATA section. It is preferred to always use them in preference of CDATA sections however:
      </para>

      <informaltable frame="all">
        <tgroup cols="2">
          <thead>
            <row><entry>Character</entry><entry>Entity</entry></row>
          </thead>
  
          <tbody>
            <row><entry>&lt;</entry><entry>&amp;lt;</entry></row>
            <row><entry>&gt;</entry><entry>&amp;gt;</entry></row>
            <row><entry>&amp;</entry><entry>&amp;amp;</entry></row>
            <row><entry>&quot;</entry><entry>&amp;quot;</entry></row>
            <row><entry>'</entry><entry>&amp;apos;</entry></row>
          </tbody>
          </tgroup>
      </informaltable>
    </sect2>

    <sect2 id="DocBookSys-Chapter9-DocBookDocs-Common-Elements-Screen"><title><emphasis>&lt;screen&gt;</emphasis></title>
      <para>
        The reference page for the <emphasis>screen</emphasis> element can be found here: <ulink url="http://www.docbook.org/tdg/en/html/screen.html">http://www.docbook.org/tdg/en/html/screen.html</ulink>. Often one wants to illustrate the use of a program or a commandline, the <emphasis>screen</emphasis> element is intended to mark content up as text that a user would see on a computer screen. An example is shown below:
      </para>

      <programlisting>
          &lt;screen&gt;
            &lt;userinput&gt;&lt;command&gt;java&lt;/command&gt; org.apache.fop.apps.Fop &lt;replaceable&gt;in.fo&lt;/replaceable&gt; &lt;replaceable&gt;out.pdf&lt;/replaceable&gt;&lt;/userinput&gt;
          &lt;/screen&gt;
      </programlisting>

      <para>Is displayed as:</para>

      <screen><userinput><command>java</command> org.apache.fop.apps.Fop <replaceable>in.fo</replaceable> <replaceable>out.pdf</replaceable></userinput></screen>
    </sect2>

    <sect2 id="DocBookSys-Chapter9-DocBookDocs-Common-Elements-Ulink"><title><emphasis>&lt;ulink&gt;</emphasis></title>
      <para>
        The reference page for the <emphasis>ulink</emphasis> element can be found here: <ulink url="http://www.docbook.org/tdg/en/html/ulink.html">http://www.docbook.org/tdg/en/html/ulink.html</ulink>. <emphasis>ulink</emphasis> is the DocBook equivalent of <acronym>HTML</acronym>'s &quot;&lt;a href=&quot;...&quot;&gt;blah blah&lt;/a&gt;&quot;, an example is shown below:
      </para>

      <programlisting>
          &lt;para&gt;
            &lt;ulink url=&quot;http://www.oasis-open.org/committees/docbook/&quot;&gt;http://www.oasis-open.org/committees/docbook/&lt;/ulink&gt;
          &lt;/para&gt;
      </programlisting>

      <para>Displays as:</para>

      <para><ulink url="http://www.oasis-open.org/committees/docbook/">http://www.oasis-open.org/committees/docbook/</ulink></para>
    </sect2>

    <sect2 id="DocBookSys-Chapter9-DocBookDocs-Common-Elements-Lists"><title>Lists</title>
      <sect3 id="DocBookSys-Chapter9-DocBookDocs-Common-Elements-Lists-ItemizedLists"><title><emphasis>&lt;itemizedlist&gt;</emphasis></title>
        <para>
          The reference page for <emphasis>itemizedlist</emphasis> is here: <ulink url="http://www.docbook.org/tdg/en/html/itemizedlist.html">http://www.docbook.org/tdg/en/html/itemizedlist.html</ulink>. Itemized lists are standard bulleted lists and should be used where order of evaluation of the items of the list is not significant, ordered lists should be used where order of evaluation fot he items of the list are significant. An example use of itemized list is shown below:
        </para>

        <programlisting>
           &lt;itemizedlist&gt;
             &lt;listitem&gt;&lt;para&gt;Books&lt;/para&gt;
               &lt;itemizedlist&gt;
                 &lt;listitem&gt;&lt;para&gt;Donald E. Knuth - The Art Of Computer Programming&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;Nils J. Nilsson - Artificial Intelligence: A New Synthesis&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;Pure Mathematics 2 - Geoff Mannall, Michael Kenwood&lt;/para&gt;&lt;/listitem&gt;
               &lt;/itemizedlist&gt;
             &lt;/listitem&gt;
   
             &lt;listitem&gt;&lt;para&gt;Games&lt;/para&gt;
               &lt;itemizedlist&gt;
                 &lt;listitem&gt;&lt;para&gt;Chess&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;Backgammon&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;Noughs And Crosses&lt;/para&gt;&lt;/listitem&gt;
               &lt;/itemizedlist&gt;
             &lt;/listitem&gt;
           &lt;/itemizedlist&gt;
        </programlisting>

        <para>Which looks like this:</para>

        <itemizedlist>
          <listitem><para>Books</para>
            <itemizedlist>
              <listitem><para>Donald E. Knuth - The Art Of Computer Programming</para></listitem>
              <listitem><para>Nils J. Nilsson - Artificial Intelligence: A New Synthesis</para></listitem>
              <listitem><para>Pure Mathematics 2 - Geoff Mannall, Michael Kenwood</para></listitem>
            </itemizedlist>
          </listitem>

          <listitem><para>Games</para>
            <itemizedlist>
              <listitem><para>Chess</para></listitem>
              <listitem><para>Backgammon</para></listitem>
              <listitem><para>Noughs And Crosses</para></listitem>
            </itemizedlist>
          </listitem>
        </itemizedlist>
      </sect3>

      <sect3 id="DocBookSys-Chapter9-DocBookDocs-Common-Elements-Lists-OrderedLists"><title><emphasis>&lt;orderedlist&gt;</emphasis></title>
        <para>
          The reference page for <emphasis>orderedlist</emphasis> is here: <ulink url="http://www.docbook.org/tdg/en/html/orderedlist.html">http://www.docbook.org/tdg/en/html/orderedlist.html</ulink>. Ordered lists are used to specify a sequence of steps of which the order of evaluation is significant. The general form of an ordered list is like this:
        </para>

        <programlisting>
          &lt;orderedlist&gt;
            &lt;listitem&gt;&lt;para&gt;Action A&lt;para&gt;&lt;/listitem&gt;
            &lt;listitem&gt;&lt;para&gt;Action B&lt;para&gt;&lt;/listitem&gt;
          &lt;/orderedlist&gt;
        </programlisting>

        <para>Which would look like this:</para>

        <orderedlist>
          <listitem><para>Action A</para></listitem>
          <listitem><para>Action B</para></listitem>
        </orderedlist>

        <para>
          One may also specify the type of enumeration that the list will display, there are five types of enumeration; arabic, loweralpha, lowerroman, upperalpha , upperroman. The type of enumeration is specified via the <emphasis role="strong">numeration</emphasis> attribute like this:
        </para>

        <programlisting>
          &lt;orderedlist numeration=&quot;arabic&quot;&gt;
            &lt;listitem&gt;...&lt;/listitem&gt;
                             .
                             .
                             .
          &lt;/orderedlist&gt;
        </programlisting>

        <para>The types of enumeration are shown below:</para>

        <para>Arabic:</para>
        <orderedlist numeration="arabic">
          <listitem><para>arabic</para></listitem>
          <listitem><para>arabic</para></listitem>
          <listitem><para>arabic</para></listitem>
        </orderedlist>

        <para>Loweralpha:</para>
        <orderedlist numeration="loweralpha">
          <listitem><para>loweralpha</para></listitem>
          <listitem><para>loweralpha</para></listitem>
          <listitem><para>loweralpha</para></listitem>
        </orderedlist>

        <para>Lowerroman:</para>
        <orderedlist numeration="lowerroman">
          <listitem><para>lowerroman</para></listitem>
          <listitem><para>lowerroman</para></listitem>
          <listitem><para>lowerroman</para></listitem>
        </orderedlist>

        <para>Upperalpha:</para>
        <orderedlist numeration="upperalpha">
          <listitem><para>upperalpha</para></listitem>
          <listitem><para>upperalpha</para></listitem>
          <listitem><para>upperalpha</para></listitem>
        </orderedlist>

        <para>Upperroman:</para>
        <orderedlist numeration="upperroman">
          <listitem><para>upperroman</para></listitem>
          <listitem><para>upperroman</para></listitem>
          <listitem><para>upperroman</para></listitem>
        </orderedlist>

        <para>These can be combined to make nested enumeration clearer:</para>

        <programlisting>
           &lt;orderedlist numeration=&quot;loweralpha&quot;&gt;
             &lt;listitem&gt;
               &lt;para&gt;Preparation&lt;/para&gt;
               &lt;orderedlist numeration=&quot;upperalpha&quot;&gt;
                 &lt;listitem&gt;&lt;para&gt;Chop tomatoes&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;Peel onions&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;Mash potatoes&lt;/para&gt;&lt;/listitem&gt;
               &lt;/orderedlist&gt;
             &lt;/listitem&gt;
             &lt;listitem&gt;
               &lt;para&gt;Cooking&lt;/para&gt;
               &lt;orderedlist numeration=&quot;upperalpha&quot;&gt;
                 &lt;listitem&gt;&lt;para&gt;Boil water&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;Put tomatoes and onions in&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;Blanch for 5 minutes&lt;/para&gt;&lt;/listitem&gt;
               &lt;/orderedlist&gt;
             &lt;/listitem&gt;
             &lt;listitem&gt;
               &lt;para&gt;Cleanup&lt;/para&gt;
               &lt;orderedlist numeration=&quot;upperalpha&quot;&gt;
                 &lt;listitem&gt;&lt;para&gt;Throw away scraps&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;Clean side&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;Wash hands&lt;/para&gt;&lt;/listitem&gt;
               &lt;/orderedlist&gt;
             &lt;/listitem&gt;
           &lt;/orderedlist&gt;
        </programlisting>

        <para>Which looks like this:</para>

        <orderedlist numeration="upperroman">
          <listitem>
            <para>Preparation</para>
            <orderedlist numeration="upperalpha">
              <listitem><para>Chop tomatoes</para></listitem>
              <listitem><para>Peel onions</para></listitem>
              <listitem><para>Mash potatoes</para></listitem>
            </orderedlist>
          </listitem>
          <listitem>
            <para>Cooking</para>
            <orderedlist numeration="upperalpha">
              <listitem><para>Boil water</para></listitem>
              <listitem><para>Put tomatoes and onions in</para></listitem>
              <listitem><para>Blanch for 5 minutes</para></listitem>
            </orderedlist>
          </listitem>
          <listitem>
            <para>Cleanup</para>
            <orderedlist numeration="upperalpha">
              <listitem><para>Throw away scraps</para></listitem>
              <listitem><para>Clean side</para></listitem>
              <listitem><para>Wash hands</para></listitem>
            </orderedlist>
          </listitem>
        </orderedlist>

        <para>One may also make the enumeration continue at lower nested levels by setting the <emphasis role="strong">continuation</emphasis> attribute to <emphasis role="strong">continues</emphasis>:</para>

        <programlisting>
           &lt;orderedlist&gt;
             &lt;listitem&gt;
               &lt;para&gt;Do this&lt;/para&gt;
               &lt;orderedlist numeration=&quot;arabic&quot;&gt;
                 &lt;listitem&gt;&lt;para&gt;And this&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;And this&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;And this&lt;/para&gt;&lt;/listitem&gt;
               &lt;/orderedlist&gt;
             &lt;/listitem&gt;
             &lt;listitem&gt;
               &lt;para&gt;And this&lt;/para&gt;
               &lt;orderedlist numeration=&quot;arabic&quot; continuation=&quot;continues&quot;&gt;
                 &lt;listitem&gt;&lt;para&gt;And this&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;And this&lt;/para&gt;&lt;/listitem&gt;
                 &lt;listitem&gt;&lt;para&gt;And this&lt;/para&gt;&lt;/listitem&gt;
               &lt;/orderedlist&gt;
             &lt;/listitem&gt;
           &lt;/orderedlist&gt;
        </programlisting>

        <para>Which looks like this:</para>

        <orderedlist>
          <listitem>
            <para>Do this</para>
            <orderedlist numeration="arabic">
              <listitem><para>And this</para></listitem>
              <listitem><para>And this</para></listitem>
              <listitem><para>And this</para></listitem>
            </orderedlist>
          </listitem>
          <listitem>
            <para>And this</para>
            <orderedlist numeration="arabic" continuation="continues">
              <listitem><para>And this</para></listitem>
              <listitem><para>And this</para></listitem>
              <listitem><para>And this</para></listitem>
            </orderedlist>
          </listitem>
        </orderedlist>

        <note><para>Some stylesheets may define that nested lists are of a different numeration by default.</para></note>
      </sect3>
    </sect2>

    <sect2 id="DocBookSys-Chapter9-DocBookDocs-Common-Elements-Inline"><title>Some common inline elements</title>
      <para>Some common inline elements and their output are shown below:</para>

      <informaltable frame="all">
        <tgroup cols="2">
          <thead>
            <row><entry>Example</entry><entry>Displays as</entry></row>
          </thead>
  
          <tbody>
            <row><entry>&lt;emphasis&gt;Emphasised Text&lt;/emphasis&gt;</entry><entry><emphasis>Emphasised Text</emphasis></entry></row>
            <row><entry>&lt;emphasis role=&quot;strong&quot;&gt;A different type of emphasis&lt;/emphasis&gt;</entry><entry><emphasis role="strong">A different type of emphasis</emphasis></entry></row>
            <row><entry>&lt;filename&gt;blahblah.txt&lt;/filename&gt;</entry><entry><filename>blahblah.txt</filename></entry></row>
            <row><entry>&lt;acronym&gt;XML&lt;/acronym&gt;</entry><entry><acronym>XML</acronym></entry></row>
            <row><entry>&lt;quote&gt;blahblahblah&lt;quote&gt;</entry><entry><quote>blahblahblah</quote></entry></row>
          </tbody>
        </tgroup>
      </informaltable>
    </sect2>
  </sect1>

  <sect1 id="DocBookSys-Chapter9-DocBookDocs-Images"><title>Including Images</title>
    <para>Images are included in DocBook documents as illustrated below:</para>
  
    <programlisting>
        &lt;figure&gt;&lt;title&gt;blah&lt;/title&gt;
          &lt;mediaobject&gt;
            &lt;imageobject&gt;&lt;imagedata fileref=&quot;blah.jpg&quot; format=&quot;JPEG&quot;/&gt;&lt;/imageobject&gt;
            &lt;textobject&gt;&lt;phrase&gt;Image description&lt;/phrase&gt;&lt;/textobject&gt;
          &lt;/mediaobject&gt;
        &lt;/figure&gt;
    </programlisting>
  
    <para>
      The overall encapsulating element is <emphasis>figure</emphasis> the reference page for which can be found at <ulink url="http://www.docbook.org/tdg/en/html/figure.html">http://www.docbook.org/tdg/en/html/figure.html</ulink>. The <emphasis>figure</emphasis> contains a <emphasis>mediaobject</emphasis> element which can occur on it's own too and may contain <emphasis>audioobject</emphasis>, <emphasis>caption</emphasis>, <emphasis>imageobject</emphasis>, <emphasis>objectinfo</emphasis>, <emphasis>textobject</emphasis> and <emphasis>videoobject</emphasis> elements. The reference page for<emphasis>mediaobject</emphasis> is at <ulink url="http://www.docbook.org/tdg/en/html/mediaobject.html">http://www.docbook.org/tdg/en/html/mediaobject.html</ulink>.
    </para>
  
    <para>
      <emphasis>imageobject</emphasis> is the type of <emphasis>mediaobject</emphasis> used to include an image and it's reference page can be found at <ulink url="http://www.docbook.org/tdg/en/html/imageobject.html">http://www.docbook.org/tdg/en/html/imageobject.html</ulink>. The item within the <emphasis>imageobject</emphasis> that handles the image is <emphasis>imagedata</emphasis>, it's reference page is at <ulink url="http://www.docbook.org/tdg/en/html/imagedata.html">http://www.docbook.org/tdg/en/html/imagedata.html</ulink>.
    </para>
  
    <para>
      The idea behind <emphasis>mediaobject</emphasis> is to provide a way to include media in many formats. It becomes the document processors job to decide which of the formats specified in the <emphasis>mediaobject</emphasis> to use in the particular output medium chosen. For example the <emphasis>mediaobject</emphasis> element may contain a <acronym>PNG</acronym> format <emphasis>imageobject</emphasis> for <acronym>HTML</acronym> output and a <acronym>TIFF</acronym> format <emphasis>imageobject</emphasis> for print output, there may also be a <emphasis>textobject</emphasis> providing a description of the image for an output format that does not have the capability to display images, for example, perhaps the document will be output in an audio format for people with sight problems.
    </para>

    <para>
      One does not have to encapsulate the <emphasis>mediaobject</emphasis> in a <emphasis>figure</emphasis> object but doing so allows one to provide a title and be able to have the <emphasis>figure</emphasis> listed in a list of figures at the beginning of the document.
    </para>
  
    <para><emphasis>imagedata</emphasis> may be of the following formats:</para>
  
    <mediaobject>
      <imageobject><imagedata fileref="files/images/imageformats.png" format="PNG"/></imageobject>
      <textobject><phrase><emphasis>imageobject</emphasis> image formats</phrase></textobject>
    </mediaobject>
  
    <para>
      The attribute <emphasis>format</emphasis> is thus required along with either <emphasis>fileref</emphasis> or <emphasis>entityref</emphasis> to reference the image:
    </para>
  
    <programlisting>
      &lt;mediaobject&gt;
        &lt;imageobject&gt;&lt;imagedata fileref=&quot;frog.png&quot; format=&quot;PNG&quot;/&gt;&lt;/imageobject&gt;
        &lt;textobject&gt;&lt;phrase&gt;A frog&lt;/phrase&gt;&lt;/textobject&gt;
      &lt;/mediaobject&gt;
    </programlisting>

    <para/>
 
    <mediaobject>
      <imageobject><imagedata fileref="files/images/frog.png" format="PNG"/></imageobject>
      <textobject><phrase>A frog</phrase></textobject>
    </mediaobject>
  
    <para>
      One could use stylesheets such that, in <acronym>HTML</acronym> rendered output, the <emphasis>phrase</emphasis> used in the <emphasis>textobject</emphasis> would become the alternative text in an image in the <acronym>HTML</acronym>. One can use multiple <emphasis>imageobject</emphasis>s for different output formats, for instance one may have an <emphasis>eps</emphasis> version of the image so that output can be generated with a processing chain that requires the image to be in this form. One could include different image formats for each of the desired output formats.
    </para>
 
    <para>
      The <emphasis>imagedata</emphasis> element has the useful attributes <emphasis>align</emphasis> and <emphasis>valign</emphasis>. <emphasis>align</emphasis> specifies how the image should be aligned horizontally and can be set to the values; <emphasis role="strong">center</emphasis>, <emphasis role="strong">left</emphasis> and <emphasis role="strong">right</emphasis>. <emphasis>valign</emphasis> specifies how the image should be aligned vertically and can be set to the values; <emphasis role="strong">bottom</emphasis>, <emphasis role="strong">middle</emphasis> and <emphasis role="strong">top</emphasis>.
    </para>
  </sect1>

  <sect1 id="DocBookSys-Chapter9-DocBookDocs-Tables"><title>Tables</title>
    <para>
      There are two elements used for placing tables inside a DocBook document, <emphasis>table</emphasis> and <emphasis>informaltable</emphasis>, the only difference between the former and the latter is that the former requires a <emphasis>title</emphasis> and the latter does not.
    </para>
  
    <programlisting>
        &lt;table&gt;&lt;title&gt;title&lt;/title&gt;         &lt;informaltable&gt;
          .                                        .
          .                          or            .
          .                                        .
        &lt;/table&gt;                            &lt;/informaltable&gt;
    </programlisting>
  
    <para>
      The <emphasis>table</emphasis> contains an attribute called <emphasis>frame</emphasis> which specifies how the table should be framed:
    </para>
  
    <programlisting>
        &lt;table frame=&quot;frametype&quot;&gt;&lt;title&gt;frame=&quot;frametype&quot;&lt;/title&gt;
          &lt;tgroup cols=&quot;1&quot;&gt;
            &lt;thead&gt;
              &lt;row&gt;&lt;entry&gt;a1&lt;/entry&gt;&lt;entry&gt;b1&lt;/entry&gt;&lt;entry&gt;c1&lt;/entry&gt;&lt;/row&gt;
            &lt;/thead&gt;
            &lt;tbody&gt;
              &lt;row&gt;&lt;entry&gt;a2&lt;/entry&gt;&lt;entry&gt;b2&lt;/entry&gt;&lt;entry&gt;c2&lt;/entry&gt;&lt;/row&gt;
              &lt;row&gt;&lt;entry&gt;a3&lt;/entry&gt;&lt;entry&gt;b3&lt;/entry&gt;&lt;entry&gt;c3&lt;/entry&gt;&lt;/row&gt;
            &lt;/tbody&gt;
          &lt;/tgroup&gt;
        &lt;/table&gt;
    </programlisting>
  
    <para>
      Where <emphasis>frametype</emphasis> is replaced with one of <emphasis>all</emphasis>, <emphasis>bottom</emphasis>, <emphasis>none</emphasis>, <emphasis>sides</emphasis>, <emphasis>top</emphasis> or <emphasis>topbot</emphasis>:
    </para>
  
    <figure><title>Table frame types</title>
      <mediaobject>
        <imageobject><imagedata fileref="files/images/tableframetypes.png" format="PNG"/></imageobject>
        <textobject><phrase>Table frame types</phrase></textobject>
      </mediaobject>
    </figure>

    <para>
      The output above is <acronym>PDF</acronym>, with <acronym>HTML</acronym> all the tables look the same as the one with attribute <emphasis>all</emphasis> apart from the one with attribute <emphasis>none</emphasis> which has no frame at all. The attributes <emphasis>colsep</emphasis> and <emphasis>rowsep</emphasis> are used to control whether lines should be drawn between columns and rows respectively:
    </para>
  
    <programlisting>
  &lt;table colsep=&quot;0&quot; rowsep=&quot;0&quot;&gt; ... &lt;/table&gt;
  &lt;table colsep=&quot;0&quot; rowsep=&quot;1&quot;&gt; ... &lt;/table&gt;
  &lt;table colsep=&quot;1&quot; rowsep=&quot;0&quot;&gt; ... &lt;/table&gt;
  &lt;table colsep=&quot;1&quot; rowsep=&quot;1&quot;&gt; ... &lt;/table&gt;
    </programlisting>
  
    <para>
      Unfortunately at the time of writing the tools used to convert <acronym>FO</acronym> to <acronym>PDF</acronym> either did not yet implement this feature or were in a broken state with regards to this feature so no pictorial examples can be provided. Other <emphasis>table</emphasis> attributes are discussed at <ulink url="http://www.docbook.org/tdg/en/html/table.html">http://www.docbook.org/tdg/en/html/table.html</ulink>.
    </para>
  
    <para>The generic layout for a table is as follows:</para>
  
    <programlisting>
        &lt;table&gt;&lt;title&gt;title&lt;/title&gt; 
          &lt;tgroup cols=&quot;3&quot;&gt;
            &lt;thead&gt;
              &lt;row&gt;&lt;entry&gt;blah&lt;/entry&gt;&lt;/row&gt;
            &lt;/thead&gt;
  
            &lt;tbody&gt;
              &lt;row&gt;&lt;entry&gt;blah&lt;/entry&gt;&lt;/row&gt;
            &lt;/tbody&gt;
  
            &lt;tfoot&gt;
              &lt;row&gt;&lt;entry&gt;blah&lt;/entry&gt;&lt;/row&gt;
            &lt;/tfoot&gt;
          &lt;/tgroup&gt;
        &lt;/table&gt;
    </programlisting>
  
    <para>
      <emphasis>tgroup</emphasis> contains the rest of the table which must contain a <emphasis>tbody</emphasis> element which specifies which data is in the body of the table. The <emphasis>tbody</emphasis> element may be empty with the table being included in <emphasis>thead</emphasis> or <emphasis>tfoot</emphasis> but this is not the intention. The reason for the <emphasis>thead</emphasis> and <emphasis>tfoot</emphasis> elements is so that different layouts can be applied by the stylesheets for the header and the footer of the table respectively. So usually the first row would be wrapped in a <emphasis>thead</emphasis> element. <emphasis>tgroup</emphasis> has the mandatory attribute <emphasis>cols</emphasis> which specifies the number of columns the table has.
    </para>
  
    <para>
      <emphasis>tgroup</emphasis> may also specify alignment of content via the <emphasis>align</emphasis> attribute, where <emphasis>alignment</emphasis> is either <emphasis>left</emphasis>, <emphasis>center</emphasis> or <emphasis>right</emphasis>:
    </para>
  
    <programlisting>
      &lt;table frame=&quot;all&quot;&gt;&lt;title&gt;align=&quot;alignment&quot;&lt;/title&gt;
        &lt;tgroup cols=&quot;3&quot; align=&quot;alignment&quot;&gt;
          &lt;tbody&gt;
            &lt;row&gt;&lt;entry&gt;a2&lt;/entry&gt;&lt;entry&gt;b2&lt;/entry&gt;&lt;entry&gt;c2&lt;/entry&gt;&lt;/row&gt;
          &lt;/tbody&gt;
        &lt;/tgroup&gt;
      &lt;/table&gt;
    </programlisting>
  
    <figure><title>Table alignment types</title>
      <mediaobject>
        <imageobject><imagedata fileref="files/images/tablealign.png" format="PNG"/></imageobject>
        <textobject><phrase>Table alignment types</phrase></textobject>
      </mediaobject>
    </figure>
  
    <para>
      For more information about the <emphasis>tgroup</emphasis> element see <ulink url="http://www.docbook.org/tdg/en/html/tgroup.html">http://www.docbook.org/tdg/en/html/tgroup.html</ulink>.
    </para>
  
    <para>
      A <emphasis>row</emphasis> consists of a number of <emphasis>entry</emphasis> elements which are entered in the sequence they should appear in each table row, for more information about the <emphasis>row</emphasis> element see <ulink url="http://www.docbook.org/tdg/en/html/row.html">http://www.docbook.org/tdg/en/html/row.html</ulink>.
    </para>
        
    <para>
      The <emphasis>entry</emphasis> element has some interesting attributes which allow an entry to span more than one column or row, they are (<emphasis>namest</emphasis> &amp; <emphasis>nameend</emphasis>) and <emphasis>morerows</emphasis> respectively. The <emphasis>morerow</emphasis> attribute specifies how many more rows the entry it is applied to should span:
    </para>
  
    <programlisting>
      &lt;table frame=&quot;all&quot;&gt;&lt;title&gt;&lt;emphasis&gt;morerows&lt;/emphasis&gt; example&lt;/title&gt;
        &lt;tgroup cols=&quot;3&quot;&gt;
          &lt;tbody&gt;
            &lt;row&gt;&lt;entry morerows=&quot;2&quot;&gt;a1&lt;/entry&gt;&lt;entry&gt;b1&lt;/entry&gt;&lt;entry&gt;c1&lt;/entry&gt;&lt;/row&gt;
            &lt;row&gt;&lt;entry&gt;b2&lt;/entry&gt;&lt;entry&gt;c2&lt;/entry&gt;&lt;/row&gt;
            &lt;row&gt;&lt;entry&gt;b3&lt;/entry&gt;&lt;entry&gt;c3&lt;/entry&gt;&lt;/row&gt;
          &lt;/tbody&gt;
        &lt;/tgroup&gt;
      &lt;/table&gt;
    </programlisting>
  
    <figure><title><emphasis>morerows</emphasis> example</title>
      <mediaobject>
        <imageobject><imagedata fileref="files/images/morerowsexample.png" format="PNG"/></imageobject>
        <textobject><phrase>More rows example</phrase></textobject>
      </mediaobject>
    </figure>
  
    <para>
      Unfortunately there is no <emphasis>morecolumns</emphasis> attribute, instead one has to use <emphasis>namest</emphasis> to specify the starting column of the <emphasis>entry</emphasis> and <emphasis>nameend</emphasis> to specify the ending column of the <emphasis>entry</emphasis>. The value applied to this attribute is the name of the columns, columns are named using the <emphasis>colspec</emphasis> element, <emphasis>colspec</emphasis> elements are inserted inside <emphasis>tgroup</emphasis> but before <emphasis>thead</emphasis>, <emphasis>tbody</emphasis> and <emphasis>tfoot</emphasis>:
    </para>
  
    <programlisting>
      &lt;table frame=&quot;all&quot;&gt;&lt;title&gt;column spanning&lt;/title&gt;
        &lt;tgroup cols=&quot;3&quot;&gt;
          &lt;colspec colname=&quot;col1&quot;/&gt;
          &lt;colspec colname=&quot;col2&quot;/&gt;
          &lt;colspec colname=&quot;col3&quot;/&gt;
          &lt;tbody&gt;
            &lt;row&gt;&lt;entry namest=&quot;col1&quot; nameend=&quot;col3&quot;&gt;a1&lt;/entry&gt;&lt;/row&gt;
            &lt;row&gt;&lt;entry&gt;a2&lt;/entry&gt;&lt;entry&gt;b1&lt;/entry&gt;&lt;entry&gt;c1&lt;/entry&gt;&lt;/row&gt;
            &lt;row&gt;&lt;entry&gt;a3&lt;/entry&gt;&lt;entry&gt;b2&lt;/entry&gt;&lt;entry&gt;c2&lt;/entry&gt;&lt;/row&gt;
          &lt;/tbody&gt;
        &lt;/tgroup&gt;
      &lt;/table&gt;
    </programlisting>
  
    <figure><title>Column spanning example</title>
      <mediaobject>
        <imageobject><imagedata fileref="files/images/columnspanexample.png" format="PNG"/></imageobject>
        <textobject><phrase>Column spanning example</phrase></textobject>
      </mediaobject>
    </figure>
  
    <para>
      More information about the <emphasis>entry</emphasis> element can be found at <ulink url="http://www.docbook.org/tdg/en/html/entry.html">http://www.docbook.org/tdg/en/html/entry.html</ulink>. Tables may be nested to a level of one, see <ulink url="http://www.docbook.org/tdg/en/html/entrytbl.html">http://www.docbook.org/tdg/en/html/entrytbl.html</ulink>. For the entire source and output pertaining to the examples discussed in this section see <ulink url="files/tableexampleshome.html">Table Examples</ulink>.
    </para>
  </sect1>
</chapter>
    <chapter id="DocBookSys-Chapter10-AuxTools"><title>Auxiliary Tools for DocBook Authoring</title>

  <sect1 id="DocBookSys-Chapter10-AuxTools-Editors"><title>Editors</title>
    <para>
      One of the most important parts of any DocBook authoring suite is the editing environment since this is where the author spend most of the time in the document production process. It is possible to author DocBook documents in a plain text editor but this does not give the user the benefits as syntax highlighting, auto-indentation and spell-checking. Therefore it is imperative to find an editor that is comfortable and maximises productivity.
     </para>

     <sect2 id="DocBookSys-Chapter10-AuxTools-Editors-VI"><title><application>VI/VIM/GVIM</application></title>
       <para><ulink url="http://vim.sourceforge.net/">http://vim.sourceforge.net/</ulink></para>

       <blockquote>
         <para>
           Vi is only available on Unix. Vim works on MS-Windows, Macintosh, Amiga, OS/2, VMS, QNX and other systems.  And also on every Unix system.  Vim offers syntax highlighting for over 200 languages.  And if that's not enough, you can define your own syntax. Vim is free! It is open source with a charityware license.
         </para>
       </blockquote>

       <para>
         VIM which stands for vi improved is a vast improvement on the original Unix editor, GUI version is called GVIM.  This is the editor that I personally use as I personally feel comfortable with its speed and utility.  It has syntax highlighting for <acronym>XML</acronym> and <acronym>SGML</acronym> modes.  It has a relatively steep learning curve however and takes a while to get reasonably proficient at for most people.  But VIM also has an &quot;easy&quot; mode which makes it feel like your typical &quot;dumb&quot; editor yet it still has all the power of VIM behind it.
       </para>

       <figure><title>GVIM screen-shot</title>
         <mediaobject>
           <imageobject><imagedata fileref="files/images/veeeye.png" format="PNG"/></imageobject>
	        </mediaobject>
       </figure>
     </sect2>

     <sect2 id="DocBookSys-Chapter10-AuxTools-Editors-Emacs"><title>Emacs</title>
       <para>
         <ulink url="http://www.gnu.org/software/emacs/emacs.html">http://www.gnu.org/software/emacs/emacs.html</ulink>
       </para>

       <para>
         To quote the Emacs Manual: <quote>Emacs is the extensible, customizable, self-documenting real-time display editor.</quote> Emacs (name derived from Editor MACroS), is a text editor with an emacs lisp core.  It is easier than Vi to get started with and it is also the editor of choice for many Universities and educational institutes, there have been many a flame war over the issue of VI vs EMACS.  It has a <acronym>PSGML</acronym> mode which can be setup to author DocBook with syntax highlighting and Norman Walsh has produced a DocBook IDE major mode which incorporates extensive features such as automatic completion of end tags and insertion of elements.  Emacs has an ispell/Aspell plug-in to enable spell checking on-the-fly. It is available for just about any operating system. GUI capable versions are available. Emacs is released under the GPL (its free).
       </para>

       <figure><title>Emacs screen-shot</title>
         <mediaobject>
           <imageobject><imagedata fileref="files/images/emacs.png" format="PNG"/></imageobject>
         </mediaobject>
       </figure>
     </sect2>

     <sect2 id="DocBookSys-Chapter10-AuxTools-Editors-ThotBook"><title>ThotBook</title>
       <para>
         <ulink url="http://www.freesoftware.fsf.org/thotbook/">http://www.freesoftware.fsf.org/thotbook/</ulink>
       </para>
    
       <para>To quote the FAQ:</para>
       
       <blockquote>
         <para> ThotBook is (will be) a visual editor for DocBook, based on ThotLib. ThotBook will allow users to visually edit DocBook documents using a graphical interface and will allow them to import/export their work into structured DocBook SGML/XML. ThotBook will help to produce valid structured DocBook documents without having to learn the DocBook syntax. ThotBook will respect document structure, as opposed to &quot;WYSIWYG&quot; editors, which produce (mostly) unstructured documents.  
         </para> 
       </blockquote> 

       <para>
         It is only available via <acronym>CVS</acronym> at the moment but should be one to watch for users who like visual interfaces.
       </para>

       <figure><title>ThotBook screen-shot</title>
         <mediaobject>
           <imageobject><imagedata fileref="files/images/thotbook.png" format="PNG"/></imageobject>
         </mediaobject>
       </figure>
     </sect2>

     <sect2 id="DocBookSys-Chapter10-AuxTools-Editors-EpcEdit"><title>EpcEdit</title>
       <para><ulink url="http://www.epcedit.com/">http://www.epcedit.com/</ulink></para>

       <para>
         EpcEdit is a commercial GUI editor for Unix and Windows, it has many features such as integrated enhanced validating <acronym>XML</acronym>/<acronym>SGML</acronym> parser, to quote the website:
       </para> 

       <blockquote>
         <para>
           epcEdit provides a structure-sensitive view of XML or SGML documents and allows editing of a document while keeping it in conformance with the document's DTD. An integrated table editor helps in visualizing the layout of tables conforming to the CALS or HTML table models. The hierarchical structure of a document is represented by a tree view that is updated while the document changes.
         </para>
       </blockquote> 

       <figure><title>EpcEdit screen-shot</title>
         <mediaobject>
           <imageobject><imagedata fileref="files/images/epcedit.png" format="PNG"/></imageobject>
         </mediaobject>
       </figure>
     </sect2>

     <sect2 id="DocBookSys-Chapter10-AuxTools-Editors-Xeena"><title>Xeena</title>
       <para><ulink url="http://www.alphaworks.ibm.com/tech/xeena">http://www.alphaworks.ibm.com/tech/xeena</ulink></para>

       <blockquote>
         <para>
           Xeena, a visual XML editor, is a generic Java application for editing valid XML documents derived from any valid DTD. XML files can be created and edited without learning the intricacies of XML. The editor takes as input a given DTD and automatically builds a palette containing the elements defined in the DTD. Any document derived from that DTD by using a visual, tree-directed paradigm can thus be created, edited, or expanded. The visual paradigm requires only a minimal learning curve, because only valid constructs or elements are presented to the user in a context-sensitive palette. 
         </para>
       </blockquote>

       <para>
         The above quote is according to the website, I installed it and tried it out and it looked OK but I took it no
	 further. As far as licensing goes, it appears that the software is free for &quot;Independent development&quot;,
	 but what this means is unknown by me at the moment. It is platform independent.
       </para>

       <figure><title>Xeena screen-shot</title>
         <mediaobject>
           <imageobject><imagedata fileref="files/images/xeena.png" format="PNG"/></imageobject>
         </mediaobject>
       </figure>
     </sect2>
    
     <sect2 id="DocBookSys-Chapter10-AuxTools-Editors-TheRest"><title>The rest</title>
       <para>
         There are quite a few editors available and there is likely to be a lot more in the future.  Keep an eye out.  Here is a short list of some others, all descriptions are taken from the websites indicated, all rights reserved.
       </para>

       <itemizedlist>
         <listitem>
           <para>
             <ulink url="http://www.morphon.com/xmleditor/index.shtml">http://www.morphon.com/xmleditor/index.shtml</ulink> 
           </para>
           <para>
             The Morphon XML-Editor is a validating XML-Editor which lets you easily create and modify XML documents. Morphon also provides a CSS editor for use as a styling language. The Editor itself is able to run on the maximum number of platforms as it is written in Java, and uses the Java Foundation Classes (JFC) Libraries.
	          </para>
         </listitem>

         <listitem>
           <para><ulink url="http://www.xmlmind.com/xmleditor/">http://www.xmlmind.com/xmleditor/</ulink></para>

           <para>
             XMLmind XML Editor (XXE for short) is an XML editor featuring DTD-aware editing commands and a word processor-like view configured using W3C's cascading style-sheets (CSS).
           </para>
         </listitem>

         <listitem>
           <para><ulink url="http://fabrice.bellard.free.fr/qemacs/">http://fabrice.bellard.free.fr/qemacs/</ulink></para>
           
           <para>
             QEmacs (for Quick Emacs) is a very small but powerful UNIX editor....WYSIWYG DocBook mode based on XML/CSS2 renderer.
           </para>
         </listitem>
       </itemizedlist>
     </sect2>
   </sect1>

   <sect1 id="DocBookSys-Chapter10-AuxTools-SpellChecking"><title>Spell Checking</title>
     <para>
       Since a DocBook document is full of tags it can be quite hard to check the spelling of such a document without having the spell-checker constantly complain.  Fortunately there are spell-checkers available out there that can ignore tags.
     </para>

     <sect2 id="DocBookSys-Chapter10-AuxTools-SpellChecking-Aspell"><title>Aspell</title>
       <para><ulink url="http://aspell.sourceforge.net/">http://aspell.sourceforge.net/</ulink></para>

       <blockquote>
         <para>
           Aspell is an Open Source spell checker designed to eventually replace Ispell. Its main feature is that it does a superior job of coming up with suggestions than just about any other spell checker out there for the English language.
         </para>
       </blockquote>

       <para>
         It is available for both Unix and Windows, and while integration into editing environments is possible, it is possible to use it standalone.  One can easily spell check a DocBook file with the following command sequence.
       </para>

       <screen>
         <userinput><command>aspell</command> <option>--mode</option>=sgml check <filename>in.xml/sgml</filename></userinput>
       </screen>

       <para>
         This will bring up a spell checking program with the usual choices of adding to the dictionary, replacing all occurrences of a word and so on.  The <acronym>SGML</acronym> mode works for both <acronym>SGML</acronym> and <acronym>XML</acronym> documents.  And there are dictionaries for about 16 or so different languages excluding the standard British or American English language packs.
       </para>

       <figure><title>Aspell screen-shot</title>
         <mediaobject>
           <imageobject><imagedata fileref="files/images/aspell.png" format="PNG"/></imageobject>
         </mediaobject>
       </figure>
     </sect2>
   </sect1>
</chapter>
    <chapter id="DocBookSys-Chapter11-References"><title>References</title>
  <sect1 id="DocBookSys-Chapter11-References-Resources"><title>Internet Resources Used</title>
    <para>Thanks goto all the people who helped me when I was stuck.</para>

    <itemizedlist>
      <listitem>
        <para>
          <ulink url="http://www.docbook.org/tdg/en/html/docbook.html">http://www.docbook.org/tdg/en/html/docbook.html</ulink>
        </para>
        <para>
	         <literallayout>
DocBook: The Definitive Guide
by Norman Walsh and Leonard Muellner
With contributions from Bob Stayton
ISBN: 156592-580-7
Version 2.0.6
Updated: Wed, 12 Jun 2002

Copyright 1999, 2000, 2001, 2002 O'Reilly &amp; Associates, Inc. All rights reserved.
          </literallayout>
	       </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://ourworld.compuserve.com/homepages/hoenicka_markus/ntsgml.html">http://ourworld.compuserve.com/homepages/hoenicka_markus/ntsgml.html</ulink>
        </para>
        <para>
	         SGML for NT: A brief tutorial how to set up a free SGML/XML editing and publishing system for Windows 
	       </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://www.dpawson.co.uk/docbook/index.html">http://www.dpawson.co.uk/docbook/index.html</ulink>
        </para>
        <para>Docbook Frequently Asked Questions</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>
        </para>
        <para>
	         <literallayout>
DocBook XML 4.1.2 Quick Start Guide
Jim Weller
Sleepless Tech

jim@sleeplesstech.com

Copyright 2001 by Jim Weller

2001-05-29
          </literallayout> 	  
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://nis-www.lanl.gov/~rosalia/mydocs/docbook-intro.html">http://nis-www.lanl.gov/~rosalia/mydocs/docbook-intro.html</ulink>
        </para>
        <para>
          <literallayout>
Get Going With DocBook
Notes for Hackers
Mark Galassi
Cygnus Solutions

Copyright 1998 by Mark Galassi
          </literallayout>
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://people.freebsd.org/~nik/nwalsh/Customising%20the%20nwalsh%20DSSSL%20stylesheets_files/v3_document.htm">http://people.freebsd.org/~nik/nwalsh/Customising%20the%20nwalsh%20DSSSL%20stylesheets_files/v3_document.htm</ulink>
        </para>
        <para>Customising the nwalsh DSSSL stylesheets nik@FreeBSD.org</para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://old.lwn.net/2000/features/DocBook/">http://old.lwn.net/2000/features/DocBook/</ulink>
        </para>

        <para>
          <literallayout>
Exploring SGML DocBook
April 24, 2000
Giorgio Zoppi
          </literallayout>
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://cyberelk.net/tim/docbook/selfdocbook/selfdocbook.html">http://cyberelk.net/tim/docbook/selfdocbook/selfdocbook.html</ulink>
        </para>
        
        <para>
          <literallayout>
Selfdocbook
Tim Waugh
Red Hat, Inc.

      twaugh@redhat.com  

Copyright 2000-2 by Tim Waugh	  
          </literallayout>
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://www.oasis-open.org/cover/general.html">http://www.oasis-open.org/cover/general.html</ulink>
        </para>
        
        <para>
          <literallayout>
The XML Cover Pages 
SGML: General Introductions and Overviews 
By: Robin Cover 

Last modified: June 28, 1999	  
          </literallayout>
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://www.sagehill.net/xml/docbookxsl/index.html">http://www.sagehill.net/xml/docbookxsl/index.html</ulink>
        </para>
        <para>
          <literallayout>
Robert Stayton
&lt;bobs@sagehill.net&gt;

Draft -- 7 July 2002

Copyright 2002 Robert Stayton
          </literallayout> 
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://www.ibiblio.org/pub/sun-info/standards/xml/why/xmlapps.htm">http://www.ibiblio.org/pub/sun-info/standards/xml/why/xmlapps.htm</ulink>
        </para>
        <para>
          <literallayout>
XML, Java, and the future of the Web
Jon Bosak, Sun Microsystems
Last revised 1997.03.10 
          </literallayout>
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://www.ibiblio.org/godoy/sgml/docbook/howto/">http://www.ibiblio.org/godoy/sgml/docbook/howto/</ulink>
        </para>
        <para>
          <literallayout>
DocBook HOWTO
Jorge Godoy
Conectiva S.A.
Publishing Department

godoy@conectiva.com
          </literallayout>
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://www.w3.org/TR/NOTE-sgml-xml">http://www.w3.org/TR/NOTE-sgml-xml</ulink>
        </para>
        <para>
          <literallayout>
Comparison of SGML and XML
World Wide Web Consortium Note 15-December-1997 
          </literallayout>
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://docbook.sourceforge.net/release/dsssl/current/doc/">http://docbook.sourceforge.net/release/dsssl/current/doc/</ulink>
        </para>
        <para>
          <literallayout>
The Modular DocBook Stylesheets
Norman Walsh
Copyright 1997, 1998, 1999, 2000 by Norman Walsh
          </literallayout>
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://docbook.sourceforge.net/release/xsl/current/doc/">http://docbook.sourceforge.net/release/xsl/current/doc/</ulink>
        </para>

        <para>
          <literallayout>
DocBook XSL Stylesheet Documentation
Norman Walsh
Bob Stayton

Jiri Kosek

Copyright 1999, 2000, 2001, 2002 Norman Walsh. No Warranty
          </literallayout> 
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://www.tldp.org/LDP/LDP-Author-Guide/">http://www.tldp.org/LDP/LDP-Author-Guide/</ulink>
        </para>
        <para>
          <literallayout>
LDP Author Guide
Mark F. Komarinski
mkomarinski@wayga.org

Jorge Godoy
Conectiva S.A.
Publishing Department

godoy@conectiva.com

godoy@metalab.unc.edu

David C. Merrill
dcmerrill@mindspring.com
	         </literallayout> 
	       </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://www.freebsd.org/doc/en_US.ISO8859-1/books/fdp-primer/">http://www.freebsd.org/doc/en_US.ISO8859-1/books/fdp-primer/</ulink>
        </para>

        <para>
          <literallayout>
FreeBSD Documentation Project Primer for New Contributors
Nik Clayton
nik@FreeBSD.org

Copyright 1998, 1999, 2000, 2001, 2002 by Nik Clayton
          </literallayout>
	       </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://www.tldp.org/HOWTO/mini/DocBook-Install/index.html">http://www.tldp.org/HOWTO/mini/DocBook-Install/index.html</ulink>
        </para>
        <para>
          <literallayout>
DocBook Install mini-HOWTO
Robert B Easter
reaster@reaster.com
          </literallayout>
        </para>
      </listitem>

      <listitem>
        <para>
          <ulink url="http://sources.redhat.com/ml/docbook-apps/">http://sources.redhat.com/ml/docbook-apps/</ulink>
        </para> 
        <para>The docbook-apps mailing list archives</para>
      </listitem>
    </itemizedlist> 
  </sect1>
</chapter>
  </part>
</book>

