<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD dcobook xml V4.2//EN" 
                         "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [

<!ENTITY license "
      <para>Permission is granted to copy, distribute and/or modify this
      document under the terms of the <ulink type='http'
      url='http://www.fsf.org/copyleft/fdl.html'><citetitle>GNU Free
      Documentation License</citetitle></ulink>, Version 1.1 or any later
      version published by the Free Software Foundation with no Invariant
      Sections, no Front-Cover Texts, and no Back-Cover Texts. You may
      obtain a copy of the <citetitle>GNU Free Documentation
      License</citetitle> from the Free Software Foundation by visiting
      <ulink url='http://www.fsf.org/'>their Web site</ulink>
      or by writing to: Free Software Foundation, Inc., 59 Temple Place -
      Suite 330, Boston, MA 02111-1307, USA.</para>

      <para>This manual contains short example programs (<quote>the
      Software</quote>). Permission is hereby granted, free of charge, to
      any person obtaining a copy of the Software, to deal in the Software
      without restriction, including without limitation the rights to use,
      copy, modify, merge, publish, distribute, sublicense, and/or sell
      copies of the Software, and to permit persons to whom the Software is
      furnished to do so, subject to the following condition:</para>

      <para>THE SOFTWARE IS PROVIDED <quote>AS IS</quote>, WITHOUT WARRANTY
      OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
      WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
      NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
      CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
      TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
      SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</para>
">


<!ENTITY legal.section "
  <section id='dbxmlqs-1'>
    <title>Legal Notice</title>
    &license;
  </section>
">

]>

<article id="dbxml-quickstart">
  <title>Docbook XML Quick Start</title>
  
  <articleinfo><title>Docbook XML Quick Start</title>
    
    <pubdate>2002-11-27</pubdate>
    
    <authorgroup>
      <author>
    <firstname>Jim</firstname> 
    <surname>Weller</surname> 
    <affiliation> 
      <address><email>jim atat jimweller dot net</email></address>
    </affiliation> 
      </author>
    </authorgroup>
    
    <copyright>
      <year>2001-2002</year> 
      <holder>Jim Weller</holder>
    </copyright>
    
    <abstract>
      <para>Describes how to install, configure and use the tools and resources
      for dcobook XML and dsssl. The purpose of this quick start guide is to get new
      docbook authors, editors, and contributors up and running fast with the
      DoocBook tools. It assumes a fair knowledge of building and installing
      source packages.</para>
    </abstract>
<<<<<<< dbxmlqs.xml

    &legal.notice;

    <revhistory>
      
      <revision>
	<revnumber>0.9.0</revnumber>
	<date>2001-11-20</date>
	<revremark>Fixed openjade install note that I forgot to mention.</revremark>
      </revision>

      <revision>
	<revnumber>0.8.2</revnumber>
	<date>2001-9-16</date>
	<revremark>Proof reading and organization.</revremark>
      </revision>

      <revision>
	<revnumber>0.8.0</revnumber>
	<date>2001-9-15</date>
	<revremark>Major changes to the source tree. Aded system id to xml documents. Added change to DocBook SGML 4.1 catalog that eliminated repeated DTDDECL error. Modified my personal catalog to map the SYSTEM id onto a local copy of the DTD.</revremark>
      </revision>

      <revision>
	<revnumber>0.5.0</revnumber>
	<date>2001-5-29</date>
	<revremark>First revision and rewrite in DocBook XML</revremark>
      </revision>

      <revision>
	<revnumber>0.1.0</revnumber>
	<date>2001-04-12</date>
	<revremark>First Writing in HTML</revremark>
      </revision>
      
    </revhistory>
    
=======
   
>>>>>>> 1.12
  </articleinfo>

  &legal.section;


  <section id="dbxmlqs-2">
    <title>Introduction</title>


    <para>DocBook is a widely used DTD in SGML and XML that is tailored toward
    technical manuals. It's basically a way that authors can write a document
    once in markup and then, using processing tools, convert to many common
    formats (HTML, DOC, RTF, PDF, PostScript etc.). It is used on many projects
    as the main documentation system.</para>

    <para>I'm working on a HOWTO/book. These are my notes from my bout with 
    these tools and concepts. I had a difficult and frustrating time setting up 
    these tools at first. Plus, I couldn't find this document's a working 
    equivalent. So, I truly hope this information will be helpful, but it is 
    provided without warranty or gaurantee. If you break anything you get to 
    keep both pieces.</para>

    <para>This guide tends toward brevity. I assume authors don't
    need to get mired in a gajillion layers of DocBook complexity just to
    generate an articulate piece of work. More simply: Get tools, write content
    and distribute.</para>

    <para>Please, note that I do not cover the installation or usage of some of 
    the 'fluffy' tools like docbook2X or sgml-tools. Nor do I make mention of 
    backends other than html and text. I leave it as an exercise for the reader 
    to generate different types of output (tex, pdf, etc.). This document is 
    intended to be a short path to writing and evaluating your 
    documents.</para>

  </section>
  
  <section id="dbxmlqs-3">
    <title>Requirements</title>

    <para>You'll have to download and install a number of
    packages. Most won't take much to install, but you should be
    familiar with installing GNU source packages.</para>

    <section> 
      <title>Basics</title>
      <para> You'll need a computer with the GNU development environment :) I 
      used MacOS X. You can use another OS, but you'll have to interpolate as 
      necessary.</para>
    </section>   

    <section>
      <title>libxml2</title>
      <itemizedlist>
    <listitem><para> libxml2 <ulink url="http://xmlsoft.org/downloads.html">http://xmlsoft.org/downloads.html</ulink></para></listitem> 
      </itemizedlist>
      <para> You'll need to download the libxml2 package to compile. Libxml2 implements a number of xml standards.</para>
    </section>

    <section>
      <title>libxslt</title>
      <itemizedlist>
    <listitem><para> libxslt <ulink url="http://xmlsoft.org/XSLT/downloads.html">http://xmlsoft.org/XSLT/downloads.html</ulink></para></listitem> 
      </itemizedlist>
      <para> You'll need to download the libxslt package to compile. Libxslt xslt; an xml language to define transformations of xml.</para>
    </section>

    <section>
      <title>DocBook DTD</title>
      <itemizedlist>
    
    <listitem><para> 
   XML  4.2
   <ulink url="http://www.oasis-open.org/docbook/xml/4.2/index.shtml">http://www.oasis-open.org/docbook/xml/4.2/index.shtml</ulink>
   </para></listitem> 
      </itemizedlist>
      
      <para>
    You'll need to get the zip archive from the site listed above. DTD
    stands for Document Type Definition. This from Oasis:

    <blockquote>
      <para>
    DocBook is a DTD maintained by the DocBook Technical Committee of
    OASIS. It is particularly well suited to books and papers about
    computer hardware and software (though it is by no means limited to
    these applications).
    </para>
    </blockquote>
   </para>
    </section>

    <section>
      <title>DocBook Style Sheets</title>

      <itemizedlist>
    <listitem><para> 
    DocBook XSL Stylesheets<ulink url="http://docbook.sourceforge.net/projects/xsl/">http://docbook.sourceforge.net/projects/xsl/</ulink>
   </para></listitem> 
    <listitem><para> 
    LDP XSL Stylesheet <ulink url="http://tldp.org/authors/tools/ldp-xsl.zip">http://tldp.org/authors/tools/ldp-xsl.zip</ulink>
   </para></listitem> 
      </itemizedlist>
      
      <para>You'll need to download the nwalsh style sheets. You can get by with 
   just that, but the LDP ones have some nice extensions.  From Norman Walsh's 
   docbook site.
   </para>
    </section>
  </section><!-- ends requirements -->

  <section id="dbxmlqs-4">
    <title>Installation and Configuration</title>

    <para>Setting up the tools was the hardest part for me. The maze of 
    catalogs, programs and acronyms is daunting to the first time (even 
    technically minded) user. Never mind the miles of error message these tools 
    generate by default. I ran into a couple of snags with work arounds that 
    I'll mention.</para>
    
    <section>
      <title>Ground work</title>
      <para>
  First setup some handy environmental variables.
  </para>
      <screen>
export DBARCHIVE=/where/you/put/your/downloads
export SGMLHOME=/where/you/want/to/install/everything
      </screen>
    </section>

    <section>
      <title>OpenJade</title>
      <para> The only package that requires compiling is openjade. Openjade is a 
    reasonable GNU autotools source build. Be sure to add openjade's lib directory
<<<<<<< dbxmlqs.xml
   to your library search path (ld.so.conf on Linux). Also, note that you have to manually copy 
=======
   to your library search path (ld.so.conf on Linux). Note that you have to manually copy 
>>>>>>> 1.12
the dsssl subdirectory as the install doesn't do it for you.
    </para>

      <screen>
cd /usr/src
tar -xzf $DBARCHIVE/openjade-1.3.1.tar.gz
cd openjade-1.3.1
./configure --prefix=$SGMLHOME/openjade-1.3 --enable-http &amp;&amp; make &amp;&amp; make install
cp -a dsssl $SGMLHOME/openjade-1.3.1
cd $SGMLHOME/openjade-1.3.1
    </screen>


    </section>
    
    <section>
      <title>DocBook DTDs and Entities</title> 

      <para> Next, you'll need to unpack all the DocTools DTDs and entities. 
      Some of the XML entities need to be replaced with SGML ones.  You can rename by hand or try my 
      one line script in bash.</para>

      <screen>
cd $SGMLHOME
mkdir dtd
cd dtd
mkdir 4.2xml
cd 4.2xml
unzip -a $DBARCHIVE/docbook-xml-4.2.zip
cd ent
rm *
unzip -a $DBARCHIVE/ISOEnts.zip
for i in ISO*;do mv $i `echo $i | sed -e 's/ISO/iso-/g'`.gml;done
    </screen>
    </section>
    
    <section>
      <title>Norm Walsh's and LDP's Style Sheets</title>
      <para> Now, we're ready to unpack Norm Walsh's and the LDP's Styles Sheets. 
    These are wonderfully straight forward.</para>
      
      <screen>
    
cd $SGMLHOME
tar -xzf $DBARCHIVE/docbook-dsssl-1.77.tar.gz
mv docbook-dsssl-1.77 dsssl
cd dsssl

cp $DBARCHIVE/ldp.dsl html/
cp $DBARCHIVE/ldp.dsl print/

    </screen>
    </section>
    
    <section>
      <title>Configuration</title>
      <para> Then, well need to setup our SGML_CATALOG_FILES evironment variable. This 
    is a list of files that openjade will use to find 'stuff'.  I consolidated them 
    all down to one file shown below. Once you get it set and working, I recommend 
    making this a permanent fixture in your environment (.profile,.bashrc, etc.). 
    Then when you want to change from 4.2 to 3.1 to compile other HOWTOS you just 
    edit 'your' main catalog file. </para>
      
      
      <screen>
export SGML_CATALOG_FILES=$SGMLHOME/openjade-1.3.1/dsssl/catalog:$SGMLHOME/dtd/4.2xml/docbook.cat
    </screen>
      
      <para>Make sure that you add $SGMLHOME/openjade-1.3.1/bin to your path and that 
    you update your environment so that the loader can find the libraries located in 
    $SGMLHOME/openjade-1.3/lib. I edited /etc/profile and /etc/ld.so.conf; YMMV. 
    </para>
    </section>
  </section>


  <section id="dbxmlqs-5">
    <title>Using the Tools</title>
    <para>This is a terse introduction to using the DocBook tools to compile XML documents.
  I won't go into the details of DocBook mark up. See 
  <ulink url="http://docbook.org/tdg/en/html/docbook.html">DocBook: The Definitive Guide</ulink>
  for complete information on writing DocBook markup.</para>
    
    
    <section>
      <title>A Simple dcobook xml document</title>
      
      <para> Below is an example of a very simple dcobook xml document. Copy it into a 
    text file and we'll compile it into HTML and RTF in a minute. </para>

      <para><ulink url="sample/test.xml">text.xml</ulink> [<ulink url="sample/test.xml.txt">as text</ulink> ]</para>

      <!-- BEGIN SAMPLE DOCUMENT -->
      <programlisting>
<![CDATA[

<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD dcobook xml V4.2//EN"
                      "http://docbook.org/xml/4.2/docbookx.dtd" 
[
 <!ENTITY version "0.01">
]>

<!-- 
Comments just like html
-->

<book>

  <bookinfo>
    <title>Simple XML Sample</title>
    <author>
      <firstname>John</firstname>
      <surname>Doe</surname>
    </author>
    <copyright><year>2002</year><holder>John Doe</holder></copyright>
    <legalnotice>
      <para>This legal mumbo jumbo will stop evil.</para>
    </legalnotice>
    <abstract>
      <para>This is Simple XML Sample version &version;. It is good for nothing but processing.</para>
    </abstract>
  </bookinfo>

  <chapter>
    <title>About this book</title> 
    <para>
      This book was not hard.
    </para>
    
    <section>
    <title>Copyrights and Trademarks</title>
    <para>Copyright &copy; 2002 John Doe</para>
    </section>

    <section><title>Purpose/Scope</title> 
    <para>This guide is tightly scoped with one purpose; to process.</para>
    </section>
  </chapter>

  <appendix><title>References</title>
    <para>Some Hoity Toity Person</para>
  </appendix>

</book>

]]>

</programlisting>
<!-- END SAMPLE DOCUMENT -->

    </section>
    <section>
      <title>Generating HTML and RTF</title>

      <para>You can see that DocBook markup is simple. Now 
      let's compile this test.xml into some real LDP HOWTO style HTML.</para>

      <screen>
openjade -t xml -d $SGMLHOME/dsssl/docbook/html/ldp.dsl#html $SGMLHOME/dsssl/docbook/dtds/decls/xml.dcl test.xml
</screen>

<para>You shouldn't get any error messages. After, processing you should have the following (or similar) in the
folder with test.xml</para>
<screen>
a23.html  index.html  test.xml  x20.html
c14.html  ln10.html   x17.html
</screen>


      <para>To compile an RTF try this </para>
      <screen>
openjade -t rtf -d $SGMLHOME/dsssl/docbook/print/ldp.dsl#print $SGMLHOME/dsssl/docbook/dtds/decls/xml.dcl test.xml
</screen>

      <para>Description of command line switces:</para>
      <itemizedlist>
    <listitem><para> -t backend to use (fot|rtf|tex|mif|sgml|xml)</para></listitem>
    <listitem><para> -d style sheet to use </para></listitem>
      </itemizedlist>

    <para>
    I've made my sample outputs available with this guide.</para>

    <itemizedlist>
    <listitem><para> <ulink url="sample/index.html">Sample HTML output</ulink></para></listitem> 
    <listitem><para> <ulink url="sample/test.rtf">Sample RTF output</ulink> </para></listitem>
    </itemizedlist>

      <para>That's all there is to it. Once you figure out TeX and RTF you can 
      convert to other popular document formats with other tools. You might use 
      TeX, LaTeX, PDF, PDB, or even some unmentioned proprietary formats and 
      tools. </para>
      
    </section>
  </section>

  <section id="dbxmlqs-7">
    <title>References</title>
    <para>I glommed all this together from mailing lists and documents listed below.</para>

    <itemizedlist>
      <listitem><para><ulink url="http://www.tldp.org/">Linux Documentation Project</ulink></para></listitem>

      <listitem><para><ulink url="http://www.ibiblio.org/godoy/">Godoy's Docbook Page</ulink></para></listitem>

      <listitem><para><ulink url="http://www.linuxdoc.org/HOWTO/mini/DocBook-Install/">DocBook Install mini-HOWTO</ulink></para></listitem>

      <listitem><para><ulink url="http://docbook.org/tdg/en/html/docbook.html">DocBook: The Definitive Guide by Norman Walsh</ulink></para></listitem>

      <listitem><para><ulink url="http://adl.opengroup.org/exgr/papers/sgml_setup.html">Setup Instructions For A Coherent SGML/DocBook Environment</ulink></para></listitem>

      <listitem><para><ulink url="http://www.oasis-open.org/cover/walshSystemsIDsNewURL.html">Standard Deviations from Norm: If You Can Name It, You Can Claim It! (Norm Walsh article)</ulink></para></listitem>

      <listitem><para><ulink url="http://www-106.ibm.com/developerworks/library/l-docbk.html?dwzone=linux">A gentle guide to DocBook (IBM article)</ulink></para></listitem>

      <listitem><para><ulink url="http://linuxfocus.saneg.itu.edu.tr/English/May2000/article152.shtml">Making PDF documents with DocBook (An incredibly helpful article)</ulink></para></listitem>

      <listitem><para><ulink url="http://openjade.sourceforge.net">OpenJade home</ulink></para></listitem>
      <listitem><para><ulink url="http://www.oasis-open.org/docbook/">DocBook Technical Commitee</ulink></para></listitem>
      <listitem><para><ulink url="http://docbook.sourceforge.net">DocBook Home at Sourceforge</ulink></para></listitem>
      <listitem><para><ulink url="http://www.jimweller.net">Jim Weller's sleepless notes</ulink>
<itemizedlist>
        <listitem><para><ulink url="http://www.jimweller.net/article.php?sid=26">Title Bout: Jim v. Doctools</ulink></para></listitem>
        <listitem><para><ulink url="http://www.jimweller.net/article.php?sid=27">Using Doctools XML</ulink></para></listitem>
      </itemizedlist>
</para></listitem>

    </itemizedlist>



  </section>


</article>

