<!DOCTYPE book
 PUBLIC "-//Mark Wroth//DTD DocBook V4.1-Based Extension Literate Programming 1.1//EN"[
<!ENTITY sample.code SYSTEM "sample.code">
<!ENTITY SHOWDIR CDATA "IGNORE">
]>
<book id=dblp>
  <bookinfo>
    <author>
      <firstname>Mark</firstname>
      <surname>Wroth</surname>
    </author>
    <title>DBLP: DocBook-Based Literate Programming</title>
    <revhistory>
      <revision>
	<revnumber>2.7</revnumber>
	<date>21 October 2001</date>
	<revdescription>
	  <para>Updated based on comments from Lutz Prechelt.</para>
	</revdescription>
      </revision>
      <revision>
	<revnumber>2.6b</revnumber>
	<date>31 July 2001</date>
	<revdescription>
	  <para>Modify DSSSL style sheets to deal with the case where
	  a programlisting is not part of an output literate
	  program.</para>

	  <para>The case of definition sections is not handled well in
	  the resulting DSSSL code, as there is no obvious test by
	  which we can identify such a section.</para>
	</revdescription>
      </revision>
      <revision>
	<revnumber>2.5</revnumber>
	<date>20 April 2001</date>
	<revdescription>
	  <para>This revision translates the previous release
	  (revision 1.4) into itself (rather than a
	  <application>Nuweb</application>-based literate
	  program).</para> 

          <para>Additionally, it defines several new entities intended
	  to make <acronym>SGML</acronym> easier to include in the
	  literate program.</para>

          <para>Finally, the <application>weave</application> style
          sheet has been split into two additional style sheets (in
          addition to <filename>SGMLWeave.dsl</filename> in order to
          facilitate further style customizations.</para>
	</revdescription>
      </revision>
      <revision>
	<revnumber>1.4</revnumber>
	<date>12 April 2001</date>
	<revdescription>
	  <para>This revision appears to be functional, and has been
	  released for use (and published on the author's website).</para>
	</revdescription>
      </revision>
    </revhistory>
    <legalnotice>
      <para>This document, and the literate programming system
      described herein, are copyright &copy; 2001 by Mark
      Wroth. Permission is granted for the reproduction, use, and
      modification of this system provided that:<itemizedlist>
	  <listitem>
	    <para>No charge is made for the use of this system. A
            nominal charge for reproduction of the media on which the
            system is provided may be levied, however. </para>
	  </listitem>
	  <listitem>
	    <para>The complete literate programming source of the
            system is made available to the user.</para>
	  </listitem>
	  <listitem>
	    <para>Modifications of this system are clearly identified
            as derivative works.  Provision must be made to identify
            the author of the changes, and to provide error reports to
            the modifier rather than the original author.</para>
	  </listitem>
	</itemizedlist>
      </para>
      <para>Works created using this system (as opposed to
      modifications of this system itself) are subject to whatever
      copyright or use provisions may be imposed by the authors of
      those works; the use of this system shall not be the basis for
      any change or modification of the rights of such
      authors. </para>

      <para>The author of this system, in permitting its general use,
      makes no warranty of its suitability for any purpose nor any
      guarantee of its correctness. In other words, you are welcome to
      use this system, but you do so at your own risk.</para>
    </legalnotice>
  </bookinfo>
  <chapter>
    <title>Functional Description</title>

    <para>The DocBook-based Literate Programming system provides a
    mechanism to write literate programs using a minor extension of
    the <acronym>SGML</acronym> <application>DocBook</application>
    <acronym>DTD</acronym>.</para>

    <para>The system consists of two main parts:
    <itemizedlist>
      <listitem>
	<para>A <acronym>DTD</acronym> that extends
        <application>DocBook</application> to add the logic needed for
        literate programming.  These are relatively minor extensions
        to the basic <acronym>DTD</acronym>.  The details are discussed in
        <xref linkend="DTD">.</para>
      </listitem>
      <listitem>
	<para><acronym>DSSSL</acronym> style sheets that, together
        with a <acronym>DSSSL</acronym> engine that implements some of
        James Clark's extensions, serve as
        <application>tangle</application> and
        <application>weave</application> processors.  These style
        sheets are discussed in <xref linkend="tangle"> and <xref
        linkend="weave">, respectively.</para>
      </listitem>
    </itemizedlist></para>

    <para>This document also discusses the design considerations
    behind the implementation, and provides a short sample document
    that serves as an example of how the <acronym>DTD</acronym> is
    used (and serves as a simple test case).</para>

    <section id="purpose">
      <title>Purpose of the Functional Description</title>

      <para>This functional description for <application>DocBook-based
      Literate Programming</application> is written to provide:
        <orderedlist>
	  <listitem>
	    <para>The system requirements to be satisfied which will
            serve as a basis for the system design.</para>
	  </listitem>
	  <listitem>
	    <para>Information on performance requirements, preliminary
            design considerations, and user impacts including fixed
            and continuing costs.</para>
	  </listitem>
	  <listitem>
	    <para>A basis for development of system tests.</para>
	  </listitem>
	</orderedlist></para>
    </section>

    <section id="background">
      <title>Background</title>

<![ IGNORE [
This paragraph shall present background information concerning the
uses and purposes of the system.  Reference must be made to
interfacing systems when needed to enhance the general description.
The relationships between the project and other capabilities being
developed concurrently shall be described.
]]>

      <section role="subsection" id="lp">
        <title>Literate Programming</title>

	<para><firstterm>Literate programming</firstterm> is a style
        of computer programming pioneered by Professor Donald Knuth in
        the early 1980's (the defining paper was published in
        <citetitle>The Computer Journal</citetitle> in May 1984, at
        which point the earliest literate programming system,
        <application>WEB</application>, was already functional).
        </para>

	<para>The key tenent of literate programming is that computer
        programs are written to be read and understood by <emphasis>human
        beings</emphasis> as well as computers&mdash;and the organization of the
        program's source code should allow the program author to
        explain the purpose and implementation of the code to the
        human audience.  In Knuth's own words, <quote>Instead of imagining
        that our main task is to instruct a <emphasis>computer</emphasis> what to
        do, let us concentrate rather on explaining to <emphasis>human
        beings</emphasis> what we want a computer to do.</quote><footnote>
	    <para><citetitle>Literate
        Programming</citetitle>, originally published in <citetitle>The Computer
        Journal</citetitle>, May 1984, quoted in <citation><xref
        linkend="knuth92">p.~99</citation></para>
	  </footnote>.</para>

	<para>To this end, a literate programming system typically supports several
        functions:
          <itemizedlist>
	    <listitem>
	      <para>Mechanisms to extract or otherwise make available
              to the computer the code instructions making up the
              computer program in a form usable by the computer
              (e.g. in a form suitable for submission to the
              compiler), and to translate the source code and
              documentation into appropriately rendered documentation.
              </para>
	    </listitem>
	    <listitem>
	      <para>The ability to write code documentation using the
              full range of typographic features used in normal
              typesetting.</para>
	    </listitem>
	    <listitem>
	      <para>The ability to arbitrarily intermingle code and
	      documentation.</para>
	    </listitem>
	    <listitem>
	      <para>The ability to arbitrarily reorder code fragments
              so that the exposition of the program design may precede
              in an order appropriate for the human reader, while
              retaining the instruction order required for the
              computer to correctly execute the program.</para>
	    </listitem>
	  </itemizedlist>
          The process of making the code instructions available to the
          computer is called the <firstterm>tangle</firstterm> phase
          of processing, while the process of rendering the
          documentation is called the <firstterm>weave</firstterm>
          phase.  These names derive from the names of the two
          programs making up the original
          <application>WEB</application> system that performed these
          functions.</para>

	<para>Some literate programming processors, including Knuth's
        original <application>WEB</application> system, additionally
        <quote>pretty print</quote> the programming language instructions (for
        example, by setting the reserved words of the language in
        boldface type).  This pretty print capability is not
        universal, and in fact is not desired by some
        programmers. Another capability sometimes found is the ability
        to define macros in the literate programming system, usually
        to supplement the capabilities of the underlying programming
        language.</para>

	<para>Since the introduction of Knuth's
        <application>WEB</application> system, which was used for the
        <application>TeX</application> and
        <application>MetaFONT</application> programs, a variety of
        other literate programming systems have appeared, as have a
        number of other mechanisms for improved commenting of source
        code<footnote><para>The boundary between <quote>literate
        programming</quote> systems and <quote>improved
        commenting</quote> mechanisms is somewhat subjective.
        However, for the purposes of this discussion, a system is
        considered a literate programming system if it offers the
        capabilities listed above.</para> </footnote>.  A complete
        review of the available systems is beyond the scope of this
        discussion. However, experience with the original
        <application>WEB</application> system, John Krommes'
        <application>FWEB</application>, and Preston Brigg's
        <application>Nuweb</application> literate programming systems,
        the <application>doc</application> <application>LaTeX
        2e</application> documentation system, and Normal Walsh's
        <application>DocBook</application>-based
        <acronym>DSSSL</acronym> style sheet documentation systems
        (both of which may be characterized as improved commenting
        systems) has been a significant factor in defining the
        characteristics desired in this system.</para>
      </section>
      <section role="subsection" id="sgml">
        <title><acronym>SGML</acronym> and <acronym>XML</acronym></title>

	<para>The <firstterm>Standard Generalized Markup
        Language</firstterm> (<acronym>SGML</acronym>) is defined in
        <acronym>ISO</acronym> Standard ISO 8879:1986, and defines a
        mechanism for <emphasis>defining</emphasis> markup languages
        and enforcing certain relationships among the data contained
        in appropriately marked up documents.  Among other things,
        <acronym>SGML</acronym> provides a clear mechanism for making
        explicit what parts of a document have what role, and does so
        in a way that encourages the construction of tools able to
        parse such documents&mdash;and hopefully do useful things with the
        parsed information.</para>

	<para>In the late 1990's <acronym>SGML</acronym> was
        supplemented by <acronym>XML</acronym>, which is a simplified
        <acronym>SGML</acronym> application designed to make it easier
        to construct parsers and other processing tools.  In general,
        <acronym>XML</acronym> has the same basic functionality as
        <acronym>SGML</acronym>, with some of the lesser-used features
        of the language omitted. Tools that can process
        <acronym>SGML</acronym> documents can also usually process
        <acronym>XML</acronym> documents; it is not generally the case
        than an <acronym>XML</acronym> tool can process a general
        <acronym>SGML</acronym> document.</para>
      </section>
      <section role="subsection">
        <title>DocBook</title>

	<para>One of the useful features of <acronym>SGML</acronym> is
        the ability to create <firstterm>document type
        definitions</firstterm> (<acronym>DTD</acronym>) that describe
        the structure of documents and the markup that makes that
        structure explicit.  This permits the creation of general
        document types&mdash;and the tools to process them.</para>

	<para>One such document type is
        <application>DocBook</application>, a document type created
        for computer-oriented technical books.
        <application>DocBook</application> is maintained by
        <acronym>OASIS</acronym>, and has evolved into a flexible and
        robust document definition, supported by a variety of tools.
        <application>DocBook</application> exists in both
        <acronym>SGML</acronym> and <acronym>XML</acronym>
        versions.</para>

	<para>In particular, Norman Walsh has defined a set of
        <acronym>DSSSL</acronym> style sheets that process
        <application>DocBook</application> documents and produce
        printed and <acronym>HTML</acronym> output renderings. These
        style sheets are both extensible and customizable, and serve
        as a significant base for computer-oriented
        documentation&mdash;such as a literate program.</para>
      </section>
    </section>

    <section id="objectives">
      <title>Objectives</title>

<![ IGNORE [This paragraph shall state the major performance requirements and
   goals of the proposed system.  These statements should be concise,
   quantified if possible, and may include examples.  When applicable,
   related events, such as exercises or impending military operations,
   may be discussed.  ]]> 

      <para>This project creates a set of extensions to the
      <application>DocBook</application> <acronym>SGML</acronym>
      <acronym>DTD</acronym> to allow its use for literate programming
      markup.</para>

      <para>The resulting system shall <itemizedlist>
	  <listitem>
	    <para>Provide a mechanism to extract program files from
            the literate programming source in appropriate forms for
            their use as source code in the intended programming
            language or languages. </para>
	  </listitem>
	  <listitem>
	    <para>Permit the use of existing
            <application>DocBook</application>-based tools with only
            minor modifications (ideally none) to produce
            documentation of software projects. </para>
	  </listitem>
	</itemizedlist>
      </para>
    </section>

    <section id="existing">
      <title>Existing Methods and Procedures</title>

<![ IGNORE [
This paragraph shall briefly describe the current methods and
procedures being employed to satisfy the existing information
requirements.  A chart must be provided depicting the existing data
flow through the functional system from data acquisition through its
processing and eventual output.  This chart may be complemented by an
explanation or another chart showing the sequence in which the
operational functions are performed by the user and identifying the
support provided by the present system for decision making.
Additionally, at least the following information should be included in
this description:

        a.  Organizational and personnel responsibilities.

        b.  Equipment being used.

        c.  Inputs and outputs including volume and frequency.

        d.  Provisions in the system design for operation in
        degraded modes or at alternate sites in cases of
        emergency, disaster, or accident.

        e.  Deficiencies, including limitations, such as time
        delays.
]]>

      <para>There are a variety of literate programming systems in use
      at the current time.  In general, they can be described in three main
      categories:
        <itemizedlist>
	  <listitem>
	    <para>Language-aware systems.  These systems are designed
            to support a single computer programming language, and are
            marked by the ability to do limited parsing of code
            sections, usually accompanied by <quote>pretty
            printing</quote> of the computer source code.  Knuth's
            original <application>WEB</application> system falls into
            this category.  Most language aware systems use
            <application>TeX</application> as their typesetting
            system.</para>
	  </listitem>
	  <listitem>
	    <para>Language-independent systems.  These systems attempt
            no parsing of the code sections. Most language-independent
            systems use <application>TeX</application> as their
            typesetting systems, although there is some move towards
            <acronym>HTML</acronym> as a documentation
            language.</para>
	  </listitem>
	  <listitem>
	    <para>Comment-based systems.  These systems extend the
            comment structures of the supported language in an attempt
            to provide usable documentation. Examples of such systems
            are the <application>doc</application> system used to
            document <application>LaTeX 2e</application> packages,
            and&mdash;I believe&mdash;the
            <application>Javadoc</application> system. </para>
	  </listitem>
	</itemizedlist>
       </para>

      <para>Most or all of these existing systems target a specific
      output format, usually the printed page, rendered via the
      <application>TeX</application> typesetting system.  In part,
      this is a historical accident; the first literate programming
      system used <application>TeX</application>.  However, attempts
      to implement other documentation languages (notably an attempt
      to write a <application>C</application>-language literate
      programming system with <application>troff</application> as the
      documentation processor) indicate that the demands on the
      documentation branch of a literate programming system are
      relatively taxing. This has undoubtedly contributed to the
      limited number of output forms supported, although some attempts
      to support <acronym>HTML</acronym> have been made.</para>

      <para>However, I am not aware of any literate programming
      systems based on <acronym>SGML</acronym> markup of the source
      code<footnote> <para>There are a number of efforts related to
      literate programming in <acronym>SGML</acronym> or
      <acronym>XML</acronym>, and Robin Cover's excellent web page
      provides links to many of them.  However, with the possible
      exception of <application>SWEB</application>, whose author
      disclaims publication and citation of the work, none of them
      appear to me to be usable general literate programming
      systems.</para> </footnote>.  This omission seems unfortunate,
      given the obvious applicability of <acronym>SGML</acronym>
      markup to the process of defining a literate program.</para>

      <para>Since the original creation of <acronym>DBLP</acronym> at
      least two <acronym>XML</acronym>-based literate programming
      systems have been developed. Rafael R. Sevilla
      (<email>sevillar@team.ph.inter.net</email>) has developed an
      implementation that is functionally an addition to DocBook or
      other systems, implemented using <acronym>XML</acronym>
      namespaces.  This system is at <ulink
      url="http://xml-lit.sourceforge.net/">
      http://xml-lit.sourceforge.net/</ulink>.  Separately, Norman
      Walsh has reimplemented a literate programming system as part of
      the <application>DocBook</application> <acronym>CVS</acronym>
      source on SourceForge.</para>
    </section>

    <section id="proposed">
      <title>Proposed Methods and Procedures</title>
<![ IGNORE [
This paragraph shall describe proposed methods and procedures.  This
description, written in noncomputer-oriented language, shall explain
how the proposed system will interact with the functional processes
which the automated system will support.  Products from other systems
that will be used with or become part of the proposed system shall be
Identified.

A chart depicting the proposed data flow should be provided to
present an overall view of the planned capabilities.  If the
proposed system will eliminate or degrade any capabilities in the
existing system, these capabilities must also be identified and
reasons stated for their elimination or degradation.  Alternative
methods and procedures that have been considered may be included. 
A chart showing the major functional processing steps and a chart
showing the interacting organizations should be included within
the following paragraphs wherever they best complement the
narrative.
]]>

      <para>This project implements an <acronym>SGML</acronym>
      markup-based literate programming system.  Literate computer
      programs are written using some form of text
      editor&mdash;preferably, but not necessarily an
      <acronym>SGML</acronym>-aware editor.  The documentation and
      programming language code is marked up using an extension of the
      <application>DocBook</application> <acronym>DTD</acronym>.  Once
      the literate program is written (partially or completely), it is
      processed using a variant of the <application>Jade</application>
      <application>DSSSL</application> engine with either a
      <application>tangle</application> style-sheet (which is a
      stand-alone style sheet provided by this project), or a
      <application>weave</application> style sheet (which extends the
      <application>DocBook Modular Style Sheets</application> in
      several small but important ways).</para>

      <para>In principle, the <acronym>DTD</acronym> defined here
      could be used by other programs implementing the
      <application>weave</application> or <application></application>
      functionality.  This would be entirely in keeping with the
      principles of <acronym>SGML</acronym>.  In particular, an
      extension of this system to <acronym>XML</acronym> and
      re-implementation of the processors in <acronym>XSL</acronym>
      seems a natural extension to this work.  However, only the
      <acronym>DSSSL</acronym> implementations mentioned above are
      implemented as part of this work.</para>

      <section role="subsection" id="improvements">
        <title>Summary of Improvements</title>
<![ IGNORE [
This paragraph shall provide a qualitative and quantitative summary of
the benefits to be obtained from the proposed system.  Required
capabilities that will be satisfied by the proposed system shall be
explicitly identified.  A comparison of the deficiencies identified in
paragraph 2.3 and the identification of any additional capabilities
required, along with appropriate explanations, may be provided.  When
improvements of the existing methods and procedures are a requirement,
the extent of the anticipated improvements must be stated.  The
discussion may include:

        a.  Functional Improvements (new capabilities).

        b.  Improvements of degree (upgrading existing            
        capabilities).

        c.  Timeliness (improved response time).
]]>

	<para>Creating an <acronym>SGML</acronym>-based literate
        programming system makes it possible to exploit the wide
        variety of <acronym>SGML</acronym> (or, with minor variations,
        <acronym>XML</acronym>) tools.  In particular, this makes it
        straightforward to produce different output formats, such as a
        printed version or an <acronym>HTML</acronym> version.</para>

        <para>The use of <acronym>SGML</acronym> also separates the
        definition of the document markup from the definition of the
        processing tools.  In principle, this allows many different
        tools to be used with literate programs written with this
        system. This advantage is largely theoretical at this point,
        however.</para>
      </section>
<![ IGNORE [
      <section role="subsection" id="impacts">
        <title>Summary of Impacts</title>
<!--
This and the following paragraphs shall describe the anticipated
impacts and associated costs of the proposed system on the existing
organizational and operational environments of the user.  Impacts on
the user during the development of the system shall be noted.
-->
        <para></para>
       </section>
]]>

       <section role="subsection" id="assumptions">
         <title>Assumptions and Constraints</title>
<![ IGNORE [
This paragraph shall describe any user assumptions and constraints
that will affect development and operation of the system.  Any
limitations affecting the desired capability and explicit
identification of any desired capabilities that will not be provided
by the proposed system shall be discussed.  Any anticipated
operational changes that will affect the proposed operation of the
system shall be discussed.
]]>

	<para>It is assumed that the user of this system is familiar
        with the use of <acronym>SGML</acronym>-based tools, and the
        <application>DocBook</application>
        <acronym>DTD</acronym>.</para>

        <para>The processing <acronym>DSSSL</acronym> style sheets
        assume the presence of selected <acronym>DSSSL</acronym>
        extensions implmented in James Clark's
        <application>Jade</application> engine (specifically the
        <function>entity</function> and
        <function>processing-instruction</function> flow
        objects). This capability is necessary to use the specific
        style sheets provided by this project, but the use of the
        <acronym>DTD</acronym> is not affected.</para>
      </section>
    </section>
<![ IGNORE [
    <section id="details">
      <title>Detailed Characteristics</title>
      <para></para>
    </section>
]]>
    <section id="design">
      <title>Design Considerations</title>
      <itemizedlist>
        <listitem>
          <para> Minimize changes to the
          <application>DocBook</application> <acronym>DTD</acronym> to
          allow processing using existing output tools.</para>
	</listitem>
        <listitem>
          <para> Keep the existing <sgmltag>programlisting</sgmltag>
          as the basis for a scrap (again to minimize changes needed
          in the output processors).</para>
        </listitem>
        <listitem>
          <para>Use added attributes for file output, definition and
          reference to continued and continuation scraps.  Use of both
          continued and continuation markup is semantically redundant,
          but will make processing of the
          <application>weave</application> branch easier&mdash;I
          think.</para>
	</listitem>
        <listitem>
          <para> Use <sgmltag>xref</sgmltag> for reference to definition scraps,
          and the <literal>xreflabel</literal> attribute for the definition
          scrap title. Again, this is driven by a desire to minimize
          changes that would impact the output processing tools.</para>
	</listitem>
        <listitem>
          <para> Make maintaining, modifying, and adding this
          functionality to other document types as easy as possible
          (see <xref linkend="flexibility">).</para>
	</listitem>
      </itemizedlist>
<![ IGNORE [
      <section role="subsection" id="system-description">
        <title>System Description</title>
<!--
This paragraph shall provide a general description of the design of
the proposed AIS.  Related and interfacing systems and their
documentation will be referred to as required to enhance this general
description.  This description shall include a chart showing the
relationship of the user organizations to the major components of the
proposed AIS.  This chart shall be based on the information included
in paragraph 2.4.
-->
]]>
      <section role="subsection" id="system-functions">
        <title>System Functions</title>
<![ IGNORE [
This paragraph shall describe the functions of the proposed AIS.  The
performance requirements stated in paragraph 3.1 and the functions
described by paragraph 3.2 must be elaborated upon here in enough
detail that the system environment in Section 5 can be related to
them.
]]>
        <para>This system performs three basic functions:
          <itemizedlist>
          <listitem>
            <para> Provide a <acronym>DTD</acronym> that allows the
            markup of literate programs, including a flexible system
            for describing the purpose and implementation of the
            computer program (based on
            <application>DocBook</application>) and markup of the
            program code itself to allow the literate program to
            produce the computer instructions.</para>
	  </listitem>
          <listitem>
            <para> A <application>tangle</application> mechanism that
            actually produces the computer instructions from the
            literate programming source code.  This implementation,
            <filename>SGMLTangle.dsl</filename> is a <acronym>DSSSL</acronym>
            style sheet using extensions to the
            <acronym>DSSSL</acronym> standard as implemented in James
            Clark's <application>Jade</application> <acronym>DSSSL</acronym>
            engine.</para>
	  </listitem>
          <listitem>
            <para>A <application>weave</application>
            implementation that renders the literate programming
            source into useful documentation.  This style
            specification, <filename>SGMLWeave.dsl</filename>, extends Norman
            Walsh's <citetitle>Modular DocBook Style Sheets</citetitle>.  It
            provides both print and <acronym>HTML</acronym> output. </para>
	  </listitem>
	  </itemizedlist></para>
      </section>

      <section role="subsection" id="flexibility">
        <title>Flexibility</title>
<![ IGNORE [
This paragraph shall describe the capability to be incorporated for
adapting the system to changing requirements such as anticipated
operational changes, interaction with new or improved systems, and
planned periodic changes. 
]]>

        <para>It is the intention of this system to:
          <itemizedlist>
            <listitem>
              <para> Maintain the ability to update the extensions to new versions of
              <application>DocBook</application> as they are published.</para>
	    </listitem>

            <listitem>
              <para> Make the extensions as easy as possible to to move between the
              <acronym>SGML</acronym> and <acronym>XML</acronym> versions.</para>
	    </listitem>

            <listitem>
              <para> Make it as simple as possible to add the literate
              programming functionality to other
              <application>DocBook</application>-based
              <acronym>DTD</acronym>s.</para>
	    </listitem>

            <listitem>
              <para> Provide a basis on which other implementations of
              the <application>tangle</application> and
              <application>weave</application> functions could be
              built to support other tool chains.
              </para>
	    </listitem>
	  </itemizedlist></para>
      </section>
    </section>
<![ IGNORE [
<section role="subsection"><title>System Data</title>
\label{sec:data}
]]>

    <section id="environment">
      <title>Environment</title>
<![ IGNORE [
This section shall describe the current ADP environment and
project the environment needed to satisfy those requirements
delineated in Sections 2 and 3.
]]>
   
      <section role="subsection" id="equipment">
        <title>Equipment Environment</title>
<![ IGNORE [
This paragraph shall describe the equipment capabilities required for
the operation of the proposed AIS.  This paragraph will present broad
descriptions of the equipment presently available and the
characteristics of any new equipment necessary; based on the
information in Section 3.  A guideline for equipment to be described
follows:

        a.  Processors, including number of each online/offline, 
        and size of internal storage.

        b.  Storage media, including number of disk units, tape 
        units, etc.

        c.  Output devices, including number of each online/      
        offline.

        d.  Input devices, including number of each online/       
        offline.
]]>

	<para>The hardware required to use this system is defined by
        the selected software tools (in particular the
        <acronym>SGML</acronym> processor).  Development and testing
        was accomplished on 32-bit
        <application>Windows</application>-based computers.</para>
      </section>

      <section role="subsection" id="supportsoftware">
        <title>Support Software Environment</title> 

<![ IGNORE [ This paragraph shall describe the support software with which the
applications software to be developed must interact. Included will be
support software, input and equipment simulators, and test software,
if needed.  The correct nomenclature, level (version), and
documentation references of each such software system, subsystem, and
software unit shall be provided.  In addition, the language, the
operating system, and any Database Management System to be used will
be identified.  ]]>

         <para>Effective use of this system requires three major
         classes of supporting software.  Except as noted with regard
         to the <application>tangle</application> application, it is
         not necessary that the actual supporting software used in the
         development of this system be available.</para>


        <section role="subsubsection">
          <title>Programming Editor</title>

	  <para>Some form of text editor is needed to write the
          literate program.  The minimum necessary functionality is
          the ability to write a plain text output
          file.<footnote><para> Actually, even this is an
          overstatement: the editor has to be able to produce
          <acronym>SGML</acronym> input files compatible with the
          <acronym>SGML</acronym> and <acronym>DSSSL</acronym>
          processors being used. While this is
          <emphasis>usually</emphasis> a plain text file, there are
          other ways to implement <acronym>SGML</acronym>
          systems.</para></footnote></para>

          <para>The authoring process will be much easier, however, if
          the editor supports both <acronym>SGML</acronym> markup and
          the programming language or languages in which the code is
          being written. A customizable editor such as
          <application>emacs</application> is probably a useful
          choice.  Most of the work on the
          <application>DBLP</application> system was done with
          <application>emacs</application> and the
          <application>PSGML</application> major mode.</para>
	</section>

        <section role="subsubsection">
          <title>SGML Processors</title>

          <para>The literate programming <acronym>DTD</acronym>
          extends the <application>DocBook</application>
          <acronym>DTD</acronym>, and therefore requires the underlying
          <acronym>DTD</acronym>.  This implementation specifically
          uses the <acronym>SGML</acronym> <acronym>DTD</acronym>, Version
          4.1 as the basis for its extension.</para>

          <para>To use this system for literate programming without
          additional customization, a <acronym>DSSSL</acronym> engine
          that implements James Clark's \texttt{entity} and
          \texttt{processing-instruction} extensions to the
          <acronym>DSSSL</acronym> standard is needed. The
          <application>Jade</application> or
          <application>OpenJade</application> engines meet this
          requirement.</para>

          <para>The <application>weave</application> style sheet is
          based on Norman Walsh's <citetitle>Modular DocBook Style
          Sheets</citetitle> <citation><xref
          linkend="walsh-dsssl"></citation>, which must be
          available if the <filename>SGMLWeave.dsl</filename> style
          specification is used.</para>

          <para>As an <acronym>SGML</acronym> application, of course,
          documents marked up with this <acronym>DTD</acronym> can, in
          principle, be used by any <acronym>SGML</acronym>-compliant
          tool.</para>

          <para>While this <acronym>DTD</acronym> and the associated
          <acronym>DSSSL</acronym> style sheets were written for the
          <acronym>SGML</acronym> version of the
          <application>DocBook</application> <acronym>DTD</acronym>,
          it should require only minor changes to re-implement this
          system in <acronym>XML</acronym>. This has not, however,
          been tested.</para>
	</section>
      </section>

<!--
<section><title>Security</title>
\label{sec:security}
-->
      <section>
        <title>System Development Plan</title>
<![ IGNORE [
This section shall discuss the overall management approach to the
development and Implementation of the proposed computer system. 
Included shall be a discussion of and schedule for the
documentation to be produced, time frames for the development of
the system or the modules of the system, necessary liaison and
participation by other organizations to ensure successful
development, and any other factors that must be known prior to
initiating development.  Reference may be made to such
information contained in other documents.
]]>

	<para>This system was originally implemented using the
        <application>Nuweb</application> literate programming
        processor, which is a <application>TeX</application>-based
        system.  The choice to implement the system in this way was a
        <quote>bootstrapping</quote>choice; until this system achieved basic
        functionality, it would be difficult to implement the system
        in an <acronym>SGML</acronym>-based system.</para>

	<para>Once basic functionality has been demonstrated, this
        system will be published on the World-Wide Web. Future
        modifications and extensions may or may not be made, depending
        on the author's use of the system and feedback from other
        users (if any).</para>
      </section>

<![ IGNORE [
%<section><title>Cost Factors</title>

%This section shall provide a summary of cost factors for the
%proposed system In accordance with DoD Instruction 7041.3, when
%applicable.  While the proposed system responds directly to the
%project request or other initiation document, other factors may
%determine the need for this system, such as requirements of
%higher echelons of command, security considerations,
%telecommunications considerations, and the need to interface with
%other automated systems.  General alternatives that may be
%discussed include those for system development and system design
%with consideration being given to equipment, software, supporting
%telecommunications requirements, organization, operation, etc. 
%Reference may be made to such information contained in other
%documents. 
]]>
    </section>
  </chapter>
  <chapter id="DTD">
    <title>DTD Implementation</title>

    <section><title>Purpose</title>
      <para>This <acronym>DTD</acronym> extends <application>DocBook
      4.1</application> to allow literate programs to be written using
      the <acronym>DTD</acronym>. </para>
    </section>

    <section>
      <title>Top Level Organization</title>

<programlisting 
 file="dblp.dtd"
 id="scrap00">
&STAGO;!--
DBLP.DTD; a literate programming DTD based on DocBook
PUBLIC 
"-//Mark Wroth//DTD DocBook V4.1-Based Extension Literate Programming 1.1//EN"
--&TAGC;
<xref linkend="scrap03" role="The `literalchar' element">
<xref linkend="scrap02" role="Add \tag{programlisting} attributes">
&STAGO;!ENTITY % programlisting.element "IGNORE"&TAGC;
&STAGO;!ENTITY % docbook PUBLIC "-//OASIS//DTD DocBook V4.1//EN"&TAGC;
%docbook;
<xref linkend="scrap01" role="Redefine the \tag{programlisting} element"> 
</programlisting>

      <para>We put the <sgmltag>literalchar</sgmltag> element
      definitions first, so that entity definitions will override
      those declared by <application>DocBook</application> itself, if
      necessary. </para>

    <section>
      <title>The <sgmltag>programlisting</sgmltag> Customization</title>

      <para>We will set up the <sgmltag>programlisting</sgmltag> element to ignore
      the <application>DocBook</application> defined definition and
      substitute our own. We override the original definition
      primarily to include the <sgmltag>literalchar</sgmltag> element;
      otherwise there are no changes to the basic element definition.</para>

<programlisting 
 id="scrap01"
 xreflabel="Redefine the programlisting element"
>
&STAGO;!ELEMENT programlisting - - 
  ((CO | LineAnnotation | literalchar | %para.char.mix;)+)&TAGC;
</programlisting>

        <para>To the attribute list, we add the attributes that we
        will use for literate programming:
          <variablelist>
	    <varlistentry>
	      <term>file</term>
	      <listitem>
                <para>The file name the code is to be written to. This
                attribute is required for the scraps which begin
                output files.</para>
	      </listitem>
	    </varlistentry>
	    <varlistentry>
	      <term>continuedfrom</term>
	      <listitem>
                <para>The ID of the scrap this scrap continues.</para>
	      </listitem>
	    </varlistentry>
	    <varlistentry>
	      <term>continuedin</term>
	      <listitem>
                <para>The ID of the scrap this file continues.</para>
	      </listitem>
	    </varlistentry>
	  </variablelist>
        </para>

      <para>We also make use of several of the attributes already defined for
      programlisting: <variablelist>
	    <varlistentry>
	      <term>ID</term>
	      <listitem>
		<para>Unique identifier for this scrap; required for
                scraps which are continued, continue others, or are
                the head of a definition section.</para> 
	      </listitem>
	    </varlistentry>
	    <varlistentry>
	      <term>xreflabel</term>
	      <listitem>
                <para>The title of the scrap; used for the head of a
                definition scrap. This fact is used in a number of
                places in the processing, and those additional uses
                depart somewhat from the standard
                <application>DocBook</application> uses. In
                particular, this implies that no continuation scrap
                shall have an <literal>xreflabel</literal>
                attribute.</para>
	      </listitem>
	    </varlistentry>
	  </variablelist>
        </para>
<programlisting 
  id="scrap02" 
  xreflabel="Add programlisting attributes" 
>
&STAGO;!ENTITY % local.programlisting.attrib "
 file          CDATA  #IMPLIED -- file name for output file --
 continuedfrom IDREF  #IMPLIED
 continuedin   IDREF  #IMPLIED "&TAGC; </programlisting>

	<para>The choice to use both a <literal>continuedfrom</literal> and a
        <literal>continuedin</literal> attribute allows the creation of a
        doubly-linked list for each code section.  This permits the
        programmer to order the code scraps in any desired sequence,
        while permitting the processing system to easily traverse the
        scraps that make up the section.</para>

	<para>While one or the other direction of the links between
        scraps is sematically redundant in an absolute sense (with
        adequate effort, the backward links could be constructed from
        the forward set, and vice-versa), including both sets of links
        makes construction of the processing tools much
        simpler. </para>
      </section>

      <section role="subsection">
        <title>The <sgmltag>literalchar</sgmltag> element</title> 
 
	<para>The following definitions are used to provide a
        workaround to get an actual <quote>less than</quote> character
        into the <acronym>SGML</acronym> output. Since the character
        has syntactic meaning to the <acronym>SGML</acronym> parser,
        by default it is escaped when placed in the
        <acronym>SGML</acronym> output as character data. </para>
 
        <para>By defining an element to contain the required
        information, we let the <acronym>DSSSL</acronym> processor
        have access to it.  Defining entity references to it
        simplifies the actual data entry.  If particular combinations
        seem appropriate for a specific programming language it would
        make sense to define entities which make syntactic sense.
        This would allow one to use, for example
        <literal>&amp;logicaland;</literal> instead of
        <literal>&amp;&amp;</literal><footnote><para>The basic
        suggestion to use a formatting-instruction to address the
        problem came from David Carlisle
        <email>davidc@nag.co.uk</email> in a post to the DSSSList,
        Vol 3, Number 241, although the actual implementation does not
        follow his suggestions precisely.</para> </footnote>.</para>
 
<programlisting
  id="scrap03"
  xreflabel="The `literalchar' element"
  continuedin="scrap04"
 > 
&STAGO;!ELEMENT literalchar  - o EMPTY  
       -- literal data, to be handled in the DSSSL --&TAGC; 
&STAGO;!ATTLIST literalchar data CDATA #REQUIRED&TAGC; 
&STAGO;!ENTITY  lessthan  "&STAGO;literalchar data='&ERO;#60;'&TAGC;"    
       -- ``less than'' sign--&TAGC; 
&STAGO;!ENTITY  greaterthan  "&STAGO;literalchar data='&TAGC;'&TAGC;"    
       -- ``greater than'' sign--&TAGC; 
&STAGO;!ENTITY  ampersand "&STAGO;literalchar data='&ERO;#38;'&TAGC;"    
       -- ``ampersand'' sign--&TAGC; 
</programlisting>

	<para>We also define entities that map to the relevant
        <acronym>SGML</acronym> markup, for use when we are defining
        <acronym>SGML</acronym> systems.</para>

<programlisting
  id="scrap04"
  xreflabel="The `literalchar' element"
  continuedfrom="scrap03" 
> 
&STAGO;!ENTITY  STAGO  "&STAGO;literalchar data='&#60;'&TAGC;"    
       -- SGML Tag Open (``less than'' sign) --&TAGC; 
&STAGO;!ENTITY  TAGC  "&STAGO;literalchar data='&TAGC;'&TAGC;"    
       -- SGML Tag Close (``greater than'' sign) --&TAGC; 
&STAGO;!ENTITY  ERO "&STAGO;literalchar data='&#38;'&TAGC;"    
       -- SGML Entity Reference Open (``ampersand'' sign) --&TAGC; 
</programlisting> 
      </section>
    </section>
  </chapter>
  <chapter id="tangle">
    <title>SGML Tangle</title>

    <section>
      <title>Purpose</title>

      <para>The <application>SGMLTangle</application> style sheet
      performs the <application>tangle</application> phase of literate
      programming. In other words, it takes the literate programming
      code and rearranges it so that it is acceptable to the computer
      as a computer program (assuming, of course, that the programmer
      has correctly written the program!)</para>
    </section>

    <section>
      <title>Implementation</title>

      <para>In order to make it as simple as possible to bring this
      system up on a new machine, this style sheet is presented
      largely as a single scrap.  Notes on the program follow the
      implementation scrap.</para>

<programlisting
  id="scrap05"
  file="SGMLTangle.dsl" >
&STAGO;!DOCTYPE style-sheet  
  PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN"&TAGC; 
&STAGO;style-sheet&TAGC; 
&STAGO;style-specification 
 id = "tangle"&TAGC; 
&STAGO;style-specification-body&TAGC;

 (declare-flow-object-class entity 
   "UNREGISTERED::James Clark//Flow Object Class::entity") 
 (declare-flow-object-class formatting-instruction 
   "UNREGISTERED::James Clark//Flow Object Class::formatting-instruction")

 (default (process-node-list (element-children)))

 (element programlisting
  (make sequence 
   (if (attribute-string "file") 
     (make entity 
       system-id: (attribute-string "file") 
       (make sequence 
         (process-children) 
         (if (attribute-string "continuedin")
           (with-mode continuation
             (process-element-with-id 
               (attribute-string "continuedin")))
           (empty-sosofo))))
      (empty-sosofo))))
  
 (element (programlisting xref)
   (with-mode definition
     (process-element-with-id 
       (attribute-string "linkend"))))

 (mode definition
   (element programlisting
     (make sequence
       (process-children)
       (if (attribute-string "continuedin")
           (with-mode continuation
             (process-element-with-id 
               (attribute-string "continuedin")))
           (empty-sosofo)))))
  
 (mode continuation
   (element programlisting
     (make sequence
       (process-children)
       (if (attribute-string "continuedin")
           (with-mode continuation
             (process-element-with-id 
               (attribute-string "continuedin")))
           (empty-sosofo)))))
     
 (element literalchar 
  (make sequence 
   (make formatting-instruction 
     data: (attribute-string "data")))) 

 <xref linkend="scrap06">

&STAGO;/style-specification-body&TAGC;
&STAGO;/style-specification&TAGC; 
&STAGO;/style-sheet&TAGC; 
</programlisting>

      <para>The <literal>(element-children
      <replaceable>snl</replaceable>)</literal> function finds all of
      the elements that are direct children of singleton nodelist
      <replaceable>snl</replaceable>.  This is useful for filtering,
      processing, and counting, when you're not interested in any
      text, PI, or comment nodes.  This function (and the default
      processing rule) were provided by Christopher R. Maden
      <email>crism@maden.org</email> in a message on the DSSSList
      dated Mon, 02 Apr 2001 22:36:33 -0700, and titled <quote>Re:
      (dsssl) "Default" processing rule?</quote>.</para>

<programlisting
 id="scrap06"
 xreflabel="Define element-children function" >
 (define (element-children #!optional (snl (current-node)))
   (select-by-class (children snl)
                    'element))
</programlisting>
    </section>
    <section>
      <title>Implementation Notes</title>
      <para></para>
    </section>
  </chapter>
  <chapter id="weave">
    <title>SGML Weave</title>
    <section>
      <title>Purpose</title>

      <para>The <application>SGMLWeave</application> program
      (<filename>SGMLWeave.dsl</filename>) is a relatively minor
      customization of Norman Walsh's <acronym>DSSSL</acronym>
      stylesheets for <application>DocBook</application>.  In fact, for minimum
      functionality, the <emphasis>only</emphasis> necessary change to
      the stylesheets is the addition of a processing rule for the
      <sgmltag>literalchar</sgmltag> element, and that processing rule
      (shown in <xref linkend="literalchar-rule">) is relatively
      simple.</para>

      <para>This is in fact a design goal of the
      <application>DocBook</application>-based literate programming
      system, as it exploits the significant efforts of a number of
      people to develop tools for
      <application>DocBook</application>.</para>
    </section>
    <section>
      <title>Minimum DocBook Customization Layers</title>

      <para>We now create three related <acronym>DSSSL</acronym> style
      sheets, designed to make it as easy as possible to use the
      <application>weave</application> functions.</para>

      <para>The first of these is a master style sheet, that uses
      <application>Jade</application> ability to include multiple
      style sheets in a single document, selecting among them from the
      command line. This version, in
      <filename>SGMLWeave.dsl</filename>, includes a print style sheet
      and and <acronym>HTML</acronym> style sheet.</para>

<programlisting
 id="scrap07"
 file="SGMLWeave.dsl" >
&STAGO;!--
PUBLIC "-//Mark Wroth//DOCUMENT DBLP Weave Print Rules 1.0//EN"

This document is intended to be a minimum DocBook style-sheet
customization layer.
--&TAGC;
&STAGO;!DOCTYPE style-sheet
  PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
 &STAGO;!ENTITY dbprint.dsl PUBLIC 
   "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN"
   CDATA DSSSL&TAGC;
 &STAGO;!ENTITY dbhtml.dsl PUBLIC
   "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN"
   CDATA DSSSL&TAGC;
]&TAGC; 
&STAGO;style-sheet&TAGC; 
&STAGO;style-specification id="print" use="dbprint"&TAGC; 
&STAGO;style-specification-body&TAGC;

<xref linkend="scrap08">
<xref linkend="scrap09">

&STAGO;/style-specification-body&TAGC;
&STAGO;/style-specification&TAGC;
&STAGO;style-specification id="html" use="dbhtml"&TAGC; 
&STAGO;style-specification-body&TAGC;

<xref linkend="scrap08">
<xref linkend="scrap18">

&STAGO;/style-specification-body&TAGC;
&STAGO;/style-specification&TAGC;
&STAGO;external-specification id="dbprint" document="dbprint.dsl"&TAGC;
&STAGO;external-specification id="dbhtml" document="dbhtml.dsl"&TAGC;
&STAGO;/style-sheet&TAGC;
</programlisting>

      <para>The second style sheet is a redaction of the master sheet.
      It contains only the print style sheet, and is written to
      <filename>print.dsl</filename>.  The primary motivation for
      having this separate file is that it is easier to write higher
      level customization layers for single purpose style
      sheets&mdash;at least at this author's level of
      expertise!</para> 

<programlisting
 id="scrap07a"
 file="print.dsl" >
&STAGO;!--
PUBLIC "-//Mark Wroth//DOCUMENT DBLP Weave Print Rules 1.0//EN"

This document is intended to be a minimum DocBook style-sheet
customization layer.
--&TAGC;
&STAGO;!DOCTYPE style-sheet
  PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
 &STAGO;!ENTITY dbprint.dsl PUBLIC 
   "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN"
   CDATA DSSSL&TAGC;
]&TAGC; 
&STAGO;style-sheet&TAGC; 
&STAGO;style-specification id="print" use="dbprint"&TAGC; 
&STAGO;style-specification-body&TAGC;

<xref linkend="scrap08">
<xref linkend="scrap09">

&STAGO;/style-specification-body&TAGC;
&STAGO;/style-specification&TAGC;
&STAGO;external-specification id="dbprint" document="dbprint.dsl"&TAGC;
&STAGO;/style-sheet&TAGC;
</programlisting>

      <para>The third style sheet is also a redaction of the master
      sheet.  It contains only the <acronym>HTML</acronym> style
      sheet, and is written to <filename>html.dsl</filename>.  The
      primary motivation for having this separate file is, as with
      <filename>print.dsl</filename>, that it is easier to write
      higher level customization layers for single purpose style
      sheets.</para>

<programlisting
 id="scrap07b"
 file="html.dsl" >
&STAGO;!--
PUBLIC "-//Mark Wroth//DOCUMENT DBLP HTML Print Rules 1.0//EN"

This document is intended to be a minimum DocBook style-sheet
customization layer.
--&TAGC;
&STAGO;!DOCTYPE style-sheet
  PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
&STAGO;!ENTITY dbhtml.dsl PUBLIC
   "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN"
   CDATA DSSSL&TAGC;
]&TAGC; 
&STAGO;style-sheet&TAGC; 
&STAGO;style-specification id="html" use="dbhtml"&TAGC; 
&STAGO;style-specification-body&TAGC;

<xref linkend="scrap08">
<xref linkend="scrap18">

&STAGO;/style-specification-body&TAGC;
&STAGO;/style-specification&TAGC;
&STAGO;external-specification id="dbhtml" document="dbhtml.dsl"&TAGC;
&STAGO;/style-sheet&TAGC;
</programlisting>

    </section>
    <section id="literalchar-rule">
      <title>The literalchar Processing Rules</title>

<programlisting 
 id="scrap08"
 xreflabel="literalchar print processing rule" >
(element literalchar
  (make sequence
    (literal (attribute-string "data"))))
</programlisting>

    </section>
    <section id="pl-rules">
      <title>The programlisting Customizations</title>

      <para>The basis of our customization is the existing
      <sgmltag>programlisting</sgmltag> code from <citation><xref
      linkend="walsh-dsssl"><filename>dbverb.dsl</filename></citation>.
      We will modify this by adding information ahead of the basic
      element (by identifying the scrap by either the file name or the
      definition name, depending on the type of scrap), and adding
      information after the program listing (if the scrap is
      continued).</para>

      <section role="subsection">
        <title>Print Customizations</title>

        <para>Almost everything about the print stylesheets will
        remain untouched.  However, there are a few changes that need
        to be made to the processing of the <literal>printlisting</literal>
        element.  The <literal>printlisting</literal> element itself gets some
        additional information added to it based on its place in the
        literate programming web, and the special use of <sgmltag>xref</sgmltag>
        means that we should wrap the cross reference text in some
        punctuation to indicate that it is a code section reference
        rather than actual code.</para>

<programlisting
 id="scrap09" 
 xreflabel="programlisting print customizations"
>
<xref linkend="scrap10">
<xref linkend="scrap13">
<xref linkend="scrap14">
</programlisting>


        <section role="subsubsection">
          <title>The printlisting Proper</title>

          <para>There are essentially two sets of changes we want to
          make to the processing of the <literal>programlisting</literal>
          element: adding header information identifying the code
          section and the particular scrap, and adding continuation
          information if the scrap has a continuation.</para>

          <para>Mechanically, we do this by wrapping the original code
          (taken from <citation><xref
          linkend="walsh-dsssl"><filename>dbverb.dsl</filename></citation>
          inside a <literal>make sequence</literal> and adding the
          code to produce the header and continuation text before and
          after the original code.</para>

<programlisting
 id="scrap10"
 xreflabel="Customize the programlisting proper" >
(element programlisting (make sequence
  <xref linkend="scrap11">
  <xref linkend="scrap16">
  <xref linkend="scrap12">
))
</programlisting>

          <para>If the code section is part of an output literate
          program, the scrap header information is straight forward
          except for the actual title of the code section.  That title
          is either the file name of the disk file the section will be
          written to, or the <literal>xreflabel</literal> of the section.  In
          either case, the title is found in the first scrap of the
          section, which may or may not be the scrap we are currently
          processing.</para>

          <para>We deal with this as a set of nested <literal>if</literal>
          statements to grab the title if we are in the first scrap of
          the section, or processing the <literal>continuedfrom</literal> scrap
          with a special mode that recursively hunts back up the
          linked list until it gets to the first scrap.<footnote><para>It is
          exactly this application that caused us to define the
          programlisting scraps as a doubly-linked list.</para></footnote></para>

          <para>The other refinement is that we will set the header
          and continuation information in a specific font and size
          intended to be distinct from the general font and size used
          in the document.  For ease of reference, these are defined
          in the auxiliary information.</para>

	  <para>The other potential case is that this code section is
	  not part of a literate program.  In that case, no scrap
	  header (or continuation information) is desired.  In most
	  cases, literate programming scraps are easy to identify from
	  the fact that they have attributes not found in non-literate
	  programming scraps (specifically the <quote>file</quote> and
	  <quote>continuedfrom</quote> attributes).  There is,
	  however, one ambiguous case; a scrap which contains an
	  entire definition section has no attributes unique to the
	  literate programming use.  In this case, we will rely on the
	  presence of the <quote>xreflabel</quote> attribute, although
	  there are circumstances where this will produce errors.</para>

<programlisting 
 id        = "scrap11" 
 xreflabel = "Provide scrap header information" 
>
(if (or (attribute-string "file")
        (attribute-string "continuedfrom")
        (attribute-string "xreflabel"))
    <xref linkend="scrap11a">
    (empty-sosofo))
</programlisting>

<programlisting
 id        = "scrap11a"
 xreflabel = "Write the scrap header" 
>
(make paragraph
  (make sequence
    font-family-name: scrap-header-font
    font-size:        scrap-header-size
    (literal "\left-pointing-angle-bracket")
    (if (attribute-string "file")
      (literal (attribute-string "file"))
      (if (attribute-string "xreflabel")
        (literal (attribute-string "xreflabel"))
        (with-mode scrap-title-mode
          (make sequence
            (process-element-with-id 
              (attribute-string "continuedfrom"))
            (literal " ")))))
     (make sequence
       font-size: (* scrap-header-size 0.75)
       (literal " (ID: ")
       (literal (attribute-string "id")))
     (literal ")\right-pointing-angle-bracket")
     (if (attribute-string "continuedfrom")
         (literal "+")
         (empty-sosofo))
     (literal "\identical-to")))
</programlisting>

	  <para>The logic of the continuation listing is simpler; if
	  there is continuation information given, we show the
	  continuation. </para>

<programlisting
 id="scrap12"
 xreflabel="Provide optional continuation info" 
>
(if (attribute-string "continuedin")
    (make paragraph
      font-family-name: scrap-header-font
      font-size:        scrap-header-size
      (make sequence
        (literal "Continued in ")
        (literal (attribute-string "continuedin"))))
    (empty-sosofo))
</programlisting>
	</section>
        <section role="subsubsection">
          <title>The printlisting xref Element</title>

	    <para>The main customization we want for the
            <literal>xref</literal> element is to put the
            cross-reference text in a running text font, and enclose
            it in angle brackets.  In both cases, this is to
            distinguish a code section reference from actual
            code.</para>

            <para>For consistency, we will put the reference in the
            same font and size as the scrap header and continuation
            information.</para>

<programlisting id="scrap13" xreflabel="Customize the (programlisting xref)" >
(element (programlisting xref) 
  (make sequence
  font-family-name: scrap-header-font
  font-size:        scrap-header-size
   (literal "\left-pointing-angle-bracket")
   <xref linkend="scrap17">
   (literal "\right-pointing-angle-bracket")
))
</programlisting>

	</section>
        <section role="subsubsection">
          <title>Print Auxiliary Definitions</title>

          <para>Here we define the common information such as the size
          and font used for the header and continuation.
          Additionally, we define the special mode used to find the
          code section title here.</para>

<programlisting id="scrap14" xreflabel="Print auxiliary definitions" >
(define scrap-header-size 8pt)
(define scrap-header-font "Georgia")
<xref linkend="scrap15">
</programlisting>

          <para>The <literal>scrap-title-mode</literal> is defined to
          process <literal>programlisting</literal> elements and
          either extract the title (found in the
          <literal>file</literal> or <literal>xreflabel</literal>
          attributes, or to continue up the linked list if neither
          attribute is present.</para>

<programlisting
 id="scrap15"
 xreflabel="Define scrap-title-mode" >
(mode scrap-title-mode
  (element programlisting
    (make sequence
      (if (attribute-string "file")
          (literal (attribute-string "file"))
          (if (attribute-string "xreflabel")
              (literal (attribute-string "xreflabel"))
              (process-element-with-id 
                (attribute-string "continuedfrom")))))))
</programlisting>
        </section>
        <section role="subsubsection">
          <title>Original Modular Style Sheet Print Code</title>

          <para>This is the complete <acronym>DSSSL</acronym> code for
          the <literal>programlisting</literal> element, found in
          <filename>dbverb.dsl</filename>.</para>

<programlisting id="scrap16" xreflabel="Original programlisting print code" >
($verbatim-display$
 %indent-programlisting-lines%
 %number-programlisting-lines%)</programlisting>

          <para>This is the complete <acronym>DSSSL</acronym> code
          found in <filename>dblink.dsl</filename> for the
          <sgmltag>xref</sgmltag> element.  It is probably
          <emphasis>much</emphasis> more complex than is actually
          needed for the rather specialized use we are making of it,
          but it is easier to just reproduce it than to try to
          simplify it.</para>

<programlisting id="scrap17" xreflabel="Original xref print code" >
 (let* ((endterm (attribute-string (normalize "endterm")))
         (linkend (attribute-string (normalize "linkend")))
         (target  (element-with-id linkend))
         (xreflabel (if (node-list-empty? target)
                        #f
                        (attribute-string (normalize "xreflabel") target))))
    (if (node-list-empty? target)
        (error (string-append "XRef LinkEnd to missing ID '" linkend "'"))
        (if xreflabel
            (make link 
              destination: (node-list-address target)
              (literal xreflabel))
            (if endterm
                (if (node-list-empty? (element-with-id endterm))
                    (error (string-append "XRef EndTerm to missing ID '" 
                                          endterm "'"))
                    (make link 
                      destination: (node-list-address (element-with-id endterm))
                      (with-mode xref-endterm-mode 
                        (process-element-with-id endterm))))
                (cond
                 ((or (equal? (gi target) (normalize "biblioentry"))
                      (equal? (gi target) (normalize "bibliomixed")))
                  ;; xref to the bibliography is a special case
                  (xref-biblioentry target))
                 ((equal? (gi target) (normalize "co"))
                  ;; callouts are a special case
                  (xref-callout target))
                 ((equal? (gi target) (normalize "listitem"))
                  (xref-listitem target))
                 ((equal? (gi target) (normalize "question"))
                  (xref-question target))
                 ((equal? (gi target) (normalize "answer"))
                  (xref-answer target))
                 ((equal? (gi target) (normalize "refentry"))
                  (xref-refentry target))
                 ((equal? (gi target) (normalize "glossentry"))
                  ;; as are glossentrys
                  (xref-glossentry target))
                 ((equal? (gi target) (normalize "author"))
                  ;; and authors
                  (xref-author target))
                 ((equal? (gi target) (normalize "authorgroup"))
                  ;; and authorgroups
                  (xref-authorgroup target))
                 (else 
                  (xref-general target)))))))</programlisting>
	</section>
      </section>
      <section role="subsection">
        <title>HTML Customizations</title>

        <para>In the <acronym>HTML</acronym> style sheet, we need to
        make the same kinds of customization we did with the print
        style sheet.  The details of the actual customizations differ
        slightly.</para>

<programlisting
 id="scrap18"
 xreflabel="programlisting HTML customizations" >
<xref linkend="scrap19">
<xref linkend="scrap22">
<xref linkend="scrap23">
</programlisting>
      </section>

      <section role="subsubsection">
        <title>The programlisting Proper</title>

        <para>In the <literal>programlisting</literal>, we make the same kinds
        of additions (header and continuation information) as used in
        the print style sheet.</para>

<programlisting
 id="scrap19"
 xreflabel="Programlisting element HTML customization" >
(element programlisting (make sequence
 <xref linkend="scrap20">
 <xref linkend="scrap24">
 <xref linkend="scrap21">
))
</programlisting>

        <para>The code is also largely common, with some minor changes
        for the <acronym>HTML</acronym> output and its limited
        character repertoire.  We have the same logical limitation on
        the identification of definition sections noted above.</para>

<programlisting
 id="scrap20"
 xreflabel="Provide HTML scrap header information" 
>
(if (or (attribute-string "file")
        (attribute-string "continuedfrom")
        (attribute-string "xreflabel"))
    <xref linkend="scrap20a">
    (empty-sosofo))
</programlisting>

<programlisting
 id="scrap20a"
 xreflabel="Write the HTML scrap header" >
(make element gi: "P"
  (make sequence
    (literal "<")
    (if (attribute-string "file")
      (literal (attribute-string "file"))
      (if (attribute-string "xreflabel")
        (literal (attribute-string "xreflabel"))
        (with-mode scrap-title-mode
          (make sequence
            (process-element-with-id 
              (attribute-string "continuedfrom"))
            (literal " ")))))
     (make sequence
       (literal " (ID: ")
       (literal (attribute-string "id")))
     (literal ")>")
     (if (attribute-string "continuedfrom")
         (literal "+")
         (empty-sosofo))
     (literal "=")))</programlisting>

	<para>As with the print form, we apply the simple test that if
	there is continuation information, we show it.</para>

<programlisting 
  id="scrap21" 
  xreflabel="Provide optional HTML scrap continuation info" 
>
(if (attribute-string "continuedin")
    (make element gi: "P"
      (make sequence
        (literal "Continued in ")
        (literal (attribute-string "continuedin"))))
    (empty-sosofo))</programlisting>

        <section role="subsubsection"><title>Customizing the xref Element</title>

<programlisting id="scrap22" xreflabel="xref element HTML customization" >
(element (programlisting xref) (make sequence
(literal "&lessthan;")
<xref linkend="scrap25">
(literal "&greaterthan;")
))
</programlisting>
        </section>
      </section>

       <section role="subsubsection">
         <title>HTML Auxiliary Definitions</title>

         <para>Here we employ the same basic structure as with the
         print style sheet, although there is less to define; this
         primarily is intended to allow room for future elaboration of
         the style sheet.</para>

         <para>The <acronym>DSSSL</acronym> code for the
         scrap-title-mode is identical with that used in the print
         style sheet, so we simply re-use it.</para>

<programlisting 
  id="scrap23" 
  xreflabel="HTML auxiliary definitions" >
<xref linkend="scrap15">
</programlisting>
      </section>
      <section role="subsubsection">
        <title>Original programlisting Code</title>

<programlisting
 id="scrap24"
 xreflabel="Original programlisting HTML code" 
>
($verbatim-display$
%indent-programlisting-lines%
 %number-programlisting-lines%)
</programlisting>
      </section>
      <section role="subsubsection">
        <title>Original xref <acronym>HTML</acronym> Code</title>

<programlisting id="scrap25"
 xreflabel="Original xref HTML code" >
(let* ((endterm   (attribute-string (normalize "endterm")))
         (linkend   (attribute-string (normalize "linkend")))
         (target    (element-with-id linkend))
         (xreflabel (if (node-list-empty? target)
                        #f
                        (attribute-string (normalize "xreflabel") target))))
    (if (node-list-empty? target)
        (error (string-append "XRef LinkEnd to missing ID '" linkend "'"))
        (make element gi: "A"
              attributes: (list
                           (list "HREF" (href-to target)))
              (if xreflabel
                  (literal xreflabel)
                  (if endterm
                      (if (node-list-empty? (element-with-id endterm))
                          (error (string-append
                                  "XRef EndTerm to missing ID '" 
                                  endterm "'"))
                          (with-mode xref-endterm-mode
                            (process-node-list (element-with-id endterm))))
                      (cond
                       ((or (equal? (gi target) (normalize "biblioentry"))
                            (equal? (gi target) (normalize "bibliomixed")))
                        ;; xref to the bibliography is a special case
                        (xref-biblioentry target))
                       ((equal? (gi target) (normalize "co"))
                        ;; callouts are a special case
                        ($callout-mark$ target #f))
                       ((equal? (gi target) (normalize "listitem"))
                        ;; listitems are a special case
                        (if (equal? (gi (parent target)) (normalize "orderedlist"))
                            (literal (orderedlist-listitem-label-recursive target))
                            (error (string-append "XRef to LISTITEM only supported in ORDEREDLISTs"))))
                       ((equal? (gi target) (normalize "question"))
                        ;; questions and answers are (yet another) special case
                        (make sequence
                          (literal (gentext-element-name target))
                          (literal (gentext-label-title-sep target))
                          (literal (question-answer-label target))))
                       ((equal? (gi target) (normalize "answer"))
                        ;; questions and answers are (yet another) special case
                        (make sequence
                          (literal (gentext-element-name target))
                          (literal (gentext-label-title-sep target))
                          (literal (question-answer-label target))))
                       ((equal? (gi target) (normalize "refentry"))
                        ;; so are refentrys
                        (xref-refentry target))
                       ((equal? (gi target) (normalize "glossentry"))
                        ;; as are glossentrys
                        (xref-glossentry target))
                       ((equal? (gi target) (normalize "author"))
                        ;; and authors
                        (xref-author target))
                       ((equal? (gi target) (normalize "authorgroup"))
                        ;; and authorgroups
                        (xref-authorgroup target))
; this doesn't really work very well yet
;                      ((equal? (gi target) (normalize "substeps"))
;                       ;; and substeps
;                       (xref-substeps target))
                       (else 
                        (xref-general target))))))))</programlisting>
      </section>
    </section>
  </chapter>
  <chapter>
    <title>Sample Literate Program</title>

    <section>
      <title>The Sample Document</title>
      <para>This is a very simple document illustrating the used of
      the <application>DBLP</application> literate programming
      system.  It provides an example of how to construct a simple
      input file for the system.</para>
 
<programlisting id="scrap26" file="sample.sgm" >
&STAGO;!DOCTYPE article 
 PUBLIC "-//Mark Wroth//DTD DocBook V4.1-Based Extension Literate Programming 1.0//EN"&TAGC;
&STAGO;article id="sample-lp"&TAGC;
  &STAGO;title&TAGC;A Sample DocBook-Based Literate Program&STAGO;/title&TAGC;
  &STAGO;section&TAGC;
    &STAGO;title&TAGC;Introduction&STAGO;/title&TAGC;
    &STAGO;para&TAGC;This is a sample document illustrating basic use of the
    DocBook-based literate programming tool.&STAGO;/para&TAGC;
    &STAGO;para&TAGC;This document combines human-readable documentation of 
    a computer program with the actual computer-readable source 
    code.  Depending on how it is processed, it becomes either 
    printed (on-line) documentation of the program, or the actual 
    source submitted to the computer for compilation (or
    interpretation, depending on the language).&STAGO;/para&TAGC;
  &STAGO;/section&TAGC;
  &STAGO;section&TAGC;
   &STAGO;title&TAGC;Source Code&STAGO;/title&TAGC;

   &STAGO;para&TAGC;The source code is divided into a number of
   &STAGO;quote&TAGC;scraps&STAGO;/quote&TAGC;, each containing a discrete fragment of
   code.  These scraps are assembled into code sections by
   concatenating the header scrap with the various continuation
   scraps, in an order defined by the programmer. File sections are
   written to the file indicated by the programmer, while definition
   sections are inserted at a place or places defined by the
   programmer. &STAGO;/para&TAGC;
   
   &STAGO;para&TAGC;The first code scrap defines a file output, specifically 
   to &STAGO;filename&TAGC;sample.code&STAGO;/filename&TAGC;.&STAGO;/para&TAGC;

   &STAGO;programlisting
     id="scrap1"
     file="sample.code"
     continuedin="scrap2"
     &TAGC;
-- This is sample code in an imaginary language
-- Taken from the first scrap
if a &lessthan; b then
  &STAGO;xref linkend="scrap3"&TAGC;
fi
   &STAGO;/programlisting&TAGC;

   &STAGO;para&TAGC;The next code scrap is a continuation of the first
   scrap.&STAGO;/para&TAGC;   

   &STAGO;programlisting
    id="scrap2"
    continuedfrom="scrap1"
   &TAGC;
-- This is continued code, taken from the second scrap
--
set c = a &ampersand; b 
 greater than: &greaterthan;
   &STAGO;/programlisting&TAGC;
 
   &STAGO;para&TAGC;The following code section is an example of a definition
   scrap, and will be included in a file output scrap.&STAGO;/para&TAGC;
   &STAGO;programlisting
    id="scrap3"
    xreflabel="The Third Scrap"
    continuedin="scrap4"&TAGC;
-- Yet more program code from the third scrap
   &STAGO;/programlisting&TAGC;
   
   &STAGO;para&TAGC;Finally, we have a continuation scrap continuing
   a definition scrap.&STAGO;/para&TAGC;

   &STAGO;programlisting
     id="scrap4"
     continuedfrom="scrap3"
   &TAGC;
-- This is scrap 4, which continues scrap 3
-- It should appear where scrap 3 was inserted.
   &STAGO;/programlisting&TAGC;
 &STAGO;/section&TAGC;
&STAGO;/article&TAGC;
</programlisting>

      <para>As with the <acronym>DTD</acronym>, the fact that this
      output section is written in <acronym>SGML</acronym> means that
      the literate programming file as actually written makes
      extensive use of entities for those characters that have
      syntactic meaning. This situation is one of the few where the
      human documentation and the computer source are noticably
      different.</para>

    </section>
  </chapter>

  <chapter id="testing">
    <title>System Performance</title>

    <para>Generally speaking, verifying the functionality of the
    literate programming system consists of checking that the
    <application>tangle</application> branch correctly produces the
    intended code, and the <application>weave</application> branch
    produces appropriate human-readable documentation.</para>

    <section>
      <title>Sample Code Output</title>

      <para>The code output file <filename>sample.code</filename>
      produced from the sample document looks like this: </para>

      <literallayout>&sample.code;</literallayout>

      <para>This demonstrates the key functions needed in the
      <application>tangle</application> branch, namely that:
        <itemizedlist>
          <listitem>
            <para>Code sections are correctly assembled from the separate scraps
            identified in the source code.</para>
	  </listitem>
          <listitem><para> Definition sections are inserted into code
          sections at the location identified by the
          <sgmltag>xref</sgmltag> tag pointing to the head of the
          definition section.</para>
	  </listitem>
          <listitem>
            <para>File output sections are written to disk in with
            the desired file names. </para>
	  </listitem>
          <listitem>
            <para> Syntactically significant characters (to
            <acronym>SGML</acronym>) including
            <literal>&lt;</literal>,
            <literal>&gt;</literal>, and
            <literal>&amp;</literal>, are written correctly in the
            output file.</para>
	  </listitem>
	</itemizedlist></para>

        <para>The handling of whitespace in the code scraps is not
        quite what I expected, but appears to be consistent and
        reasonable.  It appears that whitespace is (correctly)
        transcribed to the output file, except that an
        <acronym>SGML</acronym> record end (<keycap>CR-LF</keycap>
        pair, under <application>Windows</application>) following the
        <sgmltag>programlisting</sgmltag> start tag is
        <emphasis>not</emphasis> transcribed to the output.</para>

    </section>
    <section>
      <title>Sample Woven Output</title>

      <para>The <application>weave</application>
      <acronym>DSSSL</acronym> style sheets produce two sets of
      human-readable documentation from
      <filename>sample.sgm</filename>: <filename>sample.rtf</filename>
      and a set of <acronym>HTML</acronym> files.  The
      <acronym>HTML</acronym> files are divided and named by the
      conventions of the <acronym>HTML</acronym> <citetitle>Modular
      DocBook Style Sheets</citetitle>, which (without customization)
      produce multiple small files.</para>

      <para>In both cases, the <application>weave</application>
      outputs reasonably produce verbatim program listings, with
      header and continuation information that matches the actual
      structure defined by the sample file.</para>

      <para>The typographic treatment of the header and continuation
      is acceptable, although the amount of vertical space introduced
      in both the print and <acronym>HTML</acronym> versions between
      the header and the body of the programlisting is larger than I
      would prefer.</para>
    </section>
    <section id="testeval">
      <title>Evaluation</title>

      <para>Overall, these implementations of a
      <acronym>DTD</acronym>, <application>tangle</application>, and
      <application>weave</application> are functional.  They do not
      produce really high-quality typographical output, but they do
      reasonably display the structure of the code sections.  Pending
      further experience with the system, this seems to be an
      acceptable implementation.</para>
    </section>
  </chapter>
  <appendix>
    <title>Acronyms</title>
    <glosslist>
      <glossentry>
	<glossterm>DSSSL</glossterm>
	<glossdef>
	  <para>Document Style Semantics Specification
          Language. <acronym>DSSSL</acronym> is an ISO standard
          defining how to specify transformations from
          <acronym>SGML</acronym> documents to page-oriented output
          renderings.</para>
	</glossdef>
      </glossentry>
      <glossentry>
        <glossterm>DTD</glossterm>
        <glossdef>
          <para>Document Type Definition, Document Type
          Declaration</para> </glossdef>
      </glossentry>
      <glossentry><glossterm>HTML</glossterm><glossdef><para>Hypertext
          Markup Language</para></glossdef>
      </glossentry>
      <glossentry>
        <glossterm>ISO</glossterm>
        <glossdef>
          <para>International Organization for
          Standardization</para></glossdef>
      </glossentry>
      <glossentry>
        <glossterm>OASIS</glossterm>
        <glossdef><para>Organization for the
          Advancement of Structured Information
          Standards</para></glossdef>
       </glossentry>
       <glossentry>
         <glossterm>OSNL</glossterm>
         <glossdef>
           <para>Optional Singleton Node List</para></glossdef>
       </glossentry>
       <glossentry>
          <glossterm>SGML</glossterm>
          <glossdef>
            <para>Standard Generalized Markup Language</para>
          </glossdef>
       </glossentry>
       <glossentry>
         <glossterm>SNL</glossterm>
         <glossdef>
           <para>Singleton Node List</para>
         </glossdef>
       </glossentry>
       <glossentry>
         <glossterm>XML</glossterm>
         <glossdef>
           <para>Extensible Markup Language</para>
         </glossdef>
       </glossentry>
    </glosslist>
  </appendix>
  <appendix>
    <title>Bibliography</title>
    <bibliography>
      <biblioentry id="Carlisle3-241">
        <author>
	  <surname>Carlisle</surname>
	  <firstname>David</firstname>
	  <authorblurb>
	    <para><email>davidc@nag.co.uk</email></para>
	  </authorblurb>
	</author>
	<title>Re: Issues with literate programming DSSSL Script</title>
	<title>DSSSList Digest</title>
	<volumenum>Volume 3</volumenum>
	<issuenum>Number 241</issuenum>
	<date>Thu, 16 Dec 1999 16:27:27 GMT</date>
      </biblioentry>
      <biblioentry id="Knuth92">
	<author>
	  <firstname>Donald</firstname>
	  <surname>Knuth</surname>
	</author>
	<title>Literate Programming</title>
	<publisher>
	  <publishername>Center for the Study of Language and Information</publishername>
	  <address>Stanford, CA</address>
	</publisher>
	<pubdate>1992</pubdate>
      </biblioentry>
      <biblioentry id="Maden01-04-02">
	<author>
	  <firstname>Christopher</firstname>
	    <othername>R.</othername>
	  <surname>Maden</surname>
	    <authorblurb>
	      <para><email>crism@maden.org</email></para>
	    </authorblurb>
	</author>
	<title>Re: (dsssl) "Default" processing rule?</title>
        <title>DSSSList Digest</title>
	  <volumenum>Volume 4</volumenum>
	  <issuenum>Number~143</issuenum>
	  <date>Mon, 02 Apr 2001 22:36:33 (-0700)</date>
      </biblioentry>
      <biblioentry id="docbook4.1">
	<corpauthor>OASIS</corpauthor>
	<title>DocBook</title>
        <address><email>http://www.oasis-open.org/docbook</email></address>
      </biblioentry>
      <biblioentry id="walsh-dsssl">
	<author>
	  <firstname>Norman</firstname>
	  <surname>Walsh</surname>
	</author>
	<title>The Modular DocBook Stylesheets</title>
	<address><email>http://sourceforge.net/projects/docbook</email></address>
      </biblioentry>
    </bibliography>
    <para></para>
  </appendix>
  <appendix>
    <title>Installation and Usage Tips</title>
    <tip>
      <title>Catalog Files</title>
      <para>The use of catalog files makes installation of the various
      processing applications and <acronym>DTD</acronym>s much easier,
      by allowing the specifications of where the various files are
      located in the system file structure to be separated from the
      documents that need to use them.</para>
      <para>Using indirection in catalog files&mdash;having a catalog
      file point to a separate catalog file, rather than independently
      listing each of the system entities needed&mdash;makes the
      maintenance of the system much easier.  A master catalog file,
      kept in a convenient location, points to catalog files for each
      of the various packages installed.  These package catalog files
      can be kept in the installation directories.  The local catalog
      file for a document can then reference all of the standard
      supporting files with a single entry.</para>
      <para>The user environment variable
      <envar>SGML_CATALOG_FILES</envar> may also be used to cause
      <application>Jade</application> to point to the needed catalog
      file or files.</para>
    </tip>
  </appendix>
</book>
