Overhauled the docs.  Removed all the HTML files, put in XML files as
converted by Donna.  Hooked it into the build system so they are only
built when specifically asked for, and when doing "make dist".

They're not perfect;  in particular, there are the following problems:
- The plain-text FAQ should be built from FAQ.xml, but this is not
  currently done.  (The text FAQ has been left in for now.)

- The PS/PDF building doesn't work -- it fails with an incomprehensible
  error message which I haven't yet deciphered.

Nonetheless, I'm putting it in so others can see it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3153 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/docs/lib/Makefile.am b/docs/lib/Makefile.am
new file mode 100644
index 0000000..627e39d
--- /dev/null
+++ b/docs/lib/Makefile.am
@@ -0,0 +1,6 @@
+EXTRA_DIST = \
+	vg-common.xsl \
+	vg-fo.xsl \
+	vg-html-chunk.xsl \
+	vg-html-single.xsl \
+	vg_basic.css
diff --git a/docs/lib/vg-common.xsl b/docs/lib/vg-common.xsl
new file mode 100644
index 0000000..0302b52
--- /dev/null
+++ b/docs/lib/vg-common.xsl
@@ -0,0 +1,45 @@
+<?xml version="1.0"?> <!-- -*- sgml -*- -->
+<xsl:stylesheet 
+     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<!-- we like '1.2 Title' -->
+<xsl:param name="section.autolabel" select="'1'"/> 
+<xsl:param name="section.label.includes.component.label" select="'1'"/>
+
+<!-- Do not put 'Chapter' at the start of eg 'Chapter 1. Doing This' -->
+<xsl:param name="local.l10n.xml" select="document('')"/> 
+<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"> 
+  <l:l10n language="en"> 
+    <l:context name="title-numbered">
+      <l:template name="chapter" text="%n.&#160;%t"/>
+    </l:context> 
+  </l:l10n>
+</l:i18n>
+
+<!-- don't generate sub-tocs for qanda sets -->
+<xsl:param name="generate.toc">
+set       toc,title
+book      toc,title,figure,table,example,equation
+chapter   toc,title
+section   toc
+sect1     toc
+sect2     toc
+sect3     toc
+sect4     nop
+sect5     nop
+qandaset  toc
+qandadiv  nop
+appendix  toc,title
+article/appendix  nop
+<!-- article   toc,title -->
+article   nop
+preface   toc,title
+reference toc,title
+</xsl:param>
+
+<!-- center everything at the top of a titlepage -->
+<xsl:attribute-set name="set.titlepage.recto.style">
+  <xsl:attribute name="align">center</xsl:attribute>
+</xsl:attribute-set>
+
+</xsl:stylesheet>
diff --git a/docs/lib/vg-fo.xsl b/docs/lib/vg-fo.xsl
new file mode 100644
index 0000000..647d91b
--- /dev/null
+++ b/docs/lib/vg-fo.xsl
@@ -0,0 +1,320 @@
+<?xml version="1.0" encoding="UTF-8"?> <!-- -*- sgml -*- -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+     xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
+
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
+<xsl:import href="vg-common.xsl"/>
+
+<!-- set indent = yes while debugging, then change to NO -->
+<xsl:output method="xml" indent="no"/>
+
+<!-- ensure only passivetex extensions are on -->
+<xsl:param name="stylesheet.result.type" select="'fo'"/>
+<!-- fo extensions: PDF bookmarks and index terms -->
+<xsl:param name="use.extensions" select="'1'"/>
+<xsl:param name="xep.extensions" select="0"/>      
+<xsl:param name="fop.extensions" select="0"/>     
+<xsl:param name="saxon.extensions" select="0"/>   
+<xsl:param name="passivetex.extensions" select="1"/>
+<xsl:param name="tablecolumns.extension" select="'1'"/>
+
+<!-- ensure we are using single sided -->
+<xsl:param name="double.sided" select="'0'"/> 
+
+<!-- insert cross references to page numbers -->
+<xsl:param name="insert.xref.page.number" select="1"/>
+
+<!-- <?custom-pagebreak?> inserts a page break at this point -->
+<xsl:template match="processing-instruction('custom-pagebreak')">
+  <fo:block break-before='page'/>
+</xsl:template>
+
+<!-- show links in color -->
+<xsl:attribute-set name="xref.properties">
+  <xsl:attribute name="color">blue</xsl:attribute>
+</xsl:attribute-set>
+
+<!-- make pre listings indented a bit + a bg colour -->
+<xsl:template match="programlisting | screen">
+  <fo:block start-indent="0.25in" wrap-option="no-wrap" 
+            white-space-collapse="false" text-align="start" 
+            font-family="monospace" background-color="#f2f2f9"
+            linefeed-treatment="preserve" 
+            xsl:use-attribute-sets="normal.para.spacing">
+    <xsl:apply-templates/>
+  </fo:block>
+</xsl:template>
+
+<!-- workaround bug in passivetex fo output for itemizedlist -->
+<xsl:template match="itemizedlist/listitem">
+  <xsl:variable name="id">
+  <xsl:call-template name="object.id"/></xsl:variable>
+  <xsl:variable name="itemsymbol">
+    <xsl:call-template name="list.itemsymbol">
+      <xsl:with-param name="node" select="parent::itemizedlist"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:variable name="item.contents">
+    <fo:list-item-label end-indent="label-end()">
+      <fo:block>
+        <xsl:choose>
+          <xsl:when test="$itemsymbol='disc'">&#x2022;</xsl:when>
+          <xsl:when test="$itemsymbol='bullet'">&#x2022;</xsl:when>
+          <xsl:otherwise>&#x2022;</xsl:otherwise>
+        </xsl:choose>
+      </fo:block>
+    </fo:list-item-label>
+    <fo:list-item-body start-indent="body-start()">
+      <xsl:apply-templates/>    <!-- removed extra block wrapper -->
+    </fo:list-item-body>
+  </xsl:variable>
+  <xsl:choose>
+    <xsl:when test="parent::*/@spacing = 'compact'">
+      <fo:list-item id="{$id}" 
+          xsl:use-attribute-sets="compact.list.item.spacing">
+        <xsl:copy-of select="$item.contents"/>
+      </fo:list-item>
+    </xsl:when>
+    <xsl:otherwise>
+      <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
+        <xsl:copy-of select="$item.contents"/>
+      </fo:list-item>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- workaround bug in passivetex fo output for orderedlist -->
+<xsl:template match="orderedlist/listitem">
+  <xsl:variable name="id">
+  <xsl:call-template name="object.id"/></xsl:variable>
+  <xsl:variable name="item.contents">
+    <fo:list-item-label end-indent="label-end()">
+      <fo:block>
+        <xsl:apply-templates select="." mode="item-number"/>
+      </fo:block>
+    </fo:list-item-label>
+    <fo:list-item-body start-indent="body-start()">
+      <xsl:apply-templates/>    <!-- removed extra block wrapper -->
+    </fo:list-item-body>
+  </xsl:variable>
+  <xsl:choose>
+    <xsl:when test="parent::*/@spacing = 'compact'">
+      <fo:list-item id="{$id}" 
+          xsl:use-attribute-sets="compact.list.item.spacing">
+        <xsl:copy-of select="$item.contents"/>
+      </fo:list-item>
+    </xsl:when>
+    <xsl:otherwise>
+      <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
+        <xsl:copy-of select="$item.contents"/>
+      </fo:list-item>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- workaround bug in passivetex fo output for variablelist -->
+<xsl:param name="variablelist.as.blocks" select="1"/>
+<xsl:template match="varlistentry" mode="vl.as.blocks">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/></xsl:variable>
+  <fo:block id="{$id}" xsl:use-attribute-sets="list.item.spacing"  
+      keep-together.within-column="always" 
+      keep-with-next.within-column="always">
+    <xsl:apply-templates select="term"/>
+  </fo:block>
+  <fo:block start-indent="0.5in" end-indent="0in" 
+            space-after.minimum="0.2em" 
+            space-after.optimum="0.4em" 
+            space-after.maximum="0.6em">
+    <fo:block>
+      <xsl:apply-templates select="listitem"/>
+    </fo:block>
+  </fo:block>
+</xsl:template>
+
+<!-- workaround bug in passivetext fo output for revhistory -->
+<xsl:template match="revhistory" mode="titlepage.mode">
+  <fo:block space-before="1.0em">
+  <fo:table table-layout="fixed" width="100%">
+    <fo:table-column column-number="1" column-width="33%"/>
+    <fo:table-column column-number="2" column-width="33%"/>
+    <fo:table-column column-number="3" column-width="34%"/>
+    <fo:table-body>
+      <fo:table-row>
+        <fo:table-cell number-columns-spanned="3" text-align="left">
+          <fo:block>
+            <xsl:call-template name="gentext">
+              <xsl:with-param name="key" select="'RevHistory'"/>
+            </xsl:call-template>
+          </fo:block>
+        </fo:table-cell>
+      </fo:table-row>
+      <xsl:apply-templates mode="titlepage.mode"/>
+    </fo:table-body>
+  </fo:table>
+  </fo:block>
+</xsl:template>
+
+<xsl:template match="revhistory/revision" mode="titlepage.mode">
+  <xsl:variable name="revnumber" select=".//revnumber"/>
+  <xsl:variable name="revdate"   select=".//date"/>
+  <xsl:variable name="revauthor" select=".//authorinitials"/>
+  <xsl:variable name="revremark" select=".//revremark"/>
+  <fo:table-row>
+    <fo:table-cell text-align="left">
+      <fo:block>
+        <xsl:if test="$revnumber">
+          <xsl:call-template name="gentext">
+            <xsl:with-param name="key" select="'Revision'"/>
+          </xsl:call-template>
+          <xsl:call-template name="gentext.space"/>
+          <xsl:apply-templates select="$revnumber[1]" mode="titlepage.mode"/>
+        </xsl:if>
+      </fo:block>
+    </fo:table-cell>
+    <fo:table-cell text-align="left">
+      <fo:block>
+        <xsl:apply-templates select="$revdate[1]" mode="titlepage.mode"/>
+      </fo:block>
+    </fo:table-cell>
+    <fo:table-cell text-align="left">
+      <fo:block>
+        <xsl:apply-templates select="$revauthor[1]" mode="titlepage.mode"/>
+      </fo:block>
+    </fo:table-cell>
+  </fo:table-row>
+  <xsl:if test="$revremark">
+    <fo:table-row>
+      <fo:table-cell number-columns-spanned="3" text-align="left">
+        <fo:block>
+          <xsl:apply-templates select="$revremark[1]" mode="titlepage.mode"/>
+        </fo:block>
+      </fo:table-cell>
+    </fo:table-row>
+  </xsl:if>
+</xsl:template>
+
+
+<!-- workaround bug in footers: force right-align w/two 80|30 cols -->
+<xsl:template name="footer.table">
+  <xsl:param name="pageclass" select="''"/>
+  <xsl:param name="sequence" select="''"/>
+  <xsl:param name="gentext-key" select="''"/>
+  <xsl:choose>
+    <xsl:when test="$pageclass = 'index'">
+      <xsl:attribute name="margin-left">0pt</xsl:attribute>
+    </xsl:when>
+  </xsl:choose>
+  <xsl:variable name="candidate">
+    <fo:table table-layout="fixed" width="100%">
+      <fo:table-column column-number="1" column-width="80%"/>
+      <fo:table-column column-number="2" column-width="20%"/>
+      <fo:table-body>
+        <fo:table-row height="14pt">
+          <fo:table-cell text-align="left" display-align="after">
+            <xsl:attribute name="relative-align">baseline</xsl:attribute>
+            <fo:block> 
+              <fo:block> </fo:block><!-- empty cell -->
+            </fo:block>
+          </fo:table-cell>
+          <fo:table-cell text-align="center" display-align="after">
+            <xsl:attribute name="relative-align">baseline</xsl:attribute>
+            <fo:block>
+              <xsl:call-template name="footer.content">
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="position" select="'center'"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+            </fo:block>
+          </fo:table-cell>
+        </fo:table-row>
+      </fo:table-body>
+    </fo:table>
+  </xsl:variable>
+  <!-- Really output a footer? -->
+  <xsl:choose>
+    <xsl:when test="$pageclass='titlepage' and $gentext-key='book'
+                    and $sequence='first'">
+      <!-- no, book titlepages have no footers at all -->
+    </xsl:when>
+    <xsl:when test="$sequence = 'blank' and $footers.on.blank.pages = 0">
+      <!-- no output -->
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy-of select="$candidate"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+<!-- fix bug in headers: force right-align w/two 40|60 cols -->
+<xsl:template name="header.table">
+  <xsl:param name="pageclass" select="''"/>
+  <xsl:param name="sequence" select="''"/>
+  <xsl:param name="gentext-key" select="''"/>
+  <xsl:choose>
+    <xsl:when test="$pageclass = 'index'">
+      <xsl:attribute name="margin-left">0pt</xsl:attribute>
+    </xsl:when>
+  </xsl:choose>
+  <xsl:variable name="candidate">
+    <fo:table table-layout="fixed" width="100%">
+      <xsl:call-template name="head.sep.rule">
+        <xsl:with-param name="pageclass" select="$pageclass"/>
+        <xsl:with-param name="sequence" select="$sequence"/>
+        <xsl:with-param name="gentext-key" select="$gentext-key"/>
+      </xsl:call-template>
+      <fo:table-column column-number="1" column-width="40%"/>
+      <fo:table-column column-number="2" column-width="60%"/>
+      <fo:table-body>
+        <fo:table-row height="14pt">
+          <fo:table-cell text-align="left" display-align="before">
+            <xsl:attribute name="relative-align">baseline</xsl:attribute>
+            <fo:block>
+              <fo:block> </fo:block><!-- empty cell -->
+            </fo:block>
+          </fo:table-cell>
+          <fo:table-cell text-align="center" display-align="before">
+            <xsl:attribute name="relative-align">baseline</xsl:attribute>
+            <fo:block>
+              <xsl:call-template name="header.content">
+                <xsl:with-param name="pageclass" select="$pageclass"/>
+                <xsl:with-param name="sequence" select="$sequence"/>
+                <xsl:with-param name="position" select="'center'"/>
+                <xsl:with-param name="gentext-key" select="$gentext-key"/>
+              </xsl:call-template>
+            </fo:block>
+          </fo:table-cell>
+        </fo:table-row>
+      </fo:table-body>
+    </fo:table>
+  </xsl:variable>
+  <!-- Really output a header? -->
+  <xsl:choose>
+    <xsl:when test="$pageclass = 'titlepage' and $gentext-key = 'book'
+                    and $sequence='first'">
+      <!-- no, book titlepages have no headers at all -->
+    </xsl:when>
+    <xsl:when test="$sequence = 'blank' and $headers.on.blank.pages = 0">
+      <!-- no output -->
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy-of select="$candidate"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+</xsl:stylesheet>
+
+<!--
+pagebreaks in fo output:
+- http://www.dpawson.co.uk/docbook/styling/fo.html#d1408e636
+http://www.dpawson.co.uk/docbook/styling/fo.html
+http://docbook.sourceforge.net/release/xsl/current/doc/fo/variablelist.as.blocks.html
+alt. book to oreilly:
+- http://www.ravelgrane.com/ER/doc/lx/book.html
+tex memory:
+- http://www.dpawson.co.uk/docbook/tools.html#d4e191
+-->
diff --git a/docs/lib/vg-html-chunk.xsl b/docs/lib/vg-html-chunk.xsl
new file mode 100644
index 0000000..66537c0
--- /dev/null
+++ b/docs/lib/vg-html-chunk.xsl
@@ -0,0 +1,321 @@
+<?xml version="1.0"?> <!-- -*- sgml -*- -->
+<xsl:stylesheet 
+     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-common.xsl"/>
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/manifest.xsl"/>
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-code.xsl"/>
+<xsl:import href="vg-common.xsl"/>
+
+<!-- use 8859-1 encoding -->
+<xsl:output method="html" encoding="ISO-8859-1" indent="yes"/>
+
+<xsl:param name="use.id.as.filename" select="'1'"/> 
+<xsl:param name="chunker.output.indent" select="'yes'"/>
+<!-- use our custom html stylesheet -->
+<xsl:param name="html.stylesheet" select="'vg_basic.css'"/>
+
+<!-- use our custom header -->
+<xsl:template name="header.navigation">
+  <xsl:param name="prev" select="/foo"/>
+  <xsl:param name="next" select="/foo"/>
+  <xsl:param name="nav.context"/>
+
+  <xsl:variable name="home" select="/*[1]"/>
+  <xsl:variable name="up" select="parent::*"/>
+
+  <xsl:variable name="row1" select="$navig.showtitles != 0"/>
+  <xsl:variable name="row2" select="count($prev) &gt; 0
+                            or (count($up) &gt; 0 
+                            and generate-id($up) != generate-id($home) )
+                            or count($next) &gt; 0"/>
+
+<div>
+<!-- never show header nav stuff on title page -->
+<xsl:if test="count($prev)>0">
+ <xsl:if test="$row1 or $row2">
+  <table class="nav" width="100%" cellspacing="3" cellpadding="3" border="0" summary="Navigation header">
+   <xsl:if test="$row2">
+    <tr>
+     <!-- prev -->
+     <td width="22px" align="center" valign="middle">
+      <xsl:if test="count($prev)>0">
+       <a accesskey="p">
+        <xsl:attribute name="href">
+         <xsl:call-template name="href.target">
+          <xsl:with-param name="object" select="$prev"/>
+         </xsl:call-template>
+        </xsl:attribute>
+        <img src="images/prev.png" width="18" height="21" border="0">
+         <xsl:attribute name="alt">
+          <xsl:call-template name="gentext">
+           <xsl:with-param name="key">nav-prev</xsl:with-param>
+          </xsl:call-template>
+         </xsl:attribute>
+        </img>
+       </a>
+      </xsl:if>
+     </td>
+     <!-- up -->
+     <xsl:if test="count($up)>0">
+      <td width="25px" align="center" valign="middle">
+       <a accesskey="u">
+        <xsl:attribute name="href">
+         <xsl:call-template name="href.target">
+          <xsl:with-param name="object" select="$up"/>
+         </xsl:call-template>
+        </xsl:attribute>
+        <img src="images/up.png" width="21" height="18" border="0">
+         <xsl:attribute name="alt">
+          <xsl:call-template name="gentext">
+           <xsl:with-param name="key">nav-up</xsl:with-param>
+          </xsl:call-template>
+         </xsl:attribute>
+        </img>
+       </a>
+      </td>
+     </xsl:if>
+     <!-- home -->
+     <xsl:if test="$home != . or $nav.context = 'toc'">
+      <td width="31px" align="center" valign="middle">
+       <a accesskey="h">
+        <xsl:attribute name="href">
+         <xsl:call-template name="href.target">
+          <xsl:with-param name="object" select="$home"/>
+         </xsl:call-template>
+        </xsl:attribute>
+        <img src="images/home.png" width="27" height="20" border="0">
+         <xsl:attribute name="alt">
+          <xsl:call-template name="gentext">
+           <xsl:with-param name="key">nav-up</xsl:with-param>
+          </xsl:call-template>
+         </xsl:attribute>
+        </img>
+       </a>
+      </td>
+     </xsl:if>
+     <!-- chapter|section heading -->
+     <th align="center" valign="middle">
+       <xsl:apply-templates select="$up" mode="object.title.markup"/>
+<!--
+      <xsl:choose>
+       <xsl:when test="count($up) > 0 and generate-id($up) != generate-id($home)">
+        <xsl:apply-templates select="$up" mode="object.title.markup"/>
+       </xsl:when>
+       <xsl:otherwise>
+        <xsl:text>Valgrind User's Manual</xsl:text>
+       </xsl:otherwise>
+      </xsl:choose>
+-->
+     </th>
+     <!-- next -->
+      <td width="22px" align="center" valign="middle">
+        <xsl:if test="count($next)>0">
+         <a accesskey="n">
+          <xsl:attribute name="href">
+           <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$next"/>
+           </xsl:call-template>
+          </xsl:attribute>
+          <img src="images/next.png" width="18" height="21" border="0">
+           <xsl:attribute name="alt">
+            <xsl:call-template name="gentext">
+             <xsl:with-param name="key">nav-next</xsl:with-param>
+            </xsl:call-template>
+           </xsl:attribute>
+          </img>
+         </a>
+        </xsl:if>
+       </td>
+      </tr>
+    </xsl:if>
+   </table>
+ </xsl:if>
+</xsl:if>
+</div>
+</xsl:template>
+
+
+<!-- our custom footer -->
+<xsl:template name="footer.navigation">
+  <xsl:param name="prev" select="/foo"/>
+  <xsl:param name="next" select="/foo"/>
+  <xsl:param name="nav.context"/>
+
+  <xsl:variable name="home" select="/*[1]"/>
+  <xsl:variable name="up" select="parent::*"/>
+
+  <xsl:variable name="row1" select="count($prev) &gt; 0
+                                    or count($up) &gt; 0
+                                    or count($next) &gt; 0"/>
+
+  <xsl:variable name="row2" select="($prev != 0)
+                                    or (generate-id($home) != generate-id(.)
+                                        or $nav.context = 'toc')
+                                    or ($chunk.tocs.and.lots != 0
+                                        and $nav.context != 'toc')
+                                    or ($next != 0)"/>
+  <div>
+  <xsl:if test="$row1 or $row2">
+   <br />
+   <table class="nav" width="100%" cellspacing="3" cellpadding="2" border="0" summary="Navigation footer">
+    <xsl:if test="$row1">
+     <tr>
+      <td rowspan="2" width="40%" align="left">
+       <xsl:if test="count($prev)>0">
+        <a accesskey="p">
+         <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+           <xsl:with-param name="object" select="$prev"/>
+          </xsl:call-template>
+         </xsl:attribute>
+         <xsl:text>&#060;&#060;&#160;</xsl:text>
+         <xsl:apply-templates select="$prev" mode="object.title.markup"/>
+        </a>
+       </xsl:if>
+       <xsl:text>&#160;</xsl:text>
+      </td>
+      <td width="20%" align="center">
+       <xsl:choose>
+        <xsl:when test="count($up)>0">
+         <a accesskey="u">
+          <xsl:attribute name="href">
+           <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$up"/>
+           </xsl:call-template>
+          </xsl:attribute>
+          <xsl:call-template name="navig.content">
+           <xsl:with-param name="direction" select="'up'"/>
+          </xsl:call-template>
+         </a>
+        </xsl:when>
+        <xsl:otherwise>&#160;</xsl:otherwise>
+       </xsl:choose>
+      </td>
+      <td rowspan="2" width="40%" align="right">
+       <xsl:text>&#160;</xsl:text>
+       <xsl:if test="count($next)>0">
+        <a accesskey="n">
+         <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+           <xsl:with-param name="object" select="$next"/>
+          </xsl:call-template>
+         </xsl:attribute>
+         <xsl:apply-templates select="$next" mode="object.title.markup"/>
+         <xsl:text>&#160;&#062;&#062;</xsl:text>
+        </a>
+       </xsl:if>
+      </td>
+     </tr>
+    </xsl:if>
+
+    <xsl:if test="$row2">
+     <tr>
+      <td width="20%" align="center">
+       <xsl:choose>
+       <xsl:when test="$home != . or $nav.context = 'toc'">
+        <a accesskey="h">
+         <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+           <xsl:with-param name="object" select="$home"/>
+          </xsl:call-template>
+         </xsl:attribute>
+         <xsl:call-template name="navig.content">
+          <xsl:with-param name="direction" select="'home'"/>
+         </xsl:call-template>
+        </a>
+        <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
+         <xsl:text>&#160;|&#160;</xsl:text>
+        </xsl:if>
+       </xsl:when>
+       <xsl:otherwise>&#160;</xsl:otherwise>
+       </xsl:choose>
+       <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
+        <a accesskey="t">
+         <xsl:attribute name="href">
+          <xsl:apply-templates select="/*[1]" mode="recursive-chunk-filename"/>
+          <xsl:text>-toc</xsl:text>
+          <xsl:value-of select="$html.ext"/>
+         </xsl:attribute>
+         <xsl:call-template name="gentext">
+          <xsl:with-param name="key" select="'nav-toc'"/>
+         </xsl:call-template>
+        </a>
+       </xsl:if>
+      </td>
+     </tr>
+    </xsl:if>
+   </table>
+  </xsl:if>
+ </div>
+</xsl:template>
+
+<!-- We don't like tables with borders -->
+<xsl:template match="revhistory" mode="titlepage.mode">
+  <xsl:variable name="numcols">
+    <xsl:choose>
+      <xsl:when test="//authorinitials">3</xsl:when>
+      <xsl:otherwise>2</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <table width="100%" border="0" summary="Revision history">
+    <tr>
+      <th align="left" colspan="{$numcols}">
+        <h3>Revision History</h3>
+      </th>
+    </tr>
+    <xsl:apply-templates mode="titlepage.mode">
+      <xsl:with-param name="numcols" select="$numcols"/>
+    </xsl:apply-templates>
+  </table>
+</xsl:template>
+
+<!-- don't put an expanded set-level TOC, only book titles -->
+<xsl:template match="book" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+  <xsl:choose>
+    <xsl:when test="local-name($toc-context) = 'set'">
+      <xsl:call-template name="subtoc">
+        <xsl:with-param name="toc-context" select="$toc-context"/>
+        <xsl:with-param name="nodes" select="foo"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="subtoc">
+        <xsl:with-param name="toc-context" select="$toc-context"/>
+        <xsl:with-param name="nodes" select="part|reference
+                                         |preface|chapter|appendix
+                                         |article
+                                         |bibliography|glossary|index
+                                         |refentry
+                                         |bridgehead[$bridgehead.in.toc !=
+0]"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- question and answer set mods -->
+<xsl:template match="answer">
+  <xsl:variable name="deflabel">
+    <xsl:choose>
+      <xsl:when test="ancestor-or-self::*[@defaultlabel]">
+        <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
+                              /@defaultlabel"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$qanda.defaultlabel"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <tr class="{name(.)}">
+    <td><xsl:text>&#160;</xsl:text></td>
+    <td align="left" valign="top">
+      <xsl:apply-templates select="*[name(.) != 'label']"/>
+    </td>
+  </tr>
+  <tr><td colspan="2"><xsl:text>&#160;</xsl:text></td></tr>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/docs/lib/vg-html-single.xsl b/docs/lib/vg-html-single.xsl
new file mode 100644
index 0000000..c6c1cec
--- /dev/null
+++ b/docs/lib/vg-html-single.xsl
@@ -0,0 +1,63 @@
+<?xml version="1.0"?> <!-- -*- sgml -*- -->
+<!DOCTYPE xsl:stylesheet [ <!ENTITY vg-css SYSTEM "vg_basic.css"> ]>
+
+<xsl:stylesheet 
+   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
+<xsl:import href="vg-common.xsl"/>
+
+<!-- use 8859-1 encoding -->
+<xsl:output method="html" encoding="ISO-8859-1" indent="yes"/>
+
+<!-- we include the css directly when generating one large file -->
+<xsl:template name="user.head.content">  
+  <style type="text/css" media="screen">
+    <xsl:text>&vg-css;</xsl:text>
+  </style>
+</xsl:template>
+
+<!-- We don't like tables with borders -->
+<xsl:template match="revhistory" mode="titlepage.mode">
+  <xsl:variable name="numcols">
+    <xsl:choose>
+      <xsl:when test="//authorinitials">3</xsl:when>
+      <xsl:otherwise>2</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <table width="100%" border="0" summary="Revision history">
+    <tr>
+      <th align="left" colspan="{$numcols}">
+        <h4>Revision History</h4>
+      </th>
+    </tr>
+    <xsl:apply-templates mode="titlepage.mode">
+      <xsl:with-param name="numcols" select="$numcols"/>
+    </xsl:apply-templates>
+  </table>
+</xsl:template>
+
+<!-- question and answer set mods -->
+<xsl:template match="answer">
+  <xsl:variable name="deflabel">
+    <xsl:choose>
+      <xsl:when test="ancestor-or-self::*[@defaultlabel]">
+        <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
+                              /@defaultlabel"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$qanda.defaultlabel"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <tr class="{name(.)}">
+    <td><xsl:text>&#160;</xsl:text></td>
+    <td align="left" valign="top">
+      <xsl:apply-templates select="*[name(.) != 'label']"/>
+    </td>
+  </tr>
+  <tr><td colspan="2"><xsl:text>&#160;</xsl:text></td></tr>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/docs/lib/vg_basic.css b/docs/lib/vg_basic.css
new file mode 100644
index 0000000..16e6cc2
--- /dev/null
+++ b/docs/lib/vg_basic.css
@@ -0,0 +1,62 @@
+/* default link colours */
+a, a:link, a:visited, a:active { color: #74240f; }
+a:hover { color: #888800; }
+
+body { 
+ color: #202020; 
+ background-color: #ffffff;
+}
+
+body, td {
+ font-size:   90%;
+ line-height: 125%;
+ font-family: Arial, Geneva, Helvetica, sans-serif;
+}
+
+h1, h2, h3, h4 { color: #74240f; }
+h3 { margin-bottom: 0.4em; }
+
+code, tt, pre { color: #3366cc; }
+code, tt { color: #761596; }
+
+pre.programlisting {
+ color:      #000000;
+ padding:    0.5em;
+ background: #f2f2f9;
+ border:     1px solid #3366cc;
+}
+pre.screen {
+ color:      #000000;
+ padding:    0.5em;
+ background: #eeeeee;
+ border:     1px solid #626262;
+}
+
+ul { list-style: url("images/li-brown.png"); }
+
+.titlepage hr {
+  height:  1px;
+  border:  0px;
+  background-color: #7f7f7f;
+}
+
+/* header / footer nav tables */
+table.nav {
+ color:      #0f7355;
+ border:     solid 1px #0f7355;
+ background: #edf7f4;
+ background-color: #edf7f4;
+ margin-bottom: 0.5em;
+}
+/* don't have underlined links in chunked nav menus */
+table.nav a { text-decoration: none; }
+table.nav a:hover { text-decoration: underline; }
+table.nav td { font-size: 85%; }
+
+/* yellow box just for massif blockquotes */
+blockquote {
+ padding:     0.5em;
+ background:  #fffbc9; 
+ border:      solid 1px #ffde84; 
+}
+