[Phoenix-commits] rev 12838 - in public/phoenix: . utils utils/xhtml

andi at wyona.com andi at wyona.com
Wed Apr 26 18:09:27 CEST 2006


Author: andi
Date: 2006-04-26 18:09:22 +0200 (Wed, 26 Apr 2006)
New Revision: 12838

Added:
   public/phoenix/utils/
   public/phoenix/utils/xhtml/
   public/phoenix/utils/xhtml/ChangeLog
   public/phoenix/utils/xhtml/admon.xsl
   public/phoenix/utils/xhtml/annotations.xsl
   public/phoenix/utils/xhtml/autoidx-ng.xsl
   public/phoenix/utils/xhtml/autoidx.xsl
   public/phoenix/utils/xhtml/autotoc.xsl
   public/phoenix/utils/xhtml/biblio.xsl
   public/phoenix/utils/xhtml/block.xsl
   public/phoenix/utils/xhtml/callout.xsl
   public/phoenix/utils/xhtml/changebars.xsl
   public/phoenix/utils/xhtml/chunk-code.xsl
   public/phoenix/utils/xhtml/chunk-common.xsl
   public/phoenix/utils/xhtml/chunk.xsl
   public/phoenix/utils/xhtml/chunker.xsl
   public/phoenix/utils/xhtml/chunkfast.xsl
   public/phoenix/utils/xhtml/chunktoc.xsl
   public/phoenix/utils/xhtml/component.xsl
   public/phoenix/utils/xhtml/division.xsl
   public/phoenix/utils/xhtml/docbook.xsl
   public/phoenix/utils/xhtml/docbookng.xsl
   public/phoenix/utils/xhtml/ebnf.xsl
   public/phoenix/utils/xhtml/footnote.xsl
   public/phoenix/utils/xhtml/formal.xsl
   public/phoenix/utils/xhtml/glossary.xsl
   public/phoenix/utils/xhtml/graphics.xsl
   public/phoenix/utils/xhtml/html-rtf.xsl
   public/phoenix/utils/xhtml/html.xsl
   public/phoenix/utils/xhtml/html2xhtml.xsl
   public/phoenix/utils/xhtml/htmltbl.xsl
   public/phoenix/utils/xhtml/index.xsl
   public/phoenix/utils/xhtml/info.xsl
   public/phoenix/utils/xhtml/inline.xsl
   public/phoenix/utils/xhtml/keywords.xsl
   public/phoenix/utils/xhtml/lists.xsl
   public/phoenix/utils/xhtml/maketoc.xsl
   public/phoenix/utils/xhtml/manifest.xsl
   public/phoenix/utils/xhtml/math.xsl
   public/phoenix/utils/xhtml/oldchunker.xsl
   public/phoenix/utils/xhtml/onechunk.xsl
   public/phoenix/utils/xhtml/param.xsl
   public/phoenix/utils/xhtml/pi.xsl
   public/phoenix/utils/xhtml/profile-chunk-code.xsl
   public/phoenix/utils/xhtml/profile-chunk.xsl
   public/phoenix/utils/xhtml/profile-docbook.xsl
   public/phoenix/utils/xhtml/profile-onechunk.xsl
   public/phoenix/utils/xhtml/qandaset.xsl
   public/phoenix/utils/xhtml/refentry.xsl
   public/phoenix/utils/xhtml/sections.xsl
   public/phoenix/utils/xhtml/synop.xsl
   public/phoenix/utils/xhtml/table.xsl
   public/phoenix/utils/xhtml/task.xsl
   public/phoenix/utils/xhtml/titlepage.templates.xsl
   public/phoenix/utils/xhtml/titlepage.xsl
   public/phoenix/utils/xhtml/toc.xsl
   public/phoenix/utils/xhtml/verbatim.xsl
   public/phoenix/utils/xhtml/xref.xsl
Log:
Added docbook XSL files.


Added: public/phoenix/utils/xhtml/ChangeLog
===================================================================
--- public/phoenix/utils/xhtml/ChangeLog	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/ChangeLog	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,120 @@
+2005-07-18  Michael Smith <xmldoc at users.sourceforge.net>
+
+	* .cvsignore: Ignore annotations.xsl
+
+2005-05-13  Michael Smith <xmldoc at users.sourceforge.net>
+
+	* Makefile: clean target added
+
+	* Makefile: revert to MAIN
+
+2004-12-02  Michael Smith <xmldoc at users.sourceforge.net>
+
+	* Makefile: New file.
+
+2004-09-07  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* .cvsignore: I prefer to explicitly list all the files that should be ignored. Really the ones that shouldn't should probably be moved to another directory...
+
+2004-09-06  Michael Smith <xmldoc at users.sourceforge.net>
+
+	* .cvsignore: Ignore generated .xsl files.
+	
+	Without this, cvs update reports all generated .xsl files in this
+	directory as unknown. It's a big list, and it'd be a lot easier to
+	read the cvs update output if these files weren't listed every time.
+	
+	Note: This does not cause CVS to ignore the html2xhtml.xsl file or
+	to treat it in any way way differently than it would if the *.xsl
+	line in this .cvsignore file did not exist. It doesn't seem to at
+	least. If that's wrong, this change can always be reverted.
+
+2003-07-10  Robert Stayton <bobstayton at users.sourceforge.net>
+
+	* html2xhtml.xsl: Set default values for chunker.output parameters so the
+	chunk.xsl stylesheet outputs proper doctype declaration
+	for XHTML output.
+
+2003-07-03  Robert Stayton <bobstayton at users.sourceforge.net>
+
+	* html2xhtml.xsl: Added a xsl:stylesheet template to add the xhtml namespace
+	as the default namespace for the stylesheet modules.
+
+2002-11-14  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* html2xhtml.xsl: Make UTF-8 the default for XHTML
+
+2002-10-09  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* html2xhtml.xsl: Make XHTML chunks
+
+2002-06-11  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* Makefile: branches:  1.7.2;
+	Make sure copied files get translated
+
+2002-06-03  Jirka Kosek <kosek at users.sourceforge.net>
+
+	* Makefile: Added dependencies for profiling stylesheets
+
+2002-05-17  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* Makefile: Make the add-new rule actually, uhm, add new files.
+
+2002-03-25  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* Makefile: Improved rules
+
+2002-03-01  Jirka Kosek <kosek at users.sourceforge.net>
+
+	* Makefile: First portion of new profiling code. New stylesheet parameters will come later.
+
+2002-03-01  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* html2xhtml.xsl: Move stylesheet.result.type out of param and put it explicitly in each stylesheet because it has to be different
+
+2002-02-21  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* Makefile: Make sure xhtml directory gets built properly
+
+2002-02-20  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* .cvsignore, xslfiles.gen: Autogenerated
+
+2002-02-07  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* html2xhtml.xsl: Make sure that uses of the xsl:element element preserve the XHTML namespace
+
+2002-01-09  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* html2xhtml.xsl: Don't change the html.ext parameter
+
+2001-12-30  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* .cvsignore, Makefile, chunk.xsl, docbook.xsl, html2xhtml.xsl, xslfiles.gen: 
+	Completely reworked strategy for XHTML
+
+2001-12-04  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* docbook.xsl: Feature ##469979 add xmlns for xhtml
+
+2001-10-16  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* xtchunk.xsl: Removed XT support
+
+2001-08-01  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* docbook.xsl: Bug #441079, use import instead of include so that xsl:output isn't occurring multiple times at the same level
+
+2001-06-20  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* docbook.xsl: Put public and system identifiers on XHTML documents to that entity references (&nbsp; etc.) work
+
+2001-04-03  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* chunk.xsl, docbook.xsl, xtchunk.xsl: Support MathML and chunking properly
+
+2001-04-02  Norman Walsh <nwalsh at users.sourceforge.net>
+
+	* docbook.xsl, xtchunk.xsl: New file.
+

Added: public/phoenix/utils/xhtml/admon.xsl
===================================================================
--- public/phoenix/utils/xhtml/admon.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/admon.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<!-- ********************************************************************
+     $Id: admon.xsl,v 1.11 2004/12/08 20:43:51 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<xsl:template match="*" mode="admon.graphic.width">
+  <xsl:param name="node" select="."/>
+  <xsl:text>25</xsl:text>
+</xsl:template>
+
+<xsl:template match="note|important|warning|caution|tip">
+  <xsl:choose>
+    <xsl:when test="$admon.graphics != 0">
+      <xsl:call-template name="graphical.admonition"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="nongraphical.admonition"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="admon.graphic">
+  <xsl:param name="node" select="."/>
+  <xsl:value-of select="$admon.graphics.path"/>
+  <xsl:choose>
+    <xsl:when test="local-name($node)='note'">note</xsl:when>
+    <xsl:when test="local-name($node)='warning'">warning</xsl:when>
+    <xsl:when test="local-name($node)='caution'">caution</xsl:when>
+    <xsl:when test="local-name($node)='tip'">tip</xsl:when>
+    <xsl:when test="local-name($node)='important'">important</xsl:when>
+    <xsl:otherwise>note</xsl:otherwise>
+  </xsl:choose>
+  <xsl:value-of select="$admon.graphics.extension"/>
+</xsl:template>
+
+<xsl:template name="graphical.admonition">
+  <xsl:variable name="admon.type">
+    <xsl:choose>
+      <xsl:when test="local-name(.)='note'">Note</xsl:when>
+      <xsl:when test="local-name(.)='warning'">Warning</xsl:when>
+      <xsl:when test="local-name(.)='caution'">Caution</xsl:when>
+      <xsl:when test="local-name(.)='tip'">Tip</xsl:when>
+      <xsl:when test="local-name(.)='important'">Important</xsl:when>
+      <xsl:otherwise>Note</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="alt">
+    <xsl:call-template name="gentext">
+      <xsl:with-param name="key" select="$admon.type"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <div class="{name(.)}">
+    <xsl:if test="$admon.style != ''">
+      <xsl:attribute name="style">
+        <xsl:value-of select="$admon.style"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <table border="0">
+      <xsl:attribute name="summary">
+        <xsl:value-of select="$admon.type"/>
+        <xsl:if test="title">
+          <xsl:text>: </xsl:text>
+          <xsl:value-of select="title"/>
+        </xsl:if>
+      </xsl:attribute>
+      <tr>
+        <td rowspan="2" align="center" valign="top">
+          <xsl:attribute name="width">
+            <xsl:apply-templates select="." mode="admon.graphic.width"/>
+          </xsl:attribute>
+          <img alt="[{$alt}]">
+            <xsl:attribute name="src">
+              <xsl:call-template name="admon.graphic"/>
+            </xsl:attribute>
+          </img>
+        </td>
+        <th align="left">
+          <xsl:call-template name="anchor"/>
+          <xsl:if test="$admon.textlabel != 0 or title">
+            <xsl:apply-templates select="." mode="object.title.markup"/>
+          </xsl:if>
+        </th>
+      </tr>
+      <tr>
+        <td align="left" valign="top">
+          <xsl:apply-templates/>
+        </td>
+      </tr>
+    </table>
+  </div>
+</xsl:template>
+
+<xsl:template name="nongraphical.admonition">
+  <div class="{name(.)}">
+    <xsl:if test="$admon.style">
+      <xsl:attribute name="style">
+        <xsl:value-of select="$admon.style"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <h3 class="title">
+      <xsl:call-template name="anchor"/>
+      <xsl:if test="$admon.textlabel != 0 or title">
+        <xsl:apply-templates select="." mode="object.title.markup"/>
+      </xsl:if>
+    </h3>
+
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
+<xsl:template match="note/title"/>
+<xsl:template match="important/title"/>
+<xsl:template match="warning/title"/>
+<xsl:template match="caution/title"/>
+<xsl:template match="tip/title"/>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/annotations.xsl
===================================================================
--- public/phoenix/utils/xhtml/annotations.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/annotations.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<xsl:template name="add.annotation.links">
+  <xsl:param name="scripts" select="normalize-space($annotation.js)"/>
+  <xsl:choose>
+    <xsl:when test="contains($scripts, ' ')">
+      <script type="text/javascript" src="{substring-before($scripts, ' ')}"/>
+      <xsl:call-template name="add.annotation.links">
+	<xsl:with-param name="scripts" select="substring-after($scripts, ' ')"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <script type="text/javascript" src="{$scripts}"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="annotation"/>
+
+<xsl:template name="apply-annotations">
+  <xsl:if test="$annotation.support != 0">
+  <!-- do any annotations apply to the context node? -->
+  <xsl:variable name="id" select="(@id|@xml:id)[1]"/>
+
+  <xsl:variable name="aids">
+    <xsl:for-each select="//annotation">
+      <xsl:if test="@annotates=$id              or starts-with(@annotates, concat($id, ' '))       or contains(@annotates, concat(' ', $id, ' '))       or substring(@annotates, string-length(@annotates)-3)          = concat(' ', $id)">
+	<xsl:value-of select="generate-id()"/>
+	<xsl:text> </xsl:text>
+      </xsl:if>
+    </xsl:for-each>
+    <xsl:if test="normalize-space(@annotations) != ''">
+      <xsl:call-template name="annotations-pointed-to">
+	<xsl:with-param name="annotations" select="normalize-space(@annotations)"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:if test="$aids != ''">
+    <xsl:call-template name="apply-annotations-by-gid">
+      <xsl:with-param name="gids" select="normalize-space($aids)"/>
+    </xsl:call-template>
+  </xsl:if>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="annotations-pointed-to">
+  <xsl:param name="annotations"/>
+  <xsl:choose>
+    <xsl:when test="contains($annotations, ' ')">
+      <xsl:variable name="a" select="key('id', substring-before($annotations, ' '))"/>
+      <xsl:if test="$a">
+	<xsl:value-of select="generate-id($a)"/>
+	<xsl:text> </xsl:text>
+      </xsl:if>
+      <xsl:call-template name="annotations-pointed-to">
+	<xsl:with-param name="annotations" select="substring-after($annotations, ' ')"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="a" select="key('id', $annotations)"/>
+      <xsl:if test="$a">
+	<xsl:value-of select="generate-id($a)"/>
+	<xsl:text> </xsl:text>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="apply-annotations-by-gid">
+  <xsl:param name="gids"/>
+
+  <xsl:choose>
+    <xsl:when test="contains($gids, ' ')">
+      <xsl:variable name="gid" select="substring-before($gids, ' ')"/>
+      <xsl:apply-templates select="key('gid', $gid)" mode="annotation-inline"/>
+      <xsl:call-template name="apply-annotations-by-gid">
+	<xsl:with-param name="gids" select="substring-after($gids, ' ')"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates select="key('gid', $gids)" mode="annotation-inline"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="annotation" mode="annotation-inline">
+  <xsl:variable name="title">
+    <xsl:choose>
+      <xsl:when test="title">
+	<xsl:value-of select="title"/>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:text>[Annotation #</xsl:text>
+	<xsl:number count="annotation" level="any" format="1"/>
+	<xsl:text>]</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <a id="anch-{generate-id(.)}" href="#annot-{generate-id(.)}" title="{$title}">
+    <xsl:attribute name="onClick">
+      <xsl:text>popup_</xsl:text>
+      <xsl:value-of select="generate-id(.)"/>
+      <xsl:text>.showPopup('anch-</xsl:text>
+      <xsl:value-of select="generate-id(.)"/>
+      <xsl:text>'); return false;</xsl:text>
+    </xsl:attribute>
+    <img src="{$annotation.graphic.open}" border="0" alt="{$title}"/>
+  </a>
+</xsl:template>
+
+<xsl:template match="annotation" mode="annotation-popup">
+  <div class="annotation-nocss">
+    <p>
+      <a id="annot-{generate-id(.)}"/>
+      <xsl:text>Annotation #</xsl:text>
+      <xsl:number count="annotation" level="any" format="1"/>
+      <xsl:text>:</xsl:text>
+    </p>
+  </div>
+
+  <div id="popup-{generate-id(.)}" class="annotation-popup">
+    <xsl:if test="string-length(.) &gt; 300">
+      <xsl:attribute name="style">width:400px</xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="annotation-title"/>
+    <div class="annotation-body">
+      <xsl:apply-templates select="*[local-name(.) != 'title']"/>
+    </div>
+    <div class="annotation-close">
+      <a href="#" onclick="popup_{generate-id(.)}.hidePopup();return false;">
+	<img src="{$annotation.graphic.close}" alt="X" border="0"/>
+      </a>
+    </div>
+  </div>
+</xsl:template>
+
+<xsl:template name="annotation-title">
+  <div class="annotation-title">
+    <xsl:choose>
+      <xsl:when test="title">
+	<xsl:apply-templates select="title/node()"/>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:text>Annotation</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </div>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/autoidx-ng.xsl
===================================================================
--- public/phoenix/utils/xhtml/autoidx-ng.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/autoidx-ng.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:func="http://exslt.org/functions" xmlns:i="urn:cz-kosek:functions:index" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="i">
+
+<!-- ********************************************************************
+     $Id: autoidx-ng.xsl,v 1.4 2004/08/26 07:50:09 kosek Exp $
+     ********************************************************************
+
+     This file is part of the DocBook XSL Stylesheet distribution.
+     See ../README or http://docbook.sf.net/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<xsl:include href="../common/autoidx-ng.xsl"/>
+
+<!-- Modified original code is using index group codes instead of just first letter 
+     to gain better grouping -->
+<xsl:template name="generate-index">
+  <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
+
+  <xsl:variable name="role">
+    <xsl:if test="$index.on.role != 0">
+      <xsl:value-of select="@role"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="type">
+    <xsl:if test="$index.on.type != 0">
+      <xsl:value-of select="@type"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="terms" select="//indexterm[count(.|key('group-code',                                                 i:group-index(normalize-space(concat(primary/@sortas, primary[not(@sortas)]))))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1]) = 1                                     and not(@class = 'endofrange')]"/>
+
+  <div class="index">
+    <xsl:apply-templates select="$terms" mode="index-div">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="i:group-index(normalize-space(concat(primary/@sortas, primary[not(@sortas)])))" data-type="number"/>
+    </xsl:apply-templates>
+  </div>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-div">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="i:group-index(normalize-space(concat(primary/@sortas, primary[not(@sortas)])))"/>
+
+  <xsl:variable name="lang">
+    <xsl:call-template name="l10n.language"/>
+  </xsl:variable>
+
+  <xsl:if test="key('group-code', $key)[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))]                 [count(.|key('primary', normalize-space(concat(primary/@sortas, primary[not(@sortas)])))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1]) = 1]">
+    <div class="indexdiv">
+      <h3>
+        <xsl:value-of select="i:group-letter($key)"/>
+      </h3>
+      <dl>
+        <xsl:apply-templates select="key('group-code', $key)[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))]                                      [count(.|key('primary', normalize-space(concat(primary/@sortas, primary[not(@sortas)])))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1])=1]" mode="index-primary">
+          <xsl:sort select="normalize-space(concat(primary/@sortas, primary[not(@sortas)]))" lang="{$lang}"/>
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+        </xsl:apply-templates>
+      </dl>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/autoidx.xsl
===================================================================
--- public/phoenix/utils/xhtml/autoidx.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/autoidx.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,402 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<!-- ********************************************************************
+     $Id: autoidx.xsl,v 1.26 2005/01/13 08:52:14 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+<!-- Jeni Tennison gets all the credit for what follows.
+     I think I understand it :-) Anyway, I've hacked it a bit, so the
+     bugs are mine. -->
+
+<xsl:key name="letter" match="indexterm" use="translate(substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+
+<xsl:key name="primary" match="indexterm" use="normalize-space(concat(primary/@sortas, primary[not(@sortas)]))"/>
+
+<xsl:key name="secondary" match="indexterm" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])))"/>
+
+<xsl:key name="tertiary" match="indexterm" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), &#34; &#34;, normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])))"/>
+
+<xsl:key name="endofrange" match="indexterm[@class='endofrange']" use="@startref"/>
+
+<xsl:key name="primary-section" match="indexterm[not(secondary) and not(see)]" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, generate-id((ancestor-or-self::set                      |ancestor-or-self::book                      |ancestor-or-self::part                      |ancestor-or-self::reference                      |ancestor-or-self::partintro                      |ancestor-or-self::chapter                      |ancestor-or-self::appendix                      |ancestor-or-self::preface                      |ancestor-or-self::article                      |ancestor-or-self::section                      |ancestor-or-self::sect1                      |ancestor-or-self::sect2                      |ancestor-or-self::sect3                      |ancestor-or-self::sect4                      |ancestor-or-self::sect5                      |ancestor-or-self::refentry                      |ancestor-or-self::refsect1                      |ancestor-or-self::refsect2                      |ancestor-or-self::refsect3                      |ancestor-or-self::simplesect                      |ancestor-or-self::bibliography                      |ancestor-or-self::glossary                      |ancestor-or-self::index                      |ancestor-or-self::webpage)[last()]))"/>
+
+<xsl:key name="secondary-section" match="indexterm[not(tertiary) and not(see)]" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), &#34; &#34;, generate-id((ancestor-or-self::set                      |ancestor-or-self::book                      |ancestor-or-self::part                      |ancestor-or-self::reference                      |ancestor-or-self::partintro                      |ancestor-or-self::chapter                      |ancestor-or-self::appendix                      |ancestor-or-self::preface                      |ancestor-or-self::article                      |ancestor-or-self::section                      |ancestor-or-self::sect1                      |ancestor-or-self::sect2                      |ancestor-or-self::sect3                      |ancestor-or-self::sect4                      |ancestor-or-self::sect5                      |ancestor-or-self::refentry                      |ancestor-or-self::refsect1                      |ancestor-or-self::refsect2                      |ancestor-or-self::refsect3                      |ancestor-or-self::simplesect                      |ancestor-or-self::bibliography                      |ancestor-or-self::glossary                      |ancestor-or-self::index                      |ancestor-or-self::webpage)[last()]))"/>
+
+<xsl:key name="tertiary-section" match="indexterm[not(see)]" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), &#34; &#34;, normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])), &#34; &#34;, generate-id((ancestor-or-self::set                      |ancestor-or-self::book                      |ancestor-or-self::part                      |ancestor-or-self::reference                      |ancestor-or-self::partintro                      |ancestor-or-self::chapter                      |ancestor-or-self::appendix                      |ancestor-or-self::preface                      |ancestor-or-self::article                      |ancestor-or-self::section                      |ancestor-or-self::sect1                      |ancestor-or-self::sect2                      |ancestor-or-self::sect3                      |ancestor-or-self::sect4                      |ancestor-or-self::sect5                      |ancestor-or-self::refentry                      |ancestor-or-self::refsect1                      |ancestor-or-self::refsect2                      |ancestor-or-self::refsect3                      |ancestor-or-self::simplesect                      |ancestor-or-self::bibliography                      |ancestor-or-self::glossary                      |ancestor-or-self::index                      |ancestor-or-self::webpage)[last()]))"/>
+
+<xsl:key name="see-also" match="indexterm[seealso]" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), &#34; &#34;, normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])), &#34; &#34;, seealso)"/>
+
+<xsl:key name="see" match="indexterm[see]" use="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), &#34; &#34;, normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])), &#34; &#34;, see)"/>
+
+<xsl:key name="sections" match="*[@id]" use="@id"/>
+
+<xsl:template name="generate-index">
+  <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
+
+  <xsl:variable name="role">
+    <xsl:if test="$index.on.role != 0">
+      <xsl:value-of select="@role"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="type">
+    <xsl:if test="$index.on.type != 0">
+      <xsl:value-of select="@type"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="terms" select="//indexterm[count(.|key('letter',                                                 translate(substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1),                                                           'abcdefghijklmnopqrstuvwxyz',                                                           'ABCDEFGHIJKLMNOPQRSTUVWXYZ'))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1]) = 1                                     and not(@class = 'endofrange')]"/>
+
+  <xsl:variable name="alphabetical" select="$terms[contains(concat('abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'),                                         substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1))]"/>
+
+  <xsl:variable name="others" select="$terms[not(contains(concat('abcdefghijklmnopqrstuvwxyz',                                                  'ABCDEFGHIJKLMNOPQRSTUVWXYZ'),                                              substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1)))]"/>
+  <div class="index">
+    <xsl:if test="$others">
+      <div class="indexdiv">
+        <h3>
+          <xsl:call-template name="gentext">
+            <xsl:with-param name="key" select="'index symbols'"/>
+          </xsl:call-template>
+        </h3>
+        <dl>
+          <xsl:apply-templates select="$others[count(.|key('primary',                                        normalize-space(concat(primary/@sortas, primary[not(@sortas)])))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1]) = 1]" mode="index-symbol-div">
+            <xsl:with-param name="scope" select="$scope"/>
+            <xsl:with-param name="role" select="$role"/>
+            <xsl:with-param name="type" select="$type"/>
+            <xsl:sort select="translate(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+          </xsl:apply-templates>
+        </dl>
+      </div>
+    </xsl:if>
+
+    <xsl:apply-templates select="$alphabetical[count(.|key('letter',                                  translate(substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1),                                            'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1]) = 1]" mode="index-div">
+      <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
+      <xsl:with-param name="type" select="$type"/>
+      <xsl:sort select="translate(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+    </xsl:apply-templates>
+  </div>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-div">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="translate(substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+
+  <!-- Make sure that we don't generate a div if there are no terms in scope -->
+  <xsl:if test="key('letter', $key)[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))]                 [count(.|key('primary', normalize-space(concat(primary/@sortas, primary[not(@sortas)])))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1]) = 1]">
+    <div class="indexdiv">
+      <xsl:if test="contains(concat('abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), $key)">
+        <h3>
+          <xsl:value-of select="translate($key, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+        </h3>
+      </xsl:if>
+      <dl>
+        <xsl:apply-templates select="key('letter', $key)[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))]                                      [count(.|key('primary', normalize-space(concat(primary/@sortas, primary[not(@sortas)])))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1])=1]" mode="index-primary">
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+        </xsl:apply-templates>
+      </dl>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-symbol-div">
+  <xsl:param name="scope" select="/"/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="translate(substring(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 1, 1),                                              'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+
+  <xsl:apply-templates select="key('letter', $key)                                [count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][count(.|key('primary', normalize-space(concat(primary/@sortas, primary[not(@sortas)])))[1]) = 1]" mode="index-primary">
+    <xsl:with-param name="scope" select="$scope"/>
+    <xsl:with-param name="role" select="$role"/>
+    <xsl:with-param name="type" select="$type"/>
+    <xsl:sort select="translate(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-primary">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="normalize-space(concat(primary/@sortas, primary[not(@sortas)]))"/>
+  <xsl:variable name="refs" select="key('primary', $key)[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))]"/>
+  <dt>
+    <xsl:value-of select="primary"/>
+    <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section', concat($key, &#34; &#34;, generate-id((ancestor-or-self::set                      |ancestor-or-self::book                      |ancestor-or-self::part                      |ancestor-or-self::reference                      |ancestor-or-self::partintro                      |ancestor-or-self::chapter                      |ancestor-or-self::appendix                      |ancestor-or-self::preface                      |ancestor-or-self::article                      |ancestor-or-self::section                      |ancestor-or-self::sect1                      |ancestor-or-self::sect2                      |ancestor-or-self::sect3                      |ancestor-or-self::sect4                      |ancestor-or-self::sect5                      |ancestor-or-self::refentry                      |ancestor-or-self::refsect1                      |ancestor-or-self::refsect2                      |ancestor-or-self::refsect3                      |ancestor-or-self::simplesect                      |ancestor-or-self::bibliography                      |ancestor-or-self::glossary                      |ancestor-or-self::index                      |ancestor-or-self::webpage)[last()])))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1])]">
+      <xsl:apply-templates select="." mode="reference">
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+      </xsl:apply-templates>
+    </xsl:for-each>
+
+    <xsl:if test="$refs[not(secondary)]/*[self::see]">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, &#34; &#34;, &#34; &#34;, see))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1])]" mode="index-see">
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+        <xsl:sort select="translate(see, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </dt>
+  <xsl:if test="$refs/secondary or $refs[not(secondary)]/*[self::seealso]">
+    <dd>
+      <dl>
+        <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, &#34; &#34;, &#34; &#34;, seealso))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1])]" mode="index-seealso">
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(seealso, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+        </xsl:apply-templates>
+        <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &#34; &#34;, normalize-space(concat(secondary/@sortas, secondary[not(@sortas)]))))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1]) = 1]" mode="index-secondary">
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+        </xsl:apply-templates>
+      </dl>
+    </dd>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-secondary">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])))"/>
+  <xsl:variable name="refs" select="key('secondary', $key)[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))]"/>
+  <dt>
+    <xsl:value-of select="secondary"/>
+    <xsl:for-each select="$refs[generate-id() = generate-id(key('secondary-section', concat($key, &#34; &#34;, generate-id((ancestor-or-self::set                      |ancestor-or-self::book                      |ancestor-or-self::part                      |ancestor-or-self::reference                      |ancestor-or-self::partintro                      |ancestor-or-self::chapter                      |ancestor-or-self::appendix                      |ancestor-or-self::preface                      |ancestor-or-self::article                      |ancestor-or-self::section                      |ancestor-or-self::sect1                      |ancestor-or-self::sect2                      |ancestor-or-self::sect3                      |ancestor-or-self::sect4                      |ancestor-or-self::sect5                      |ancestor-or-self::refentry                      |ancestor-or-self::refsect1                      |ancestor-or-self::refsect2                      |ancestor-or-self::refsect3                      |ancestor-or-self::simplesect                      |ancestor-or-self::bibliography                      |ancestor-or-self::glossary                      |ancestor-or-self::index                      |ancestor-or-self::webpage)[last()])))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1])]">
+      <xsl:apply-templates select="." mode="reference">
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+      </xsl:apply-templates>
+    </xsl:for-each>
+
+    <xsl:if test="$refs[not(tertiary)]/*[self::see]">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), &#34; &#34;, &#34; &#34;, see))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1])]" mode="index-see">
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+        <xsl:sort select="translate(see, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </dt>
+  <xsl:if test="$refs/tertiary or $refs[not(tertiary)]/*[self::seealso]">
+    <dd>
+      <dl>
+        <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), &#34; &#34;, &#34; &#34;, seealso))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1])]" mode="index-seealso">
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(seealso, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+        </xsl:apply-templates>
+        <xsl:apply-templates select="$refs[tertiary and count(.|key('tertiary', concat($key, &#34; &#34;, normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)]))))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1]) = 1]" mode="index-tertiary">
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+        </xsl:apply-templates>
+      </dl>
+    </dd>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-tertiary">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:variable name="key" select="concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), &#34; &#34;, normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])))"/>
+  <xsl:variable name="refs" select="key('tertiary', $key)[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))]"/>
+  <dt>
+    <xsl:value-of select="tertiary"/>
+    <xsl:for-each select="$refs[generate-id() = generate-id(key('tertiary-section', concat($key, &#34; &#34;, generate-id((ancestor-or-self::set                      |ancestor-or-self::book                      |ancestor-or-self::part                      |ancestor-or-self::reference                      |ancestor-or-self::partintro                      |ancestor-or-self::chapter                      |ancestor-or-self::appendix                      |ancestor-or-self::preface                      |ancestor-or-self::article                      |ancestor-or-self::section                      |ancestor-or-self::sect1                      |ancestor-or-self::sect2                      |ancestor-or-self::sect3                      |ancestor-or-self::sect4                      |ancestor-or-self::sect5                      |ancestor-or-self::refentry                      |ancestor-or-self::refsect1                      |ancestor-or-self::refsect2                      |ancestor-or-self::refsect3                      |ancestor-or-self::simplesect                      |ancestor-or-self::bibliography                      |ancestor-or-self::glossary                      |ancestor-or-self::index                      |ancestor-or-self::webpage)[last()])))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1])]">
+      <xsl:apply-templates select="." mode="reference">
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+      </xsl:apply-templates>
+    </xsl:for-each>
+
+    <xsl:if test="$refs/see">
+      <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see', concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), &#34; &#34;, normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])), &#34; &#34;, see))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1])]" mode="index-see">
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+        <xsl:sort select="translate(see, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </dt>
+  <xsl:if test="$refs/seealso">
+    <dd>
+      <dl>
+        <xsl:apply-templates select="$refs[generate-id() = generate-id(key('see-also', concat(normalize-space(concat(primary/@sortas, primary[not(@sortas)])), &#34; &#34;, normalize-space(concat(secondary/@sortas, secondary[not(@sortas)])), &#34; &#34;, normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)])), &#34; &#34;, seealso))[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1])]" mode="index-seealso">
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:sort select="translate(seealso, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+        </xsl:apply-templates>
+      </dl>
+    </dd>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="reference">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <xsl:param name="separator" select="', '"/>
+
+  <xsl:value-of select="$separator"/>
+  <xsl:choose>
+    <xsl:when test="@zone and string(@zone)">
+      <xsl:call-template name="reference">
+        <xsl:with-param name="zones" select="normalize-space(@zone)"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <a>
+        <xsl:variable name="title">
+          <xsl:choose>
+            <xsl:when test="(ancestor-or-self::set                      |ancestor-or-self::book                      |ancestor-or-self::part                      |ancestor-or-self::reference                      |ancestor-or-self::partintro                      |ancestor-or-self::chapter                      |ancestor-or-self::appendix                      |ancestor-or-self::preface                      |ancestor-or-self::article                      |ancestor-or-self::section                      |ancestor-or-self::sect1                      |ancestor-or-self::sect2                      |ancestor-or-self::sect3                      |ancestor-or-self::sect4                      |ancestor-or-self::sect5                      |ancestor-or-self::refentry                      |ancestor-or-self::refsect1                      |ancestor-or-self::refsect2                      |ancestor-or-self::refsect3                      |ancestor-or-self::simplesect                      |ancestor-or-self::bibliography                      |ancestor-or-self::glossary                      |ancestor-or-self::index                      |ancestor-or-self::webpage)[last()]/titleabbrev and $index.prefer.titleabbrev != 0">
+              <xsl:apply-templates select="(ancestor-or-self::set                      |ancestor-or-self::book                      |ancestor-or-self::part                      |ancestor-or-self::reference                      |ancestor-or-self::partintro                      |ancestor-or-self::chapter                      |ancestor-or-self::appendix                      |ancestor-or-self::preface                      |ancestor-or-self::article                      |ancestor-or-self::section                      |ancestor-or-self::sect1                      |ancestor-or-self::sect2                      |ancestor-or-self::sect3                      |ancestor-or-self::sect4                      |ancestor-or-self::sect5                      |ancestor-or-self::refentry                      |ancestor-or-self::refsect1                      |ancestor-or-self::refsect2                      |ancestor-or-self::refsect3                      |ancestor-or-self::simplesect                      |ancestor-or-self::bibliography                      |ancestor-or-self::glossary                      |ancestor-or-self::index                      |ancestor-or-self::webpage)[last()]" mode="titleabbrev.markup"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:apply-templates select="(ancestor-or-self::set                      |ancestor-or-self::book                      |ancestor-or-self::part                      |ancestor-or-self::reference                      |ancestor-or-self::partintro                      |ancestor-or-self::chapter                      |ancestor-or-self::appendix                      |ancestor-or-self::preface                      |ancestor-or-self::article                      |ancestor-or-self::section                      |ancestor-or-self::sect1                      |ancestor-or-self::sect2                      |ancestor-or-self::sect3                      |ancestor-or-self::sect4                      |ancestor-or-self::sect5                      |ancestor-or-self::refentry                      |ancestor-or-self::refsect1                      |ancestor-or-self::refsect2                      |ancestor-or-self::refsect3                      |ancestor-or-self::simplesect                      |ancestor-or-self::bibliography                      |ancestor-or-self::glossary                      |ancestor-or-self::index                      |ancestor-or-self::webpage)[last()]" mode="title.markup"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="(ancestor-or-self::set                      |ancestor-or-self::book                      |ancestor-or-self::part                      |ancestor-or-self::reference                      |ancestor-or-self::partintro                      |ancestor-or-self::chapter                      |ancestor-or-self::appendix                      |ancestor-or-self::preface                      |ancestor-or-self::article                      |ancestor-or-self::section                      |ancestor-or-self::sect1                      |ancestor-or-self::sect2                      |ancestor-or-self::sect3                      |ancestor-or-self::sect4                      |ancestor-or-self::sect5                      |ancestor-or-self::refentry                      |ancestor-or-self::refsect1                      |ancestor-or-self::refsect2                      |ancestor-or-self::refsect3                      |ancestor-or-self::simplesect                      |ancestor-or-self::bibliography                      |ancestor-or-self::glossary                      |ancestor-or-self::index                      |ancestor-or-self::webpage)[last()]"/>
+            <xsl:with-param name="context" select="//index[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1]"/>
+          </xsl:call-template>
+        </xsl:attribute>
+
+        <xsl:value-of select="$title"/> <!-- text only -->
+      </a>
+
+      <xsl:if test="key('endofrange', @id)[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))]">
+        <xsl:apply-templates select="key('endofrange', @id)[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][last()]" mode="reference">
+          <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
+          <xsl:with-param name="type" select="$type"/>
+          <xsl:with-param name="separator" select="'-'"/>
+        </xsl:apply-templates>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="reference">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+  <xsl:param name="zones"/>
+
+  <xsl:choose>
+    <xsl:when test="contains($zones, ' ')">
+      <xsl:variable name="zone" select="substring-before($zones, ' ')"/>
+      <xsl:variable name="target" select="key('sections', $zone)[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))]"/>
+
+      <a>
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$target[1]"/>
+            <xsl:with-param name="context" select="//index[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1]"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
+      </a>
+      <xsl:text>, </xsl:text>
+      <xsl:call-template name="reference">
+        <xsl:with-param name="zones" select="substring-after($zones, ' ')"/>
+        <xsl:with-param name="scope" select="$scope"/>
+        <xsl:with-param name="role" select="$role"/>
+        <xsl:with-param name="type" select="$type"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="zone" select="$zones"/>
+      <xsl:variable name="target" select="key('sections', $zone)[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))]"/>
+
+      <a>
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$target[1]"/>
+            <xsl:with-param name="context" select="//index[count(ancestor::node()|$scope) = count(ancestor::node())                 and ($role = @role or $type = @type or                 (string-length($role) = 0 and string-length($type) = 0))][1]"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:apply-templates select="$target[1]" mode="index-title-content"/>
+      </a>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-see">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:text> (</xsl:text>
+  <xsl:call-template name="gentext">
+    <xsl:with-param name="key" select="'see'"/>
+  </xsl:call-template>
+  <xsl:text> </xsl:text>
+  <xsl:value-of select="see"/>
+  <xsl:text>)</xsl:text>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="index-seealso">
+  <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
+  <xsl:param name="type" select="''"/>
+
+  <xsl:for-each select="seealso">
+    <xsl:sort select="translate(., 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+    <dt>
+    <xsl:text>(</xsl:text>
+    <xsl:call-template name="gentext">
+      <xsl:with-param name="key" select="'seealso'"/>
+    </xsl:call-template>
+    <xsl:text> </xsl:text>
+    <xsl:value-of select="."/>
+    <xsl:text>)</xsl:text>
+    </dt>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="*" mode="index-title-content">
+  <xsl:variable name="title">
+    <xsl:apply-templates select="(ancestor-or-self::set                      |ancestor-or-self::book                      |ancestor-or-self::part                      |ancestor-or-self::reference                      |ancestor-or-self::partintro                      |ancestor-or-self::chapter                      |ancestor-or-self::appendix                      |ancestor-or-self::preface                      |ancestor-or-self::article                      |ancestor-or-self::section                      |ancestor-or-self::sect1                      |ancestor-or-self::sect2                      |ancestor-or-self::sect3                      |ancestor-or-self::sect4                      |ancestor-or-self::sect5                      |ancestor-or-self::refentry                      |ancestor-or-self::refsect1                      |ancestor-or-self::refsect2                      |ancestor-or-self::refsect3                      |ancestor-or-self::simplesect                      |ancestor-or-self::bibliography                      |ancestor-or-self::glossary                      |ancestor-or-self::index                      |ancestor-or-self::webpage)[last()]" mode="title.markup"/>
+  </xsl:variable>
+
+  <xsl:value-of select="$title"/>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/autotoc.xsl
===================================================================
--- public/phoenix/utils/xhtml/autotoc.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/autotoc.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,559 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<!-- ********************************************************************
+     $Id: autotoc.xsl,v 1.34 2005/01/19 15:15:31 nwalsh Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<xsl:variable name="toc.listitem.type">
+  <xsl:choose>
+    <xsl:when test="$toc.list.type = 'dl'">dt</xsl:when>
+    <xsl:otherwise>li</xsl:otherwise>
+  </xsl:choose>
+</xsl:variable>
+
+<!-- this is just hack because dl and ul aren't completely isomorphic -->
+<xsl:variable name="toc.dd.type">
+  <xsl:choose>
+    <xsl:when test="$toc.list.type = 'dl'">dd</xsl:when>
+    <xsl:otherwise/>
+  </xsl:choose>
+</xsl:variable>
+
+<xsl:template name="make.toc">
+  <xsl:param name="toc-context" select="."/>
+  <xsl:param name="toc.title.p" select="true()"/>
+  <xsl:param name="nodes" select="/NOT-AN-ELEMENT"/>
+
+  <xsl:variable name="toc.title">
+    <xsl:if test="$toc.title.p">
+      <p>
+        <b>
+          <xsl:call-template name="gentext">
+            <xsl:with-param name="key">TableofContents</xsl:with-param>
+          </xsl:call-template>
+        </b>
+      </p>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$manual.toc != ''">
+      <xsl:variable name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:variable>
+      <xsl:variable name="toc" select="document($manual.toc, .)"/>
+      <xsl:variable name="tocentry" select="$toc//tocentry[@linkend=$id]"/>
+      <xsl:if test="$tocentry and $tocentry/*">
+        <div class="toc">
+          <xsl:copy-of select="$toc.title"/>
+          <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
+            <xsl:call-template name="manual-toc">
+              <xsl:with-param name="tocentry" select="$tocentry/*[1]"/>
+            </xsl:call-template>
+          </xsl:element>
+        </div>
+      </xsl:if>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:if test="$nodes">
+        <div class="toc">
+          <xsl:copy-of select="$toc.title"/>
+          <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
+            <xsl:apply-templates select="$nodes" mode="toc">
+              <xsl:with-param name="toc-context" select="$toc-context"/>
+            </xsl:apply-templates>
+          </xsl:element>
+        </div>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="make.lots">
+  <xsl:param name="toc.params" select="''"/>
+  <xsl:param name="toc"/>
+
+  <xsl:if test="contains($toc.params, 'toc')">
+    <xsl:copy-of select="$toc"/>
+  </xsl:if>
+
+  <xsl:if test="contains($toc.params, 'figure')">
+    <xsl:call-template name="list.of.titles">
+      <xsl:with-param name="titles" select="'figure'"/>
+      <xsl:with-param name="nodes" select=".//figure"/>
+    </xsl:call-template>
+  </xsl:if>
+
+  <xsl:if test="contains($toc.params, 'table')">
+    <xsl:call-template name="list.of.titles">
+      <xsl:with-param name="titles" select="'table'"/>
+      <xsl:with-param name="nodes" select=".//table"/>
+    </xsl:call-template>
+  </xsl:if>
+
+  <xsl:if test="contains($toc.params, 'example')">
+    <xsl:call-template name="list.of.titles">
+      <xsl:with-param name="titles" select="'example'"/>
+      <xsl:with-param name="nodes" select=".//example"/>
+    </xsl:call-template>
+  </xsl:if>
+
+  <xsl:if test="contains($toc.params, 'equation')">
+    <xsl:call-template name="list.of.titles">
+      <xsl:with-param name="titles" select="'equation'"/>
+      <xsl:with-param name="nodes" select=".//equation[title]"/>
+    </xsl:call-template>
+  </xsl:if>
+
+  <xsl:if test="contains($toc.params, 'procedure')">
+    <xsl:call-template name="list.of.titles">
+      <xsl:with-param name="titles" select="'procedure'"/>
+      <xsl:with-param name="nodes" select=".//procedure[title]"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<!-- ====================================================================== -->
+
+<xsl:template name="set.toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:call-template name="make.toc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+    <xsl:with-param name="nodes" select="book|setindex"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="division.toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:call-template name="make.toc">
+    <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:template>
+
+<xsl:template name="component.toc">
+  <xsl:param name="toc-context" select="."/>
+  <xsl:param name="toc.title.p" select="true()"/>
+
+  <xsl:call-template name="make.toc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+    <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
+    <xsl:with-param name="nodes" select="section|sect1                                          |simplesect[$simplesect.in.toc != 0]                                          |refentry                                          |article|bibliography|glossary                                          |appendix|index                                          |bridgehead[not(@renderas)                                                      and $bridgehead.in.toc != 0]                                          |.//bridgehead[@renderas='sect1'                                                         and $bridgehead.in.toc != 0]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="component.toc.separator">
+  <!-- Customize to output something between
+       component.toc and first output -->
+</xsl:template>
+
+<xsl:template name="section.toc">
+  <xsl:param name="toc-context" select="."/>
+  <xsl:param name="toc.title.p" select="true()"/>
+
+  <xsl:call-template name="make.toc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+    <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
+    <xsl:with-param name="nodes" select="section|sect1|sect2|sect3|sect4|sect5|refentry                            |bridgehead[$bridgehead.in.toc != 0]"/>
+
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="section.toc.separator">
+  <!-- Customize to output something between
+       section.toc and first output -->
+</xsl:template>
+<!-- ==================================================================== -->
+
+<xsl:template name="subtoc">
+  <xsl:param name="toc-context" select="."/>
+  <xsl:param name="nodes" select="NOT-AN-ELEMENT"/>
+
+  <xsl:variable name="subtoc">
+    <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
+      <xsl:apply-templates mode="toc" select="$nodes">
+        <xsl:with-param name="toc-context" select="$toc-context"/>
+      </xsl:apply-templates>
+    </xsl:element>
+  </xsl:variable>
+
+  <xsl:variable name="depth">
+    <xsl:choose>
+      <xsl:when test="local-name(.) = 'section'">
+        <xsl:value-of select="count(ancestor::section) + 1"/>
+      </xsl:when>
+      <xsl:when test="local-name(.) = 'sect1'">1</xsl:when>
+      <xsl:when test="local-name(.) = 'sect2'">2</xsl:when>
+      <xsl:when test="local-name(.) = 'sect3'">3</xsl:when>
+      <xsl:when test="local-name(.) = 'sect4'">4</xsl:when>
+      <xsl:when test="local-name(.) = 'sect5'">5</xsl:when>
+      <xsl:when test="local-name(.) = 'refsect1'">1</xsl:when>
+      <xsl:when test="local-name(.) = 'refsect2'">2</xsl:when>
+      <xsl:when test="local-name(.) = 'refsect3'">3</xsl:when>
+      <xsl:when test="local-name(.) = 'simplesect'">
+        <!-- sigh... -->
+        <xsl:choose>
+          <xsl:when test="local-name(..) = 'section'">
+            <xsl:value-of select="count(ancestor::section)"/>
+          </xsl:when>
+          <xsl:when test="local-name(..) = 'sect1'">2</xsl:when>
+          <xsl:when test="local-name(..) = 'sect2'">3</xsl:when>
+          <xsl:when test="local-name(..) = 'sect3'">4</xsl:when>
+          <xsl:when test="local-name(..) = 'sect4'">5</xsl:when>
+          <xsl:when test="local-name(..) = 'sect5'">6</xsl:when>
+          <xsl:when test="local-name(..) = 'refsect1'">2</xsl:when>
+          <xsl:when test="local-name(..) = 'refsect2'">3</xsl:when>
+          <xsl:when test="local-name(..) = 'refsect3'">4</xsl:when>
+          <xsl:otherwise>1</xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>0</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+  <xsl:variable name="subtoc.list">
+    <xsl:choose>
+      <xsl:when test="$toc.dd.type = ''">
+        <xsl:copy-of select="$subtoc"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:element name="{$toc.dd.type}" namespace="http://www.w3.org/1999/xhtml">
+          <xsl:copy-of select="$subtoc"/>
+        </xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml">
+    <xsl:call-template name="toc.line">
+      <xsl:with-param name="toc-context" select="$toc-context"/>
+    </xsl:call-template>
+    <xsl:if test="$toc.listitem.type = 'li'                   and $toc.section.depth &gt; $depth and count($nodes)&gt;0                   and $toc.max.depth &gt; $depth.from.context">
+      <xsl:copy-of select="$subtoc.list"/>
+    </xsl:if>
+  </xsl:element>
+  <xsl:if test="$toc.listitem.type != 'li'                 and $toc.section.depth &gt; $depth and count($nodes)&gt;0                 and $toc.max.depth &gt; $depth.from.context">
+    <xsl:copy-of select="$subtoc.list"/>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="toc.line">
+  <xsl:param name="toc-context" select="."/>
+  <xsl:param name="depth" select="1"/>
+  <xsl:param name="depth.from.context" select="8"/>
+
+ <span>
+  <xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>
+  <a>
+    <xsl:attribute name="href">
+      <xsl:call-template name="href.target">
+        <xsl:with-param name="context" select="$toc-context"/>
+      </xsl:call-template>
+    </xsl:attribute>
+    
+    <xsl:variable name="label">
+      <xsl:apply-templates select="." mode="label.markup"/>
+    </xsl:variable>
+    <xsl:copy-of select="$label"/>
+    <xsl:if test="$label != ''">
+      <xsl:value-of select="$autotoc.label.separator"/>
+    </xsl:if>
+
+    <xsl:apply-templates select="." mode="titleabbrev.markup"/>
+  </a>
+  </span>
+</xsl:template>
+
+<xsl:template match="book" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <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:template>
+
+<xsl:template match="setindex" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <!-- If the setindex tag is not empty, it should be it in the TOC -->
+  <xsl:if test="* or $generate.index != 0">
+    <xsl:call-template name="subtoc">
+      <xsl:with-param name="toc-context" select="$toc-context"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="part|reference" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+    <xsl:with-param name="nodes" select="appendix|chapter|article                                          |index|glossary|bibliography                                          |preface|reference|refentry                                          |bridgehead[$bridgehead.in.toc != 0]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="preface|chapter|appendix|article" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+    <xsl:with-param name="nodes" select="section|sect1                                          |simplesect[$simplesect.in.toc != 0]                                          |refentry                                          |glossary|bibliography|index                                          |bridgehead[$bridgehead.in.toc != 0]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="sect1" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+    <xsl:with-param name="nodes" select="sect2                                          |bridgehead[$bridgehead.in.toc != 0]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="sect2" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+    <xsl:with-param name="nodes" select="sect3                                          |bridgehead[$bridgehead.in.toc != 0]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="sect3" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+    <xsl:with-param name="nodes" select="sect4                                          |bridgehead[$bridgehead.in.toc != 0]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="sect4" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+    <xsl:with-param name="nodes" select="sect5                                          |bridgehead[$bridgehead.in.toc != 0]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="sect5" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="simplesect" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="section" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+    <xsl:with-param name="nodes" select="section                                          |bridgehead[$bridgehead.in.toc != 0]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="bridgehead" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:if test="$bridgehead.in.toc != 0">
+    <xsl:call-template name="subtoc">
+      <xsl:with-param name="toc-context" select="$toc-context"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="bibliography|glossary" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="index" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <!-- If the index tag is not empty, it should be it in the TOC -->
+  <xsl:if test="* or $generate.index != 0">
+    <xsl:call-template name="subtoc">
+      <xsl:with-param name="toc-context" select="$toc-context"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="refentry" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:variable name="refmeta" select=".//refmeta"/>
+  <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
+  <xsl:variable name="refnamediv" select=".//refnamediv"/>
+  <xsl:variable name="refname" select="$refnamediv//refname"/>
+  <xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
+  <xsl:variable name="title">
+    <xsl:choose>
+      <xsl:when test="$refentrytitle">
+        <xsl:apply-templates select="$refentrytitle[1]" mode="titleabbrev.markup"/>
+      </xsl:when>
+      <xsl:when test="$refdesc">
+        <xsl:apply-templates select="$refdesc" mode="titleabbrev.markup"/>
+      </xsl:when>
+      <xsl:when test="$refname">
+        <xsl:apply-templates select="$refname[1]" mode="titleabbrev.markup"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml">
+    <span class="refentrytitle">
+      <a>
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target"/>
+        </xsl:attribute>
+        <xsl:copy-of select="$title"/>
+      </a>
+    </span>
+    <span class="refpurpose">
+      <xsl:if test="$annotate.toc != 0">
+        <xsl:text> - </xsl:text>
+        <xsl:value-of select="refnamediv/refpurpose"/>
+      </xsl:if>
+    </span>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template match="title" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <a>
+    <xsl:attribute name="href">
+      <xsl:call-template name="href.target">
+        <xsl:with-param name="object" select=".."/>
+      </xsl:call-template>
+    </xsl:attribute>
+    <xsl:apply-templates/>
+  </a>
+</xsl:template>
+
+<xsl:template name="manual-toc">
+  <xsl:param name="toc-context" select="."/>
+  <xsl:param name="tocentry"/>
+
+  <!-- be careful, we don't want to change the current document to the other tree! -->
+
+  <xsl:if test="$tocentry">
+    <xsl:variable name="node" select="key('id', $tocentry/@linkend)"/>
+
+    <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml">
+      <xsl:variable name="label">
+        <xsl:apply-templates select="$node" mode="label.markup"/>
+      </xsl:variable>
+      <xsl:copy-of select="$label"/>
+      <xsl:if test="$label != ''">
+        <xsl:value-of select="$autotoc.label.separator"/>
+      </xsl:if>
+      <a>
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$node"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:apply-templates select="$node" mode="titleabbrev.markup"/>
+      </a>
+    </xsl:element>
+
+    <xsl:if test="$tocentry/*">
+      <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
+        <xsl:call-template name="manual-toc">
+          <xsl:with-param name="tocentry" select="$tocentry/*[1]"/>
+        </xsl:call-template>
+      </xsl:element>
+    </xsl:if>
+
+    <xsl:if test="$tocentry/following-sibling::*">
+      <xsl:call-template name="manual-toc">
+        <xsl:with-param name="tocentry" select="$tocentry/following-sibling::*[1]"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="list.of.titles">
+  <xsl:param name="toc-context" select="."/>
+  <xsl:param name="titles" select="'table'"/>
+  <xsl:param name="nodes" select=".//table"/>
+
+  <xsl:if test="$nodes">
+    <div class="list-of-{$titles}s">
+      <p>
+        <b>
+          <xsl:call-template name="gentext">
+            <xsl:with-param name="key">
+              <xsl:choose>
+                <xsl:when test="$titles='table'">ListofTables</xsl:when>
+                <xsl:when test="$titles='figure'">ListofFigures</xsl:when>
+                <xsl:when test="$titles='equation'">ListofEquations</xsl:when>
+                <xsl:when test="$titles='example'">ListofExamples</xsl:when>
+                <xsl:when test="$titles='procedure'">ListofProcedures</xsl:when>
+                <xsl:otherwise>ListofUnknown</xsl:otherwise>
+              </xsl:choose>
+            </xsl:with-param>
+          </xsl:call-template>
+        </b>
+      </p>
+
+      <xsl:element name="{$toc.list.type}" namespace="http://www.w3.org/1999/xhtml">
+        <xsl:apply-templates select="$nodes" mode="toc">
+          <xsl:with-param name="toc-context" select="$toc-context"/>
+        </xsl:apply-templates>
+      </xsl:element>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="figure|table|example|equation|procedure" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:element name="{$toc.listitem.type}" namespace="http://www.w3.org/1999/xhtml">
+    <xsl:variable name="label">
+      <xsl:apply-templates select="." mode="label.markup"/>
+    </xsl:variable>
+    <xsl:copy-of select="$label"/>
+    <xsl:if test="$label != ''">
+      <xsl:value-of select="$autotoc.label.separator"/>
+    </xsl:if>
+    <a>
+      <xsl:attribute name="href">
+        <xsl:call-template name="href.target"/>
+      </xsl:attribute>
+      <xsl:apply-templates select="." mode="titleabbrev.markup"/>
+    </a>
+  </xsl:element>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/biblio.xsl
===================================================================
--- public/phoenix/utils/xhtml/biblio.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/biblio.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,1077 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<!-- ********************************************************************
+     $Id: biblio.xsl,v 1.24 2004/10/17 20:15:55 nwalsh Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:template match="bibliography">
+  <div class="{name(.)}">
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="bibliography.titlepage"/>
+
+    <xsl:apply-templates/>
+
+    <xsl:if test="not(parent::article)">
+      <xsl:call-template name="process.footnotes"/>
+    </xsl:if>
+  </div>
+</xsl:template>
+
+<xsl:template match="bibliography/bibliographyinfo"/>
+<xsl:template match="bibliography/title"/>
+<xsl:template match="bibliography/subtitle"/>
+<xsl:template match="bibliography/titleabbrev"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="bibliodiv">
+  <div class="{name(.)}">
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
+<xsl:template match="bibliodiv/title">
+  <h3 class="{name(.)}">
+    <xsl:call-template name="anchor">
+      <xsl:with-param name="node" select=".."/>
+    </xsl:call-template>
+    <xsl:apply-templates/>
+  </h3>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="bibliolist">
+  <div class="{name(.)}">
+    <xsl:call-template name="anchor"/>
+    <xsl:if test="blockinfo/title|title">
+      <xsl:call-template name="formal.object.heading"/>
+    </xsl:if>
+    <xsl:apply-templates select="*[not(self::blockinfo)               and not(self::title)        and not(self::titleabbrev)               and not(self::biblioentry)        and not(self::bibliomixed)]"/>
+    <dl>
+      <xsl:apply-templates select="biblioentry|bibliomixed"/>
+    </dl>
+  </div>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="biblioentry">
+  <xsl:param name="label">
+    <xsl:call-template name="biblioentry.label"/>
+  </xsl:param>
+
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="string(.) = ''">
+      <xsl:variable name="bib" select="document($bibliography.collection,.)"/>
+      <xsl:variable name="entry" select="$bib/bibliography/*[@id=$id][1]"/>
+      <xsl:choose>
+        <xsl:when test="$entry">
+	  <xsl:choose>
+	    <xsl:when test="$bibliography.numbered != 0">
+	      <xsl:apply-templates select="$entry">
+		<xsl:with-param name="label" select="$label"/>
+	      </xsl:apply-templates>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:apply-templates select="$entry"/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:message>
+            <xsl:text>No bibliography entry: </xsl:text>
+            <xsl:value-of select="$id"/>
+            <xsl:text> found in </xsl:text>
+            <xsl:value-of select="$bibliography.collection"/>
+          </xsl:message>
+          <div class="{name(.)}">
+            <xsl:call-template name="anchor"/>
+            <p>
+	      <xsl:copy-of select="$label"/>
+              <xsl:text>Error: no bibliography entry: </xsl:text>
+              <xsl:value-of select="$id"/>
+              <xsl:text> found in </xsl:text>
+              <xsl:value-of select="$bibliography.collection"/>
+            </p>
+          </div>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <div class="{name(.)}">
+        <xsl:call-template name="anchor"/>
+        <p>
+	  <xsl:copy-of select="$label"/>
+          <xsl:apply-templates mode="bibliography.mode"/>
+        </p>
+      </div>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="bibliomixed">
+  <xsl:param name="label">
+    <xsl:call-template name="biblioentry.label"/>
+  </xsl:param>
+
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="string(.) = ''">
+      <xsl:variable name="bib" select="document($bibliography.collection,.)"/>
+      <xsl:variable name="entry" select="$bib/bibliography/*[@id=$id][1]"/>
+      <xsl:choose>
+        <xsl:when test="$entry">
+	  <xsl:choose>
+	    <xsl:when test="$bibliography.numbered != 0">
+	      <xsl:apply-templates select="$entry">
+		<xsl:with-param name="label" select="$label"/>
+	      </xsl:apply-templates>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:apply-templates select="$entry"/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:message>
+            <xsl:text>No bibliography entry: </xsl:text>
+            <xsl:value-of select="$id"/>
+            <xsl:text> found in </xsl:text>
+            <xsl:value-of select="$bibliography.collection"/>
+          </xsl:message>
+          <div class="{name(.)}">
+            <xsl:call-template name="anchor"/>
+            <p>
+	      <xsl:copy-of select="$label"/>
+              <xsl:text>Error: no bibliography entry: </xsl:text>
+              <xsl:value-of select="$id"/>
+              <xsl:text> found in </xsl:text>
+              <xsl:value-of select="$bibliography.collection"/>
+            </p>
+          </div>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <div class="{name(.)}">
+        <xsl:call-template name="anchor"/>
+        <p class="{name(.)}">
+	  <xsl:copy-of select="$label"/>
+          <xsl:apply-templates mode="bibliomixed.mode"/>
+        </p>
+      </div>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="biblioentry.label">
+  <xsl:param name="node" select="."/>
+
+  <xsl:choose>
+    <xsl:when test="$bibliography.numbered != 0">
+      <xsl:text>[</xsl:text>
+      <xsl:number from="bibliography" count="biblioentry|bibliomixed" level="any" format="1"/>
+      <xsl:text>] </xsl:text>
+    </xsl:when>
+    <xsl:when test="local-name($node/child::*[1]) = 'abbrev'">
+      <xsl:text>[</xsl:text>
+      <xsl:apply-templates select="$node/abbrev[1]"/>
+      <xsl:text>] </xsl:text>
+    </xsl:when>
+    <xsl:when test="$node/@xreflabel">
+      <xsl:text>[</xsl:text>
+      <xsl:value-of select="$node/@xreflabel"/>
+      <xsl:text>] </xsl:text>
+    </xsl:when>
+    <xsl:when test="$node/@id">
+      <xsl:text>[</xsl:text>
+      <xsl:value-of select="$node/@id"/>
+      <xsl:text>] </xsl:text>
+    </xsl:when>
+    <xsl:otherwise><!-- nop --></xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*" mode="bibliography.mode">
+  <xsl:apply-templates select="."/><!-- try the default mode -->
+</xsl:template>
+
+<xsl:template match="abbrev" mode="bibliography.mode">
+  <xsl:if test="preceding-sibling::*">
+    <xsl:apply-templates mode="bibliography.mode"/>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="abstract" mode="bibliography.mode">
+  <!-- suppressed -->
+</xsl:template>
+
+<xsl:template match="address" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="affiliation" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="shortaffil" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="jobtitle" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="artheader|articleinfo|info" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="artpagenums" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="author" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:call-template name="person.name"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="authorblurb|personblurb" mode="bibliography.mode">
+  <!-- suppressed -->
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:call-template name="person.name.list"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="authorinitials" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="bibliomisc" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="bibliomset" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<!-- ================================================== -->
+
+<xsl:template match="biblioset" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="biblioset/title|biblioset/citetitle" mode="bibliography.mode">
+  <xsl:variable name="relation" select="../@relation"/>
+  <xsl:choose>
+    <xsl:when test="$relation='article' or @pubwork='article'">
+      <xsl:call-template name="gentext.startquote"/>
+      <xsl:apply-templates/>
+      <xsl:call-template name="gentext.endquote"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <i><xsl:apply-templates/></i>
+    </xsl:otherwise>
+  </xsl:choose>
+  <xsl:value-of select="$biblioentry.item.separator"/>
+</xsl:template>
+
+<!-- ================================================== -->
+
+<xsl:template match="bookbiblio" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="citetitle" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:choose>
+      <xsl:when test="@pubwork = 'article'">
+        <xsl:call-template name="gentext.startquote"/>
+        <xsl:call-template name="inline.charseq"/>
+        <xsl:call-template name="gentext.endquote"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="inline.italicseq"/>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="collab" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="collabname" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="confgroup" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="confdates" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="conftitle" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="confnum" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="confsponsor" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="contractnum" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="contractsponsor" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="contrib" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<!-- ================================================== -->
+
+<xsl:template match="copyright" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:call-template name="gentext">
+      <xsl:with-param name="key" select="'Copyright'"/>
+    </xsl:call-template>
+    <xsl:call-template name="gentext.space"/>
+    <xsl:call-template name="dingbat">
+      <xsl:with-param name="dingbat">copyright</xsl:with-param>
+    </xsl:call-template>
+    <xsl:call-template name="gentext.space"/>
+    <xsl:apply-templates select="year" mode="bibliography.mode"/>
+    <xsl:if test="holder">
+      <xsl:call-template name="gentext.space"/>
+      <xsl:apply-templates select="holder" mode="bibliography.mode"/>
+    </xsl:if>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="year" mode="bibliography.mode">
+  <xsl:apply-templates/><xsl:text>, </xsl:text>
+</xsl:template>
+
+<xsl:template match="year[position()=last()]" mode="bibliography.mode">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="holder" mode="bibliography.mode">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<!-- ================================================== -->
+
+<xsl:template match="corpauthor" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="corpcredit" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="corpname" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="date" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="edition" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="editor" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:call-template name="person.name"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="firstname" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="honorific" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="invpartnumber" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="isbn" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="issn" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="issuenum" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="lineage" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="orgname" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="orgdiv" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="othername" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="pagenums" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="printhistory" mode="bibliography.mode">
+  <!-- suppressed -->
+</xsl:template>
+
+<xsl:template match="productname" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="productnumber" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="publisher" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="publishername" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="pubsnumber" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="bibliography.mode">
+  <!-- suppressed; how could this be represented? -->
+</xsl:template>
+
+<xsl:template match="seriesinfo" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="seriesvolnums" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="surname" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="title" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <i><xsl:apply-templates mode="bibliography.mode"/></i>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="titleabbrev" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="volumenum" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="bibliocoverage|biblioid|bibliorelation|bibliosource" mode="bibliography.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliography.mode"/>
+    <xsl:value-of select="$biblioentry.item.separator"/>
+  </span>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*" mode="bibliomixed.mode">
+  <xsl:apply-templates select="."/><!-- try the default mode -->
+</xsl:template>
+
+<xsl:template match="abbrev" mode="bibliomixed.mode">
+  <xsl:if test="preceding-sibling::*">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="abstract" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="address" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="affiliation" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="shortaffil" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="jobtitle" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="artpagenums" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="author" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="authorblurb|personblurb" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="authorgroup" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="authorinitials" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="bibliomisc" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<!-- ================================================== -->
+
+<xsl:template match="bibliomset" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="bibliomset/title|bibliomset/citetitle" mode="bibliomixed.mode">
+  <xsl:variable name="relation" select="../@relation"/>
+  <xsl:choose>
+    <xsl:when test="$relation='article' or @pubwork='article'">
+      <xsl:call-template name="gentext.startquote"/>
+      <xsl:apply-templates/>
+      <xsl:call-template name="gentext.endquote"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <i><xsl:apply-templates/></i>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ================================================== -->
+
+<xsl:template match="biblioset" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="citetitle" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:choose>
+      <xsl:when test="@pubwork = 'article'">
+        <xsl:call-template name="gentext.startquote"/>
+        <xsl:call-template name="inline.charseq"/>
+        <xsl:call-template name="gentext.endquote"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="inline.italicseq"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </span>
+</xsl:template>
+
+
+<xsl:template match="collab" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="confgroup" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="contractnum" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="contractsponsor" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="contrib" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="copyright" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="corpauthor" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="corpcredit" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="corpname" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="date" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="edition" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="editor" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="firstname" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="honorific" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="indexterm" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="invpartnumber" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="isbn" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="issn" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="issuenum" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="lineage" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="orgname" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="othercredit" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="othername" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="pagenums" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="printhistory" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="productname" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="productnumber" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="pubdate" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="publisher" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="publishername" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="pubsnumber" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="releaseinfo" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="revhistory" mode="bibliomixed.mode">
+  <!-- suppressed; how could this be represented? -->
+</xsl:template>
+
+<xsl:template match="seriesvolnums" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="subtitle" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="surname" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="title" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="titleabbrev" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="volumenum" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="bibliocoverage|biblioid|bibliorelation|bibliosource" mode="bibliomixed.mode">
+  <span class="{name(.)}">
+    <xsl:apply-templates mode="bibliomixed.mode"/>
+  </span>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/block.xsl
===================================================================
--- public/phoenix/utils/xhtml/block.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/block.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,429 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<!-- ********************************************************************
+     $Id: block.xsl,v 1.21 2005/03/08 09:02:41 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+<!-- What should we do about styling blockinfo? -->
+
+<xsl:template match="blockinfo">
+  <!-- suppress -->
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="block.object">
+  <div class="{name(.)}">
+    <xsl:call-template name="anchor"/>
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="para">
+  <xsl:call-template name="paragraph">
+    <xsl:with-param name="class">
+      <xsl:if test="@role and $para.propagates.style != 0">
+        <xsl:value-of select="@role"/>
+      </xsl:if>
+    </xsl:with-param>
+    <xsl:with-param name="content">
+      <xsl:if test="position() = 1 and parent::listitem">
+        <xsl:call-template name="anchor">
+          <xsl:with-param name="node" select="parent::listitem"/>
+        </xsl:call-template>
+      </xsl:if>
+
+      <xsl:call-template name="anchor"/>
+      <xsl:apply-templates/>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="paragraph">
+  <xsl:param name="class" select="''"/>
+  <xsl:param name="content"/>
+
+  <xsl:variable name="p">
+    <p>
+      <xsl:if test="$class != ''">
+        <xsl:attribute name="class">
+          <xsl:value-of select="$class"/>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:copy-of select="$content"/>
+    </p>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$html.cleanup != 0">
+      <xsl:call-template name="unwrap.p">
+        <xsl:with-param name="p" select="$p"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy-of select="$p"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="simpara">
+  <!-- see also listitem/simpara in lists.xsl -->
+  <p>
+    <xsl:if test="@role and $para.propagates.style != 0">
+      <xsl:attribute name="class">
+        <xsl:value-of select="@role"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="anchor"/>
+    <xsl:apply-templates/>
+  </p>
+</xsl:template>
+
+<xsl:template match="formalpara">
+  <xsl:call-template name="paragraph">
+    <xsl:with-param name="class">
+      <xsl:if test="@role and $para.propagates.style != 0">
+        <xsl:value-of select="@role"/>
+      </xsl:if>
+    </xsl:with-param>
+    <xsl:with-param name="content">
+      <xsl:call-template name="anchor"/>
+      <xsl:apply-templates/>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="formalpara/title">
+  <xsl:variable name="titleStr">
+      <xsl:apply-templates/>
+  </xsl:variable>
+  <xsl:variable name="lastChar">
+    <xsl:if test="$titleStr != ''">
+      <xsl:value-of select="substring($titleStr,string-length($titleStr),1)"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <b>
+    <xsl:copy-of select="$titleStr"/>
+    <xsl:if test="$lastChar != ''                   and not(contains($runinhead.title.end.punct, $lastChar))">
+      <xsl:value-of select="$runinhead.default.title.end.punct"/>
+    </xsl:if>
+    <xsl:text>&#160;</xsl:text>
+  </b>
+</xsl:template>
+
+<xsl:template match="formalpara/para">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="blockquote">
+  <div class="{local-name(.)}">
+    <xsl:if test="@lang or @xml:lang">
+      <xsl:call-template name="language.attribute"/>
+    </xsl:if>
+    <xsl:call-template name="anchor"/>
+
+    <xsl:choose>
+      <xsl:when test="attribution">
+        <table border="0" width="100%" cellspacing="0" cellpadding="0" class="blockquote" summary="Block quote">
+          <tr>
+            <td width="10%" valign="top">&#160;</td>
+            <td width="80%" valign="top">
+              <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
+            </td>
+            <td width="10%" valign="top">&#160;</td>
+          </tr>
+          <tr>
+            <td width="10%" valign="top">&#160;</td>
+            <td colspan="2" align="right" valign="top">
+              <xsl:text>--</xsl:text>
+              <xsl:apply-templates select="attribution"/>
+            </td>
+          </tr>
+        </table>
+      </xsl:when>
+      <xsl:otherwise>
+        <blockquote class="{local-name(.)}">
+          <xsl:apply-templates/>
+        </blockquote>
+      </xsl:otherwise>
+    </xsl:choose>
+  </div>
+</xsl:template>
+
+<xsl:template match="blockquote/title">
+  <div class="blockquote-title">
+    <p>
+      <b>
+        <xsl:apply-templates/>
+      </b>
+    </p>
+  </div>
+</xsl:template>
+
+<xsl:template match="epigraph">
+  <div class="{name(.)}">
+      <xsl:apply-templates select="para|simpara|formalpara|literallayout"/>
+      <xsl:if test="attribution">
+        <div class="attribution">
+          <span>--<xsl:apply-templates select="attribution"/></span>
+        </div>
+      </xsl:if>
+  </div>
+</xsl:template>
+
+<xsl:template match="attribution">
+  <span class="{name(.)}"><xsl:apply-templates/></span>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="sidebar">
+  <div class="{name(.)}">
+    <xsl:call-template name="anchor"/>
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
+<xsl:template match="sidebar/title">
+  <p class="title">
+    <b><xsl:apply-templates/></b>
+  </p>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="abstract">
+  <div class="{name(.)}">
+    <xsl:call-template name="anchor"/>
+    <xsl:call-template name="formal.object.heading">
+      <xsl:with-param name="title">
+        <xsl:apply-templates select="." mode="title.markup">
+          <xsl:with-param name="allow-anchors" select="'1'"/>
+        </xsl:apply-templates>
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
+<xsl:template match="abstract/title">
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="msgset">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="msgentry">
+  <xsl:call-template name="block.object"/>
+</xsl:template>
+
+<xsl:template match="simplemsgentry">
+  <xsl:call-template name="block.object"/>
+</xsl:template>
+
+<xsl:template match="msg">
+  <xsl:call-template name="block.object"/>
+</xsl:template>
+
+<xsl:template match="msgmain">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="msgmain/title">
+  <b><xsl:apply-templates/></b>
+</xsl:template>
+
+<xsl:template match="msgsub">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="msgsub/title">
+  <b><xsl:apply-templates/></b>
+</xsl:template>
+
+<xsl:template match="msgrel">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="msgrel/title">
+  <b><xsl:apply-templates/></b>
+</xsl:template>
+
+<xsl:template match="msgtext">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="msginfo">
+  <xsl:call-template name="block.object"/>
+</xsl:template>
+
+<xsl:template match="msglevel">
+  <p>
+    <b>
+      <xsl:call-template name="gentext.template">
+        <xsl:with-param name="context" select="'msgset'"/>
+        <xsl:with-param name="name" select="'MsgLevel'"/>
+      </xsl:call-template>
+    </b>
+    <xsl:apply-templates/>
+  </p>
+</xsl:template>
+
+<xsl:template match="msgorig">
+  <p>
+    <b>
+      <xsl:call-template name="gentext.template">
+        <xsl:with-param name="context" select="'msgset'"/>
+        <xsl:with-param name="name" select="'MsgOrig'"/>
+      </xsl:call-template>
+    </b>
+    <xsl:apply-templates/>
+  </p>
+</xsl:template>
+
+<xsl:template match="msgaud">
+  <p>
+    <b>
+      <xsl:call-template name="gentext.template">
+        <xsl:with-param name="context" select="'msgset'"/>
+        <xsl:with-param name="name" select="'MsgAud'"/>
+      </xsl:call-template>
+    </b>
+    <xsl:apply-templates/>
+  </p>
+</xsl:template>
+
+<xsl:template match="msgexplan">
+  <xsl:call-template name="block.object"/>
+</xsl:template>
+
+<xsl:template match="msgexplan/title">
+  <p><b><xsl:apply-templates/></b></p>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="revhistory">
+  <div class="{name(.)}">
+    <table border="0" width="100%" summary="Revision history">
+      <tr>
+        <th align="left" valign="top" colspan="3">
+          <b>
+            <xsl:call-template name="gentext">
+              <xsl:with-param name="key" select="'RevHistory'"/>
+            </xsl:call-template>
+          </b>
+        </th>
+      </tr>
+      <xsl:apply-templates/>
+    </table>
+  </div>
+</xsl:template>
+
+<xsl:template match="revhistory/revision">
+  <xsl:variable name="revnumber" select="revnumber"/>
+  <xsl:variable name="revdate" select="date"/>
+  <xsl:variable name="revauthor" select="authorinitials"/>
+  <xsl:variable name="revremark" select="revremark|revdescription"/>
+  <tr>
+    <td align="left">
+      <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"/>
+      </xsl:if>
+    </td>
+    <td align="left">
+      <xsl:apply-templates select="$revdate"/>
+    </td>
+    <xsl:choose>
+      <xsl:when test="count($revauthor)=0">
+        <td align="left">
+          <xsl:call-template name="dingbat">
+            <xsl:with-param name="dingbat">nbsp</xsl:with-param>
+          </xsl:call-template>
+        </td>
+      </xsl:when>
+      <xsl:otherwise>
+        <td align="left">
+          <xsl:for-each select="$revauthor">
+            <xsl:apply-templates select="."/>
+            <xsl:if test="position() != last()">
+	      <xsl:text>, </xsl:text>
+	    </xsl:if>
+	  </xsl:for-each>
+        </td>
+      </xsl:otherwise>
+    </xsl:choose>
+  </tr>
+  <xsl:if test="$revremark">
+    <tr>
+      <td align="left" colspan="3">
+        <xsl:apply-templates select="$revremark"/>
+      </td>
+    </tr>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="revision/revnumber">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="revision/date">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="revision/authorinitials">
+  <xsl:text>, </xsl:text>
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="revision/authorinitials[1]" priority="2">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="revision/revremark">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="revision/revdescription">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="ackno">
+  <p class="{name(.)}">
+    <xsl:apply-templates/>
+  </p>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="highlights">
+  <xsl:call-template name="block.object"/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/callout.xsl
===================================================================
--- public/phoenix/utils/xhtml/callout.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/callout.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sverb="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Verbatim" xmlns:xverb="com.nwalsh.xalan.Verbatim" xmlns:lxslt="http://xml.apache.org/xslt" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="sverb xverb lxslt" version="1.0">
+
+<!-- ********************************************************************
+     $Id: callout.xsl,v 1.11 2003/08/07 17:04:43 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<lxslt:component prefix="xverb" functions="insertCallouts"/>
+
+<xsl:template match="programlistingco|screenco">
+  <xsl:variable name="verbatim" select="programlisting|screen"/>
+
+  <xsl:choose>
+    <xsl:when test="$use.extensions != '0'                     and $callouts.extension != '0'">
+      <xsl:variable name="rtf">
+        <xsl:apply-templates select="$verbatim">
+          <xsl:with-param name="suppress-numbers" select="'1'"/>
+        </xsl:apply-templates>
+      </xsl:variable>
+
+      <xsl:variable name="rtf-with-callouts">
+        <xsl:choose>
+          <xsl:when test="function-available('sverb:insertCallouts')">
+            <xsl:copy-of select="sverb:insertCallouts(areaspec,$rtf)"/>
+          </xsl:when>
+          <xsl:when test="function-available('xverb:insertCallouts')">
+            <xsl:copy-of select="xverb:insertCallouts(areaspec,$rtf)"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:message terminate="yes">
+              <xsl:text>No insertCallouts function is available.</xsl:text>
+            </xsl:message>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
+      <xsl:choose>
+        <xsl:when test="$verbatim/@linenumbering = 'numbered'                         and $linenumbering.extension != '0'">
+          <div class="{name(.)}">
+            <xsl:call-template name="number.rtf.lines">
+              <xsl:with-param name="rtf" select="$rtf-with-callouts"/>
+              <xsl:with-param name="pi.context" select="programlisting|screen"/>
+            </xsl:call-template>
+            <xsl:apply-templates select="calloutlist"/>
+          </div>
+        </xsl:when>
+        <xsl:otherwise>
+          <div class="{name(.)}">
+            <xsl:copy-of select="$rtf-with-callouts"/>
+            <xsl:apply-templates select="calloutlist"/>
+          </div>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <div class="{name(.)}">
+        <xsl:apply-templates/>
+      </div>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="areaspec|areaset|area">
+</xsl:template>
+
+<xsl:template match="areaset" mode="conumber">
+  <xsl:number count="area|areaset" format="1"/>
+</xsl:template>
+
+<xsl:template match="area" mode="conumber">
+  <xsl:number count="area|areaset" format="1"/>
+</xsl:template>
+
+<xsl:template match="co" name="co">
+  <!-- Support a single linkend in HTML -->
+  <xsl:variable name="targets" select="key('id', @linkends)"/>
+  <xsl:variable name="target" select="$targets[1]"/>
+  <xsl:choose>
+    <xsl:when test="$target">
+      <a>
+        <xsl:if test="@id">
+          <xsl:attribute name="id">
+            <xsl:value-of select="@id"/>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$target"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:apply-templates select="." mode="callout-bug"/>
+      </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="anchor"/>
+      <xsl:apply-templates select="." mode="callout-bug"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="coref">
+  <!-- tricky; this relies on the fact that we can process the "co" that's -->
+  <!-- "over there" as if it were "right here" -->
+
+  <xsl:variable name="co" select="key('id', @linkend)"/>
+  <xsl:choose>
+    <xsl:when test="not($co)">
+      <xsl:message>
+        <xsl:text>Error: coref link is broken: </xsl:text>
+        <xsl:value-of select="@linkend"/>
+      </xsl:message>
+    </xsl:when>
+    <xsl:when test="local-name($co) != 'co'">
+      <xsl:message>
+        <xsl:text>Error: coref doesn't point to a co: </xsl:text>
+        <xsl:value-of select="@linkend"/>
+      </xsl:message>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates select="$co"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="co" mode="callout-bug">
+  <xsl:call-template name="callout-bug">
+    <xsl:with-param name="conum">
+      <xsl:number count="co" level="any" from="programlisting|screen|literallayout|synopsis" format="1"/>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="callout-bug">
+  <xsl:param name="conum" select="1"/>
+
+  <xsl:choose>
+    <xsl:when test="$callout.graphics != 0                     and $conum &lt;= $callout.graphics.number.limit">
+      <img src="{$callout.graphics.path}{$conum}{$callout.graphics.extension}" alt="{$conum}" border="0"/>
+    </xsl:when>
+    <xsl:when test="$callout.unicode != 0                     and $conum &lt;= $callout.unicode.number.limit">
+      <xsl:choose>
+        <xsl:when test="$callout.unicode.start.character = 10102">
+          <xsl:choose>
+            <xsl:when test="$conum = 1">&#10102;</xsl:when>
+            <xsl:when test="$conum = 2">&#10103;</xsl:when>
+            <xsl:when test="$conum = 3">&#10104;</xsl:when>
+            <xsl:when test="$conum = 4">&#10105;</xsl:when>
+            <xsl:when test="$conum = 5">&#10106;</xsl:when>
+            <xsl:when test="$conum = 6">&#10107;</xsl:when>
+            <xsl:when test="$conum = 7">&#10108;</xsl:when>
+            <xsl:when test="$conum = 8">&#10109;</xsl:when>
+            <xsl:when test="$conum = 9">&#10110;</xsl:when>
+            <xsl:when test="$conum = 10">&#10111;</xsl:when>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:message>
+            <xsl:text>Don't know how to generate Unicode callouts </xsl:text>
+            <xsl:text>when $callout.unicode.start.character is </xsl:text>
+            <xsl:value-of select="$callout.unicode.start.character"/>
+          </xsl:message>
+          <xsl:text>(</xsl:text>
+          <xsl:value-of select="$conum"/>
+          <xsl:text>)</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:text>(</xsl:text>
+      <xsl:value-of select="$conum"/>
+      <xsl:text>)</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/changebars.xsl
===================================================================
--- public/phoenix/utils/xhtml/changebars.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/changebars.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<!-- ********************************************************************
+     $Id: changebars.xsl,v 1.12 2005/02/01 07:33:38 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+<xsl:import href="docbook.xsl"/>
+
+<xsl:param name="show.revisionflag" select="'1'"/>
+
+<xsl:template name="system.head.content">
+<xsl:param name="node" select="."/>
+
+<style type="text/css">
+<xsl:text>
+div.added    { background-color: #ffff99; }
+div.deleted  { text-decoration: line-through;
+               background-color: #FF7F7F; }
+div.changed  { background-color: #99ff99; }
+div.off      {  }
+
+span.added   { background-color: #ffff99; }
+span.deleted { text-decoration: line-through;
+               background-color: #FF7F7F; }
+span.changed { background-color: #99ff99; }
+span.off     {  }
+</xsl:text>
+</style>
+</xsl:template>
+
+<xsl:template match="*[@revisionflag]">
+  <xsl:choose>
+    <xsl:when test="local-name(.) = 'para'                     or local-name(.) = 'simpara'                     or local-name(.) = 'formalpara'                     or local-name(.) = 'section'                     or local-name(.) = 'sect1'                     or local-name(.) = 'sect2'                     or local-name(.) = 'sect3'                     or local-name(.) = 'sect4'                     or local-name(.) = 'sect5'                     or local-name(.) = 'chapter'                     or local-name(.) = 'preface'                     or local-name(.) = 'itemizedlist'                     or local-name(.) = 'varlistentry'                     or local-name(.) = 'glossary'                     or local-name(.) = 'bibliography'                     or local-name(.) = 'index'                     or local-name(.) = 'appendix'">
+      <div class="{@revisionflag}">
+	<xsl:apply-imports/>
+      </div>
+    </xsl:when>
+    <xsl:when test="local-name(.) = 'phrase'                     or local-name(.) = 'ulink'                     or local-name(.) = 'link'                     or local-name(.) = 'filename'                     or local-name(.) = 'literal'                     or local-name(.) = 'member'                     or local-name(.) = 'glossterm'                     or local-name(.) = 'sgmltag'                     or local-name(.) = 'quote'                     or local-name(.) = 'emphasis'                     or local-name(.) = 'command'                     or local-name(.) = 'xref'">
+      <span class="{@revisionflag}">
+	<xsl:apply-imports/>
+      </span>
+    </xsl:when>
+    <xsl:when test="local-name(.) = 'listitem'                     or local-name(.) = 'entry'                     or local-name(.) = 'title'">
+      <!-- nop; these are handled directly in the stylesheet -->
+      <xsl:apply-imports/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:message>
+	<xsl:text>Revisionflag on unexpected element: </xsl:text>
+	<xsl:value-of select="local-name(.)"/>
+	<xsl:text> (Assuming block)</xsl:text>
+      </xsl:message>
+      <div class="{@revisionflag}">
+	<xsl:apply-imports/>
+      </div>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/chunk-code.xsl
===================================================================
--- public/phoenix/utils/xhtml/chunk-code.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/chunk-code.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,767 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0" xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="exsl cf ng db">
+
+<!-- ********************************************************************
+     $Id: chunk-code.xsl,v 1.14 2005/08/04 07:03:47 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:param name="onechunk" select="0"/>
+<xsl:param name="refentry.separator" select="0"/>
+<xsl:param name="chunk.fast" select="0"/>
+
+<xsl:key name="genid" match="*" use="generate-id()"/>
+
+<!-- ==================================================================== -->
+
+<xsl:variable name="chunk.hierarchy">
+  <xsl:if test="$chunk.fast != 0">
+    <xsl:choose>
+      <xsl:when test="function-available('exsl:node-set')">
+        <xsl:message>Computing chunks...</xsl:message>
+        <xsl:apply-templates select="/*" mode="find.chunks"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:message>
+          <xsl:text>Fast chunking requires exsl:node-set(). </xsl:text>
+          <xsl:text>Using "slow" chunking.</xsl:text>
+        </xsl:message>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:if>
+</xsl:variable>
+
+<xsl:template match="*" mode="find.chunks">
+  <xsl:variable name="chunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$chunk != 0">
+      <cf:div class="{local-name(.)}" id="{generate-id()}">
+        <xsl:apply-templates select="*" mode="find.chunks"/>
+      </cf:div>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates select="*" mode="find.chunks"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="process-chunk-element">
+  <xsl:param name="content">
+    <xsl:apply-imports/>
+  </xsl:param>
+
+  <xsl:choose>
+    <xsl:when test="$chunk.fast != 0 and function-available('exsl:node-set')">
+      <xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
+      <xsl:variable name="genid" select="generate-id()"/>
+
+      <xsl:variable name="div" select="$chunks[@id=$genid]"/>
+
+      <xsl:variable name="prevdiv" select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
+      <xsl:variable name="prev" select="key('genid', $prevdiv/@id)"/>
+
+      <xsl:variable name="nextdiv" select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
+      <xsl:variable name="next" select="key('genid', $nextdiv/@id)"/>
+
+      <xsl:choose>
+        <xsl:when test="$onechunk != 0 and parent::*">
+          <xsl:copy-of select="$content"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="process-chunk">
+            <xsl:with-param name="prev" select="$prev"/>
+            <xsl:with-param name="next" select="$next"/>
+            <xsl:with-param name="content" select="$content"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="$onechunk != 0 and not(parent::*)">
+          <xsl:call-template name="chunk-all-sections">
+            <xsl:with-param name="content" select="$content"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="$onechunk != 0">
+          <xsl:copy-of select="$content"/>
+        </xsl:when>
+        <xsl:when test="$chunk.first.sections = 0">
+          <xsl:call-template name="chunk-first-section-with-parent">
+            <xsl:with-param name="content" select="$content"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="chunk-all-sections">
+            <xsl:with-param name="content" select="$content"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="process-chunk">
+  <xsl:param name="prev" select="."/>
+  <xsl:param name="next" select="."/>
+  <xsl:param name="content">
+    <xsl:apply-imports/>
+  </xsl:param>
+
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+  <xsl:variable name="chunkfn">
+    <xsl:if test="$ischunk='1'">
+      <xsl:apply-templates mode="chunk-filename" select="."/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:if test="$ischunk='0'">
+    <xsl:message>
+      <xsl:text>Error </xsl:text>
+      <xsl:value-of select="name(.)"/>
+      <xsl:text> is not a chunk!</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <xsl:variable name="filename">
+    <xsl:call-template name="make-relative-filename">
+      <xsl:with-param name="base.dir" select="$base.dir"/>
+      <xsl:with-param name="base.name" select="$chunkfn"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:call-template name="write.chunk">
+    <xsl:with-param name="filename" select="$filename"/>
+    <xsl:with-param name="content">
+      <xsl:call-template name="chunk-element-content">
+        <xsl:with-param name="prev" select="$prev"/>
+        <xsl:with-param name="next" select="$next"/>
+        <xsl:with-param name="content" select="$content"/>
+      </xsl:call-template>
+    </xsl:with-param>
+    <xsl:with-param name="quiet" select="$chunk.quietly"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="chunk-first-section-with-parent">
+  <xsl:param name="content">
+    <xsl:apply-imports/>
+  </xsl:param>
+
+  <!-- These xpath expressions are really hairy. The trick is to pick sections -->
+  <!-- that are not first children and are not the children of first children -->
+
+  <!-- Break these variables into pieces to work around
+       http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6063 -->
+
+  <xsl:variable name="prev-v1" select="(ancestor::sect1[$chunk.section.depth &gt; 0                                and preceding-sibling::sect1][1]               |ancestor::sect2[$chunk.section.depth &gt; 1                                and preceding-sibling::sect2                                and parent::sect1[preceding-sibling::sect1]][1]               |ancestor::sect3[$chunk.section.depth &gt; 2                                and preceding-sibling::sect3                                and parent::sect2[preceding-sibling::sect2]                                and ancestor::sect1[preceding-sibling::sect1]][1]               |ancestor::sect4[$chunk.section.depth &gt; 3                                and preceding-sibling::sect4                                and parent::sect3[preceding-sibling::sect2]                                and ancestor::sect2[preceding-sibling::sect2]                                and ancestor::sect1[preceding-sibling::sect1]][1]               |ancestor::sect5[$chunk.section.depth &gt; 4                                and preceding-sibling::sect5                                and parent::sect4[preceding-sibling::sect4]                                and ancestor::sect3[preceding-sibling::sect3]                                and ancestor::sect2[preceding-sibling::sect2]                                and ancestor::sect1[preceding-sibling::sect1]][1]               |ancestor::section[$chunk.section.depth &gt; count(ancestor::section)                                 and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
+
+  <xsl:variable name="prev-v2" select="(preceding::sect1[$chunk.section.depth &gt; 0                                and preceding-sibling::sect1][1]               |preceding::sect2[$chunk.section.depth &gt; 1                                and preceding-sibling::sect2                                and parent::sect1[preceding-sibling::sect1]][1]               |preceding::sect3[$chunk.section.depth &gt; 2                                and preceding-sibling::sect3                                and parent::sect2[preceding-sibling::sect2]                                and ancestor::sect1[preceding-sibling::sect1]][1]               |preceding::sect4[$chunk.section.depth &gt; 3                                and preceding-sibling::sect4                                and parent::sect3[preceding-sibling::sect2]                                and ancestor::sect2[preceding-sibling::sect2]                                and ancestor::sect1[preceding-sibling::sect1]][1]               |preceding::sect5[$chunk.section.depth &gt; 4                                and preceding-sibling::sect5                                and parent::sect4[preceding-sibling::sect4]                                and ancestor::sect3[preceding-sibling::sect3]                                and ancestor::sect2[preceding-sibling::sect2]                                and ancestor::sect1[preceding-sibling::sect1]][1]               |preceding::section[$chunk.section.depth &gt; count(ancestor::section)                                  and preceding-sibling::section                                  and not(ancestor::section[not(preceding-sibling::section)])][1])[last()]"/>
+
+  <xsl:variable name="prev" select="(preceding::book[1]              |preceding::preface[1]              |preceding::chapter[1]              |preceding::appendix[1]              |preceding::part[1]              |preceding::reference[1]              |preceding::refentry[1]              |preceding::colophon[1]              |preceding::article[1]              |preceding::bibliography[parent::article or parent::book or parent::part][1]              |preceding::glossary[parent::article or parent::book or parent::part][1]              |preceding::index[$generate.index != 0]                         [parent::article or parent::book or parent::part][1]              |preceding::setindex[$generate.index != 0][1]              |ancestor::set              |ancestor::book[1]              |ancestor::preface[1]              |ancestor::chapter[1]              |ancestor::appendix[1]              |ancestor::part[1]              |ancestor::reference[1]              |ancestor::article[1]              |$prev-v1              |$prev-v2)[last()]"/>
+
+  <xsl:variable name="next-v1" select="(following::sect1[$chunk.section.depth &gt; 0                                and preceding-sibling::sect1][1]               |following::sect2[$chunk.section.depth &gt; 1                                and preceding-sibling::sect2                                and parent::sect1[preceding-sibling::sect1]][1]               |following::sect3[$chunk.section.depth &gt; 2                                and preceding-sibling::sect3                                and parent::sect2[preceding-sibling::sect2]                                and ancestor::sect1[preceding-sibling::sect1]][1]               |following::sect4[$chunk.section.depth &gt; 3                                and preceding-sibling::sect4                                and parent::sect3[preceding-sibling::sect2]                                and ancestor::sect2[preceding-sibling::sect2]                                and ancestor::sect1[preceding-sibling::sect1]][1]               |following::sect5[$chunk.section.depth &gt; 4                                and preceding-sibling::sect5                                and parent::sect4[preceding-sibling::sect4]                                and ancestor::sect3[preceding-sibling::sect3]                                and ancestor::sect2[preceding-sibling::sect2]                                and ancestor::sect1[preceding-sibling::sect1]][1]               |following::section[$chunk.section.depth &gt; count(ancestor::section)                                  and preceding-sibling::section                                  and not(ancestor::section[not(preceding-sibling::section)])][1])[1]"/>
+
+  <xsl:variable name="next-v2" select="(descendant::sect1[$chunk.section.depth &gt; 0                                and preceding-sibling::sect1][1]               |descendant::sect2[$chunk.section.depth &gt; 1                                and preceding-sibling::sect2                                and parent::sect1[preceding-sibling::sect1]][1]               |descendant::sect3[$chunk.section.depth &gt; 2                                and preceding-sibling::sect3                                and parent::sect2[preceding-sibling::sect2]                                and ancestor::sect1[preceding-sibling::sect1]][1]               |descendant::sect4[$chunk.section.depth &gt; 3                                and preceding-sibling::sect4                                and parent::sect3[preceding-sibling::sect2]                                and ancestor::sect2[preceding-sibling::sect2]                                and ancestor::sect1[preceding-sibling::sect1]][1]               |descendant::sect5[$chunk.section.depth &gt; 4                                and preceding-sibling::sect5                                and parent::sect4[preceding-sibling::sect4]                                and ancestor::sect3[preceding-sibling::sect3]                                and ancestor::sect2[preceding-sibling::sect2]                                and ancestor::sect1[preceding-sibling::sect1]][1]               |descendant::section[$chunk.section.depth &gt; count(ancestor::section)                                  and preceding-sibling::section                                  and not(ancestor::section[not(preceding-sibling::section)])])[1]"/>
+
+  <xsl:variable name="next" select="(following::book[1]              |following::preface[1]              |following::chapter[1]              |following::appendix[1]              |following::part[1]              |following::reference[1]              |following::refentry[1]              |following::colophon[1]              |following::bibliography[parent::article or parent::book or parent::part][1]              |following::glossary[parent::article or parent::book or parent::part][1]              |following::index[$generate.index != 0]                         [parent::article or parent::book or parent::part][1]              |following::article[1]              |following::setindex[$generate.index != 0][1]              |descendant::book[1]              |descendant::preface[1]              |descendant::chapter[1]              |descendant::appendix[1]              |descendant::article[1]              |descendant::bibliography[parent::article or parent::book or parent::part][1]              |descendant::glossary[parent::article or parent::book or parent::part][1]              |descendant::index[$generate.index != 0]                         [parent::article or parent::book or parent::part][1]              |descendant::colophon[1]              |descendant::setindex[$generate.index != 0][1]              |descendant::part[1]              |descendant::reference[1]              |descendant::refentry[1]              |$next-v1              |$next-v2)[1]"/>
+
+  <xsl:call-template name="process-chunk">
+    <xsl:with-param name="prev" select="$prev"/>
+    <xsl:with-param name="next" select="$next"/>
+    <xsl:with-param name="content" select="$content"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="chunk-all-sections">
+  <xsl:param name="content">
+    <xsl:apply-imports/>
+  </xsl:param>
+
+  <xsl:variable name="prev-v1" select="(preceding::sect1[$chunk.section.depth &gt; 0][1]              |preceding::sect2[$chunk.section.depth &gt; 1][1]              |preceding::sect3[$chunk.section.depth &gt; 2][1]              |preceding::sect4[$chunk.section.depth &gt; 3][1]              |preceding::sect5[$chunk.section.depth &gt; 4][1]              |preceding::section[$chunk.section.depth &gt; count(ancestor::section)][1])[last()]"/>
+
+  <xsl:variable name="prev-v2" select="(ancestor::sect1[$chunk.section.depth &gt; 0][1]              |ancestor::sect2[$chunk.section.depth &gt; 1][1]              |ancestor::sect3[$chunk.section.depth &gt; 2][1]              |ancestor::sect4[$chunk.section.depth &gt; 3][1]              |ancestor::sect5[$chunk.section.depth &gt; 4][1]              |ancestor::section[$chunk.section.depth &gt; count(ancestor::section)][1])[last()]"/>
+
+  <xsl:variable name="prev" select="(preceding::book[1]              |preceding::preface[1]              |preceding::chapter[1]              |preceding::appendix[1]              |preceding::part[1]              |preceding::reference[1]              |preceding::refentry[1]              |preceding::colophon[1]              |preceding::article[1]              |preceding::bibliography[parent::article or parent::book or parent::part][1]              |preceding::glossary[parent::article or parent::book or parent::part][1]              |preceding::index[$generate.index != 0]                         [parent::article or parent::book or parent::part][1]              |preceding::setindex[$generate.index != 0][1]              |ancestor::set              |ancestor::book[1]              |ancestor::preface[1]              |ancestor::chapter[1]              |ancestor::appendix[1]              |ancestor::part[1]              |ancestor::reference[1]              |ancestor::article[1]              |$prev-v1              |$prev-v2)[last()]"/>
+
+  <xsl:variable name="next-v1" select="(following::sect1[$chunk.section.depth &gt; 0][1]              |following::sect2[$chunk.section.depth &gt; 1][1]              |following::sect3[$chunk.section.depth &gt; 2][1]              |following::sect4[$chunk.section.depth &gt; 3][1]              |following::sect5[$chunk.section.depth &gt; 4][1]              |following::section[$chunk.section.depth &gt; count(ancestor::section)][1])[1]"/>
+
+  <xsl:variable name="next-v2" select="(descendant::sect1[$chunk.section.depth &gt; 0][1]              |descendant::sect2[$chunk.section.depth &gt; 1][1]              |descendant::sect3[$chunk.section.depth &gt; 2][1]              |descendant::sect4[$chunk.section.depth &gt; 3][1]              |descendant::sect5[$chunk.section.depth &gt; 4][1]              |descendant::section[$chunk.section.depth                                    &gt; count(ancestor::section)][1])[1]"/>
+
+  <xsl:variable name="next" select="(following::book[1]              |following::preface[1]              |following::chapter[1]              |following::appendix[1]              |following::part[1]              |following::reference[1]              |following::refentry[1]              |following::colophon[1]              |following::bibliography[parent::article or parent::book or parent::part][1]              |following::glossary[parent::article or parent::book or parent::part][1]              |following::index[$generate.index != 0]                         [parent::article or parent::book][1]              |following::article[1]              |following::setindex[$generate.index != 0][1]              |descendant::book[1]              |descendant::preface[1]              |descendant::chapter[1]              |descendant::appendix[1]              |descendant::article[1]              |descendant::bibliography[parent::article or parent::book][1]              |descendant::glossary[parent::article or parent::book or parent::part][1]              |descendant::index[$generate.index != 0]                         [parent::article or parent::book][1]              |descendant::colophon[1]              |descendant::setindex[$generate.index != 0][1]              |descendant::part[1]              |descendant::reference[1]              |descendant::refentry[1]              |$next-v1              |$next-v2)[1]"/>
+
+  <xsl:call-template name="process-chunk">
+    <xsl:with-param name="prev" select="$prev"/>
+    <xsl:with-param name="next" select="$next"/>
+    <xsl:with-param name="content" select="$content"/>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="/">
+  <xsl:choose>
+    <xsl:when test="function-available('exsl:node-set')       and (*/self::ng:* or */self::db:*)">
+      <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
+	   toss the namespace and continue. Someday we'll reverse this logic
+	   and add the namespace to documents that don't have one.
+	   But not before the whole stylesheet has been converted to use
+	   namespaces. i.e., don't hold your breath -->
+      <xsl:message>Stripping NS from DocBook 5/NG document.</xsl:message>
+      <xsl:variable name="nons">
+	<xsl:apply-templates mode="stripNS"/>
+      </xsl:variable>
+      <xsl:message>Processing stripped document.</xsl:message>
+      <xsl:apply-templates select="exsl:node-set($nons)"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:choose>
+	<xsl:when test="$rootid != ''">
+	  <xsl:choose>
+	    <xsl:when test="count(key('id',$rootid)) = 0">
+	      <xsl:message terminate="yes">
+		<xsl:text>ID '</xsl:text>
+		<xsl:value-of select="$rootid"/>
+		<xsl:text>' not found in document.</xsl:text>
+	      </xsl:message>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:if test="$collect.xref.targets = 'yes' or        $collect.xref.targets = 'only'">
+		<xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
+	      </xsl:if>
+	      <xsl:if test="$collect.xref.targets != 'only'">
+		<xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
+		<xsl:if test="$tex.math.in.alt != ''">
+		  <xsl:apply-templates select="key('id',$rootid)" mode="collect.tex.math"/>
+		</xsl:if>
+		<xsl:if test="$generate.manifest != 0">
+		  <xsl:call-template name="generate.manifest">
+		    <xsl:with-param name="node" select="key('id',$rootid)"/>
+		  </xsl:call-template>
+		</xsl:if>
+	      </xsl:if>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:if test="$collect.xref.targets = 'yes' or    $collect.xref.targets = 'only'">
+	    <xsl:apply-templates select="/" mode="collect.targets"/>
+	  </xsl:if>
+	  <xsl:if test="$collect.xref.targets != 'only'">
+	    <xsl:apply-templates select="/" mode="process.root"/>
+	    <xsl:if test="$tex.math.in.alt != ''">
+	      <xsl:apply-templates select="/" mode="collect.tex.math"/>
+	    </xsl:if>
+	    <xsl:if test="$generate.manifest != 0">
+	      <xsl:call-template name="generate.manifest">
+		<xsl:with-param name="node" select="/"/>
+	      </xsl:call-template>
+	    </xsl:if>
+	  </xsl:if>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*" mode="process.root">
+  <xsl:apply-templates select="."/>
+</xsl:template>
+
+<!-- ====================================================================== -->
+
+<xsl:template match="set|book|part|preface|chapter|appendix                      |article                      |reference|refentry                      |book/glossary|article/glossary|part/glossary                      |book/bibliography|article/bibliography|part/bibliography                      |colophon">
+  <xsl:choose>
+    <xsl:when test="$onechunk != 0 and parent::*">
+      <xsl:apply-imports/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="process-chunk-element"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="sect1|sect2|sect3|sect4|sect5|section">
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="not(parent::*)">
+      <xsl:call-template name="process-chunk-element"/>
+    </xsl:when>
+    <xsl:when test="$ischunk = 0">
+      <xsl:apply-imports/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="process-chunk-element"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="setindex                      |book/index                      |article/index                      |part/index">
+  <!-- some implementations use completely empty index tags to indicate -->
+  <!-- where an automatically generated index should be inserted. so -->
+  <!-- if the index is completely empty, skip it. -->
+  <xsl:if test="count(*)&gt;0 or $generate.index != '0'">
+    <xsl:call-template name="process-chunk-element"/>
+  </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="make.lots">
+  <xsl:param name="toc.params" select="''"/>
+  <xsl:param name="toc"/>
+
+  <xsl:variable name="lots">
+    <xsl:if test="contains($toc.params, 'toc')">
+      <xsl:copy-of select="$toc"/>
+    </xsl:if>
+
+    <xsl:if test="contains($toc.params, 'figure')">
+      <xsl:choose>
+        <xsl:when test="$chunk.separate.lots != '0'">
+          <xsl:call-template name="make.lot.chunk">
+            <xsl:with-param name="type" select="'figure'"/>
+            <xsl:with-param name="lot">
+              <xsl:call-template name="list.of.titles">
+                <xsl:with-param name="titles" select="'figure'"/>
+                <xsl:with-param name="nodes" select=".//figure"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="list.of.titles">
+            <xsl:with-param name="titles" select="'figure'"/>
+            <xsl:with-param name="nodes" select=".//figure"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+
+    <xsl:if test="contains($toc.params, 'table')">
+      <xsl:choose>
+        <xsl:when test="$chunk.separate.lots != '0'">
+          <xsl:call-template name="make.lot.chunk">
+            <xsl:with-param name="type" select="'table'"/>
+            <xsl:with-param name="lot">
+              <xsl:call-template name="list.of.titles">
+                <xsl:with-param name="titles" select="'table'"/>
+                <xsl:with-param name="nodes" select=".//table"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="list.of.titles">
+            <xsl:with-param name="titles" select="'table'"/>
+            <xsl:with-param name="nodes" select=".//table"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+
+    <xsl:if test="contains($toc.params, 'example')">
+      <xsl:choose>
+        <xsl:when test="$chunk.separate.lots != '0'">
+          <xsl:call-template name="make.lot.chunk">
+            <xsl:with-param name="type" select="'example'"/>
+            <xsl:with-param name="lot">
+              <xsl:call-template name="list.of.titles">
+                <xsl:with-param name="titles" select="'example'"/>
+                <xsl:with-param name="nodes" select=".//example"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="list.of.titles">
+            <xsl:with-param name="titles" select="'example'"/>
+            <xsl:with-param name="nodes" select=".//example"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+
+    <xsl:if test="contains($toc.params, 'equation')">
+      <xsl:choose>
+        <xsl:when test="$chunk.separate.lots != '0'">
+          <xsl:call-template name="make.lot.chunk">
+            <xsl:with-param name="type" select="'equation'"/>
+            <xsl:with-param name="lot">
+              <xsl:call-template name="list.of.titles">
+                <xsl:with-param name="titles" select="'equation'"/>
+                <xsl:with-param name="nodes" select=".//equation"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="list.of.titles">
+            <xsl:with-param name="titles" select="'equation'"/>
+            <xsl:with-param name="nodes" select=".//equation"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+
+    <xsl:if test="contains($toc.params, 'procedure')">
+      <xsl:choose>
+        <xsl:when test="$chunk.separate.lots != '0'">
+          <xsl:call-template name="make.lot.chunk">
+            <xsl:with-param name="type" select="'procedure'"/>
+            <xsl:with-param name="lot">
+              <xsl:call-template name="list.of.titles">
+                <xsl:with-param name="titles" select="'procedure'"/>
+                <xsl:with-param name="nodes" select=".//procedure[title]"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="list.of.titles">
+            <xsl:with-param name="titles" select="'procedure'"/>
+            <xsl:with-param name="nodes" select=".//procedure[title]"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:if test="string($lots) != ''">
+    <xsl:choose>
+      <xsl:when test="$chunk.tocs.and.lots != 0 and not(parent::*)">
+        <xsl:call-template name="write.chunk">
+          <xsl:with-param name="filename">
+            <xsl:call-template name="make-relative-filename">
+              <xsl:with-param name="base.dir" select="$base.dir"/>
+              <xsl:with-param name="base.name">
+                <xsl:call-template name="dbhtml-dir"/>
+                <xsl:apply-templates select="." mode="recursive-chunk-filename">
+                  <xsl:with-param name="recursive" select="true()"/>
+                </xsl:apply-templates>
+                <xsl:text>-toc</xsl:text>
+                <xsl:value-of select="$html.ext"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="content">
+            <xsl:call-template name="chunk-element-content">
+              <xsl:with-param name="prev" select="/foo"/>
+              <xsl:with-param name="next" select="/foo"/>
+              <xsl:with-param name="nav.context" select="'toc'"/>
+              <xsl:with-param name="content">
+                <h1>
+                  <xsl:apply-templates select="." mode="object.title.markup"/>
+                </h1>
+                <xsl:copy-of select="$lots"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="quiet" select="$chunk.quietly"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="$lots"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="make.lot.chunk">
+  <xsl:param name="type" select="''"/>
+  <xsl:param name="lot"/>
+
+  <xsl:if test="string($lot) != ''">
+    <xsl:variable name="filename">
+      <xsl:call-template name="make-relative-filename">
+        <xsl:with-param name="base.dir" select="$base.dir"/>
+        <xsl:with-param name="base.name">
+          <xsl:call-template name="dbhtml-dir"/>
+          <xsl:value-of select="$type"/>
+          <xsl:text>-toc</xsl:text>
+          <xsl:value-of select="$html.ext"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:variable name="href">
+      <xsl:call-template name="make-relative-filename">
+        <xsl:with-param name="base.name">
+          <xsl:call-template name="dbhtml-dir"/>
+          <xsl:value-of select="$type"/>
+          <xsl:text>-toc</xsl:text>
+          <xsl:value-of select="$html.ext"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:call-template name="write.chunk">
+      <xsl:with-param name="filename" select="$filename"/>
+      <xsl:with-param name="content">
+        <xsl:call-template name="chunk-element-content">
+          <xsl:with-param name="prev" select="/foo"/>
+          <xsl:with-param name="next" select="/foo"/>
+          <xsl:with-param name="nav.context" select="'toc'"/>
+          <xsl:with-param name="content">
+            <xsl:copy-of select="$lot"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:with-param>
+      <xsl:with-param name="quiet" select="$chunk.quietly"/>
+    </xsl:call-template>
+    <!-- And output a link to this file -->
+    <div>
+      <xsl:attribute name="class">
+        <xsl:text>ListofTitles</xsl:text>
+      </xsl:attribute>
+      <a href="{$href}">
+        <xsl:call-template name="gentext">
+          <xsl:with-param name="key">
+            <xsl:choose>
+              <xsl:when test="$type='table'">ListofTables</xsl:when>
+              <xsl:when test="$type='figure'">ListofFigures</xsl:when>
+              <xsl:when test="$type='equation'">ListofEquations</xsl:when>
+              <xsl:when test="$type='example'">ListofExamples</xsl:when>
+              <xsl:when test="$type='procedure'">ListofProcedures</xsl:when>
+              <xsl:otherwise>ListofUnknown</xsl:otherwise>
+            </xsl:choose>
+          </xsl:with-param>
+        </xsl:call-template>
+      </a>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="in.other.chunk">
+  <xsl:param name="chunk" select="."/>
+  <xsl:param name="node" select="."/>
+
+  <xsl:variable name="is.chunk">
+    <xsl:call-template name="chunk">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+<!--
+  <xsl:message>
+    <xsl:text>in.other.chunk: </xsl:text>
+    <xsl:value-of select="name($chunk)"/>
+    <xsl:text> </xsl:text>
+    <xsl:value-of select="name($node)"/>
+    <xsl:text> </xsl:text>
+    <xsl:value-of select="$chunk = $node"/>
+    <xsl:text> </xsl:text>
+    <xsl:value-of select="$is.chunk"/>
+  </xsl:message>
+-->
+
+  <xsl:choose>
+    <xsl:when test="$chunk = $node">0</xsl:when>
+    <xsl:when test="$is.chunk = 1">1</xsl:when>
+    <xsl:when test="count($node) = 0">0</xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="in.other.chunk">
+        <xsl:with-param name="chunk" select="$chunk"/>
+        <xsl:with-param name="node" select="$node/parent::*"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="count.footnotes.in.this.chunk">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="footnotes" select="$node//footnote"/>
+  <xsl:param name="count" select="0"/>
+
+<!--
+  <xsl:message>
+    <xsl:text>count.footnotes.in.this.chunk: </xsl:text>
+    <xsl:value-of select="name($node)"/>
+  </xsl:message>
+-->
+
+  <xsl:variable name="in.other.chunk">
+    <xsl:call-template name="in.other.chunk">
+      <xsl:with-param name="chunk" select="$node"/>
+      <xsl:with-param name="node" select="$footnotes[1]"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="count($footnotes) = 0">
+      <xsl:value-of select="$count"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="$in.other.chunk != 0">
+          <xsl:call-template name="count.footnotes.in.this.chunk">
+            <xsl:with-param name="node" select="$node"/>
+            <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
+            <xsl:with-param name="count" select="$count"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="$footnotes[1]/ancestor::table                         |$footnotes[1]/ancestor::informaltable">
+          <xsl:call-template name="count.footnotes.in.this.chunk">
+            <xsl:with-param name="node" select="$node"/>
+            <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
+            <xsl:with-param name="count" select="$count"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="count.footnotes.in.this.chunk">
+            <xsl:with-param name="node" select="$node"/>
+            <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
+            <xsl:with-param name="count" select="$count + 1"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="process.footnotes.in.this.chunk">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="footnotes" select="$node//footnote"/>
+
+<!--
+  <xsl:message>process.footnotes.in.this.chunk</xsl:message>
+-->
+
+  <xsl:variable name="in.other.chunk">
+    <xsl:call-template name="in.other.chunk">
+      <xsl:with-param name="chunk" select="$node"/>
+      <xsl:with-param name="node" select="$footnotes[1]"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="count($footnotes) = 0">
+      <!-- nop -->
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="$in.other.chunk != 0">
+          <xsl:call-template name="process.footnotes.in.this.chunk">
+            <xsl:with-param name="node" select="$node"/>
+            <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="$footnotes[1]/ancestor::table                         |$footnotes[1]/ancestor::informaltable">
+          <xsl:call-template name="process.footnotes.in.this.chunk">
+            <xsl:with-param name="node" select="$node"/>
+            <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates select="$footnotes[1]" mode="process.footnote.mode"/>
+          <xsl:call-template name="process.footnotes.in.this.chunk">
+            <xsl:with-param name="node" select="$node"/>
+            <xsl:with-param name="footnotes" select="$footnotes[position() &gt; 1]"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="process.footnotes">
+  <xsl:variable name="footnotes" select=".//footnote"/>
+  <xsl:variable name="fcount">
+    <xsl:call-template name="count.footnotes.in.this.chunk">
+      <xsl:with-param name="node" select="."/>
+      <xsl:with-param name="footnotes" select="$footnotes"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+<!--
+  <xsl:message>
+    <xsl:value-of select="name(.)"/>
+    <xsl:text> fcount: </xsl:text>
+    <xsl:value-of select="$fcount"/>
+  </xsl:message>
+-->
+
+  <!-- Only bother to do this if there's at least one non-table footnote -->
+  <xsl:if test="$fcount &gt; 0">
+    <div class="footnotes">
+      <br/>
+      <hr width="100" align="left"/>
+      <xsl:call-template name="process.footnotes.in.this.chunk">
+        <xsl:with-param name="node" select="."/>
+        <xsl:with-param name="footnotes" select="$footnotes"/>
+      </xsl:call-template>
+    </div>
+  </xsl:if>
+
+  <!-- FIXME: When chunking, only the annotations actually used
+              in this chunk should be referenced. I don't think it
+	      does any harm to reference them all, but it adds
+	      unnecessary bloat to each chunk. -->
+  <xsl:if test="$annotation.support != 0 and //annotation">
+    <div class="annotation-list">
+      <div class="annotation-nocss">
+	<p>The following annotations are from this essay. You are seeing
+	them here because your browser doesn&#8217;t support the user-interface
+	techniques used to make them appear as &#8216;popups&#8217; on modern browsers.</p>
+      </div>
+
+      <xsl:apply-templates select="//annotation" mode="annotation-popup"/>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="process.chunk.footnotes">
+  <xsl:variable name="is.chunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+  <xsl:if test="$is.chunk = 1">
+    <xsl:call-template name="process.footnotes"/>
+  </xsl:if>
+</xsl:template>
+
+<!-- ====================================================================== -->
+
+<!-- Resolve xml:base attributes -->
+<xsl:template match="@fileref">
+  <!-- need a check for absolute urls -->
+  <xsl:choose>
+    <xsl:when test="contains(., ':')">
+      <!-- it has a uri scheme so it is an absolute uri -->
+      <xsl:value-of select="."/>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- its a relative uri -->
+      <xsl:call-template name="relative-uri">
+        <xsl:with-param name="destdir">
+          <xsl:call-template name="dbhtml-dir">
+            <xsl:with-param name="context" select=".."/>
+          </xsl:call-template>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/chunk-common.xsl
===================================================================
--- public/phoenix/utils/xhtml/chunk-common.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/chunk-common.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,963 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<!-- ********************************************************************
+     $Id: chunk-common.xsl,v 1.43 2005/05/26 07:27:34 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:template name="chunk">
+  <xsl:param name="node" select="."/>
+  <!-- returns 1 if $node is a chunk -->
+
+  <!-- ==================================================================== -->
+  <!-- What's a chunk?
+
+       The root element
+       appendix
+       article
+       bibliography  in article or part or book
+       book
+       chapter
+       colophon
+       glossary      in article or part or book
+       index         in article or part or book
+       part
+       preface
+       refentry
+       reference
+       sect{1,2,3,4,5}  if position()>1 && depth < chunk.section.depth
+       section          if position()>1 && depth < chunk.section.depth
+       set
+       setindex
+                                                                            -->
+  <!-- ==================================================================== -->
+
+<!--
+  <xsl:message>
+    <xsl:text>chunk: </xsl:text>
+    <xsl:value-of select="name($node)"/>
+    <xsl:text>(</xsl:text>
+    <xsl:value-of select="$node/@id"/>
+    <xsl:text>)</xsl:text>
+    <xsl:text> csd: </xsl:text>
+    <xsl:value-of select="$chunk.section.depth"/>
+    <xsl:text> cfs: </xsl:text>
+    <xsl:value-of select="$chunk.first.sections"/>
+    <xsl:text> ps: </xsl:text>
+    <xsl:value-of select="count($node/parent::section)"/>
+    <xsl:text> prs: </xsl:text>
+    <xsl:value-of select="count($node/preceding-sibling::section)"/>
+  </xsl:message>
+-->
+
+  <xsl:choose>
+    <xsl:when test="not($node/parent::*)">1</xsl:when>
+
+    <xsl:when test="local-name($node) = 'sect1'                     and $chunk.section.depth &gt;= 1                     and ($chunk.first.sections != 0                          or count($node/preceding-sibling::sect1) &gt; 0)">
+      <xsl:text>1</xsl:text>
+    </xsl:when>
+    <xsl:when test="local-name($node) = 'sect2'                     and $chunk.section.depth &gt;= 2                     and ($chunk.first.sections != 0                          or count($node/preceding-sibling::sect2) &gt; 0)">
+      <xsl:call-template name="chunk">
+        <xsl:with-param name="node" select="$node/parent::*"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="local-name($node) = 'sect3'                     and $chunk.section.depth &gt;= 3                     and ($chunk.first.sections != 0                          or count($node/preceding-sibling::sect3) &gt; 0)">
+      <xsl:call-template name="chunk">
+        <xsl:with-param name="node" select="$node/parent::*"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="local-name($node) = 'sect4'                     and $chunk.section.depth &gt;= 4                     and ($chunk.first.sections != 0                          or count($node/preceding-sibling::sect4) &gt; 0)">
+      <xsl:call-template name="chunk">
+        <xsl:with-param name="node" select="$node/parent::*"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="local-name($node) = 'sect5'                     and $chunk.section.depth &gt;= 5                     and ($chunk.first.sections != 0                          or count($node/preceding-sibling::sect5) &gt; 0)">
+      <xsl:call-template name="chunk">
+        <xsl:with-param name="node" select="$node/parent::*"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="local-name($node) = 'section'                     and $chunk.section.depth &gt;= count($node/ancestor::section)+1                     and ($chunk.first.sections != 0                          or count($node/preceding-sibling::section) &gt; 0)">
+      <xsl:call-template name="chunk">
+        <xsl:with-param name="node" select="$node/parent::*"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:when test="local-name($node)='preface'">1</xsl:when>
+    <xsl:when test="local-name($node)='chapter'">1</xsl:when>
+    <xsl:when test="local-name($node)='appendix'">1</xsl:when>
+    <xsl:when test="local-name($node)='article'">1</xsl:when>
+    <xsl:when test="local-name($node)='part'">1</xsl:when>
+    <xsl:when test="local-name($node)='reference'">1</xsl:when>
+    <xsl:when test="local-name($node)='refentry'">1</xsl:when>
+    <xsl:when test="local-name($node)='index' and $generate.index != 0                     and (local-name($node/parent::*) = 'article'                     or local-name($node/parent::*) = 'book'                     or local-name($node/parent::*) = 'part'                     )">1</xsl:when>
+    <xsl:when test="local-name($node)='bibliography'                     and (local-name($node/parent::*) = 'article'                     or local-name($node/parent::*) = 'book'                     or local-name($node/parent::*) = 'part'                     )">1</xsl:when>
+    <xsl:when test="local-name($node)='glossary'                     and (local-name($node/parent::*) = 'article'                     or local-name($node/parent::*) = 'book'                     or local-name($node/parent::*) = 'part'                     )">1</xsl:when>
+    <xsl:when test="local-name($node)='colophon'">1</xsl:when>
+    <xsl:when test="local-name($node)='book'">1</xsl:when>
+    <xsl:when test="local-name($node)='set'">1</xsl:when>
+    <xsl:when test="local-name($node)='setindex'">1</xsl:when>
+    <xsl:when test="local-name($node)='legalnotice'                     and $generate.legalnotice.link != 0">1</xsl:when>
+    <xsl:otherwise>0</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*" mode="chunk-filename">
+  <!-- returns the filename of a chunk -->
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+  <xsl:variable name="fn">
+    <xsl:apply-templates select="." mode="recursive-chunk-filename"/>
+  </xsl:variable>
+
+  <!--
+  <xsl:message>
+    <xsl:value-of select="$ischunk"/>
+    <xsl:text> (</xsl:text>
+    <xsl:value-of select="local-name(.)"/>
+    <xsl:text>) </xsl:text>
+    <xsl:value-of select="$fn"/>
+    <xsl:text>, </xsl:text>
+    <xsl:call-template name="dbhtml-dir"/>
+  </xsl:message>
+  -->
+
+  <!-- 2003-11-25 by ndw:
+       The following test used to read test="$ischunk != 0 and $fn != ''"
+       I've removed the ischunk part of the test so that href.to.uri and
+       href.from.uri will be fully qualified even if the source or target
+       isn't a chunk. I *think* that if $fn != '' then it's appropriate
+       to put the directory on the front, even if the element isn't a
+       chunk. I could be wrong. -->
+
+  <xsl:if test="$fn != ''">
+    <xsl:call-template name="dbhtml-dir"/>
+  </xsl:if>
+
+  <xsl:value-of select="$fn"/>
+  <!-- You can't add the html.ext here because dbhtml filename= may already -->
+  <!-- have added it. It really does have to be handled in the recursive template -->
+</xsl:template>
+
+<xsl:template match="*" mode="recursive-chunk-filename">
+  <xsl:param name="recursive" select="false()"/>
+
+  <!-- returns the filename of a chunk -->
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+  <xsl:variable name="dbhtml-filename">
+    <xsl:call-template name="dbhtml-filename"/>
+  </xsl:variable>
+
+  <xsl:variable name="filename">
+    <xsl:choose>
+      <xsl:when test="$dbhtml-filename != ''">
+        <xsl:value-of select="$dbhtml-filename"/>
+      </xsl:when>
+      <!-- if this is the root element, use the root.filename -->
+      <xsl:when test="not(parent::*) and $root.filename != ''">
+        <xsl:value-of select="$root.filename"/>
+        <xsl:value-of select="$html.ext"/>
+      </xsl:when>
+      <!-- Special case -->
+      <xsl:when test="self::legalnotice and $generate.legalnotice.link != 0">
+        <xsl:variable name="id">
+          <xsl:call-template name="object.id"/>
+        </xsl:variable>
+        <xsl:value-of select="concat('ln-',$id,$html.ext)"/>
+      </xsl:when>
+      <!-- if there's no dbhtml filename, and if we're to use IDs as -->
+      <!-- filenames, then use the ID to generate the filename. -->
+      <xsl:when test="@id and $use.id.as.filename != 0">
+        <xsl:value-of select="@id"/>
+        <xsl:value-of select="$html.ext"/>
+      </xsl:when>
+      <xsl:otherwise/>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$ischunk='0'">
+      <!-- if called on something that isn't a chunk, walk up... -->
+      <xsl:choose>
+        <xsl:when test="count(parent::*)&gt;0">
+          <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
+            <xsl:with-param name="recursive" select="$recursive"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <!-- unless there is no up, in which case return "" -->
+        <xsl:otherwise/>
+      </xsl:choose>
+    </xsl:when>
+
+    <xsl:when test="not($recursive) and $filename != ''">
+      <!-- if this chunk has an explicit name, use it -->
+      <xsl:value-of select="$filename"/>
+    </xsl:when>
+
+    <xsl:when test="self::set">
+      <xsl:value-of select="$root.filename"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::book">
+      <xsl:text>bk</xsl:text>
+      <xsl:number level="any" format="01"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::article">
+      <xsl:if test="/set">
+        <!-- in a set, make sure we inherit the right book info... -->
+        <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+
+      <xsl:text>ar</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::preface">
+      <xsl:if test="/set">
+        <!-- in a set, make sure we inherit the right book info... -->
+        <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+
+      <xsl:text>pr</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::chapter">
+      <xsl:if test="/set">
+        <!-- in a set, make sure we inherit the right book info... -->
+        <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+
+      <xsl:text>ch</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::appendix">
+      <xsl:if test="/set">
+        <!-- in a set, make sure we inherit the right book info... -->
+        <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+
+      <xsl:text>ap</xsl:text>
+      <xsl:number level="any" format="a" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::part">
+      <xsl:choose>
+        <xsl:when test="/set">
+          <!-- in a set, make sure we inherit the right book info... -->
+          <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
+            <xsl:with-param name="recursive" select="true()"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <xsl:text>pt</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::reference">
+      <xsl:choose>
+        <xsl:when test="/set">
+          <!-- in a set, make sure we inherit the right book info... -->
+          <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
+            <xsl:with-param name="recursive" select="true()"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <xsl:text>rn</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::refentry">
+      <xsl:choose>
+        <xsl:when test="parent::reference">
+          <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
+            <xsl:with-param name="recursive" select="true()"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <xsl:text>re</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::colophon">
+      <xsl:choose>
+        <xsl:when test="/set">
+          <!-- in a set, make sure we inherit the right book info... -->
+          <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
+            <xsl:with-param name="recursive" select="true()"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <xsl:text>co</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::sect1                     or self::sect2                     or self::sect3                     or self::sect4                     or self::sect5                     or self::section">
+      <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
+        <xsl:with-param name="recursive" select="true()"/>
+      </xsl:apply-templates>
+      <xsl:text>s</xsl:text>
+      <xsl:number format="01"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::bibliography">
+      <xsl:choose>
+        <xsl:when test="/set">
+          <!-- in a set, make sure we inherit the right book info... -->
+          <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
+            <xsl:with-param name="recursive" select="true()"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <xsl:text>bi</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::glossary">
+      <xsl:choose>
+        <xsl:when test="/set">
+          <!-- in a set, make sure we inherit the right book info... -->
+          <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
+            <xsl:with-param name="recursive" select="true()"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <xsl:text>go</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::index">
+      <xsl:choose>
+        <xsl:when test="/set">
+          <!-- in a set, make sure we inherit the right book info... -->
+          <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
+            <xsl:with-param name="recursive" select="true()"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <xsl:text>ix</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="self::setindex">
+      <xsl:text>si</xsl:text>
+      <xsl:number level="any" format="01" from="set"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:text>chunk-filename-error-</xsl:text>
+      <xsl:value-of select="name(.)"/>
+      <xsl:number level="any" format="01" from="set"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="href.target.uri">
+  <xsl:param name="object" select="."/>
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk">
+      <xsl:with-param name="node" select="$object"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:apply-templates mode="chunk-filename" select="$object"/>
+
+  <xsl:if test="$ischunk='0'">
+    <xsl:text>#</xsl:text>
+    <xsl:call-template name="object.id">
+      <xsl:with-param name="object" select="$object"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="href.target">
+  <xsl:param name="context" select="."/>
+  <xsl:param name="object" select="."/>
+
+  <xsl:variable name="href.to.uri">
+    <xsl:call-template name="href.target.uri">
+      <xsl:with-param name="object" select="$object"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="href.from.uri">
+    <xsl:call-template name="href.target.uri">
+      <xsl:with-param name="object" select="$context"/>
+    </xsl:call-template>
+  </xsl:variable>
+  
+  <!--
+  <xsl:message>href.to.uri: <xsl:value-of select="$href.to.uri"/></xsl:message>
+  <xsl:message>href.from.uri: <xsl:value-of select="$href.from.uri"/></xsl:message>
+  -->
+
+  <xsl:variable name="href.to">
+    <xsl:call-template name="trim.common.uri.paths">
+      <xsl:with-param name="uriA" select="$href.to.uri"/>
+      <xsl:with-param name="uriB" select="$href.from.uri"/>
+      <xsl:with-param name="return" select="'A'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="href.from">
+    <xsl:call-template name="trim.common.uri.paths">
+      <xsl:with-param name="uriA" select="$href.to.uri"/>
+      <xsl:with-param name="uriB" select="$href.from.uri"/>
+      <xsl:with-param name="return" select="'B'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="depth">
+    <xsl:call-template name="count.uri.path.depth">
+      <xsl:with-param name="filename" select="$href.from"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="href">
+    <xsl:call-template name="copy-string">
+      <xsl:with-param name="string" select="'../'"/>
+      <xsl:with-param name="count" select="$depth"/>
+    </xsl:call-template>
+    <xsl:value-of select="$href.to"/>
+  </xsl:variable>
+
+  <!--
+  <xsl:message>
+    <xsl:text>In </xsl:text>
+    <xsl:value-of select="name(.)"/>
+    <xsl:text> (</xsl:text>
+    <xsl:value-of select="$href.from"/>
+    <xsl:text>,</xsl:text>
+    <xsl:value-of select="$depth"/>
+    <xsl:text>) </xsl:text>
+    <xsl:value-of select="name($object)"/>
+    <xsl:text> href=</xsl:text>
+    <xsl:value-of select="$href"/>
+  </xsl:message>
+  -->
+
+  <xsl:value-of select="$href"/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="html.head">
+  <xsl:param name="prev" select="/foo"/>
+  <xsl:param name="next" select="/foo"/>
+  <xsl:variable name="this" select="."/>
+  <xsl:variable name="home" select="/*[1]"/>
+  <xsl:variable name="up" select="parent::*"/>
+
+  <head>
+    <xsl:call-template name="system.head.content"/>
+    <xsl:call-template name="head.content"/>
+
+    <xsl:if test="$home">
+      <link rel="start">
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$home"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:apply-templates select="$home" mode="object.title.markup.textonly"/>
+        </xsl:attribute>
+      </link>
+    </xsl:if>
+
+    <xsl:if test="$up">
+      <link rel="up">
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$up"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
+        </xsl:attribute>
+      </link>
+    </xsl:if>
+
+    <xsl:if test="$prev">
+      <link rel="prev">
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$prev"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
+        </xsl:attribute>
+      </link>
+    </xsl:if>
+
+    <xsl:if test="$next">
+      <link rel="next">
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$next"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
+        </xsl:attribute>
+      </link>
+    </xsl:if>
+
+    <xsl:if test="$html.extra.head.links != 0">
+      <xsl:for-each select="//part                             |//reference                             |//preface                             |//chapter                             |//article                             |//refentry                             |//appendix[not(parent::article)]|appendix                             |//glossary[not(parent::article)]|glossary                             |//index[not(parent::article)]|index">
+        <link rel="{local-name(.)}">
+          <xsl:attribute name="href">
+            <xsl:call-template name="href.target">
+              <xsl:with-param name="context" select="$this"/>
+              <xsl:with-param name="object" select="."/>
+            </xsl:call-template>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+            <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
+          </xsl:attribute>
+        </link>
+      </xsl:for-each>
+
+      <xsl:for-each select="section|sect1|refsection|refsect1">
+        <link>
+          <xsl:attribute name="rel">
+            <xsl:choose>
+              <xsl:when test="local-name($this) = 'section'                               or local-name($this) = 'refsection'">
+                <xsl:value-of select="'subsection'"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="'section'"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:attribute>
+          <xsl:attribute name="href">
+            <xsl:call-template name="href.target">
+              <xsl:with-param name="context" select="$this"/>
+              <xsl:with-param name="object" select="."/>
+            </xsl:call-template>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+            <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
+          </xsl:attribute>
+        </link>
+      </xsl:for-each>
+
+      <xsl:for-each select="sect2|sect3|sect4|sect5|refsect2|refsect3">
+        <link rel="subsection">
+          <xsl:attribute name="href">
+            <xsl:call-template name="href.target">
+              <xsl:with-param name="context" select="$this"/>
+              <xsl:with-param name="object" select="."/>
+            </xsl:call-template>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+            <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
+          </xsl:attribute>
+        </link>
+      </xsl:for-each>
+    </xsl:if>
+
+    <xsl:call-template name="user.head.content"/>
+  </head>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<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)                                         and $navig.showtitles != 0)                                     or count($next) &gt; 0"/>
+
+  <xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0'">
+    <div class="navheader">
+      <xsl:if test="$row1 or $row2">
+        <table width="100%" summary="Navigation header">
+          <xsl:if test="$row1">
+            <tr>
+              <th colspan="3" align="center">
+                <xsl:apply-templates select="." mode="object.title.markup"/>
+              </th>
+            </tr>
+          </xsl:if>
+
+          <xsl:if test="$row2">
+            <tr>
+              <td width="20%" align="left">
+                <xsl:if test="count($prev)&gt;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:call-template name="navig.content">
+                      <xsl:with-param name="direction" select="'prev'"/>
+                    </xsl:call-template>
+                  </a>
+                </xsl:if>
+                <xsl:text>&#160;</xsl:text>
+              </td>
+              <th width="60%" align="center">
+                <xsl:choose>
+                  <xsl:when test="count($up) &gt; 0                                   and generate-id($up) != generate-id($home)                                   and $navig.showtitles != 0">
+                    <xsl:apply-templates select="$up" mode="object.title.markup"/>
+                  </xsl:when>
+                  <xsl:otherwise>&#160;</xsl:otherwise>
+                </xsl:choose>
+              </th>
+              <td width="20%" align="right">
+                <xsl:text>&#160;</xsl:text>
+                <xsl:if test="count($next)&gt;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:call-template name="navig.content">
+                      <xsl:with-param name="direction" select="'next'"/>
+                    </xsl:call-template>
+                  </a>
+                </xsl:if>
+              </td>
+            </tr>
+          </xsl:if>
+        </table>
+      </xsl:if>
+      <xsl:if test="$header.rule != 0">
+        <hr/>
+      </xsl:if>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<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 and $navig.showtitles != 0)                                     or (generate-id($home) != generate-id(.)                                         or $nav.context = 'toc')                                     or ($chunk.tocs.and.lots != 0                                         and $nav.context != 'toc')                                     or ($next and $navig.showtitles != 0)"/>
+
+  <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
+    <div class="navfooter">
+      <xsl:if test="$footer.rule != 0">
+        <hr/>
+      </xsl:if>
+
+      <xsl:if test="$row1 or $row2">
+        <table width="100%" summary="Navigation footer">
+          <xsl:if test="$row1">
+            <tr>
+              <td width="40%" align="left">
+                <xsl:if test="count($prev)&gt;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:call-template name="navig.content">
+                      <xsl:with-param name="direction" select="'prev'"/>
+                    </xsl:call-template>
+                  </a>
+                </xsl:if>
+                <xsl:text>&#160;</xsl:text>
+              </td>
+              <td width="20%" align="center">
+                <xsl:choose>
+                  <xsl:when test="count($up)&gt;0                                   and generate-id($up) != generate-id($home)">
+                    <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 width="40%" align="right">
+                <xsl:text>&#160;</xsl:text>
+                <xsl:if test="count($next)&gt;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:call-template name="navig.content">
+                      <xsl:with-param name="direction" select="'next'"/>
+                    </xsl:call-template>
+                  </a>
+                </xsl:if>
+              </td>
+            </tr>
+          </xsl:if>
+
+          <xsl:if test="$row2">
+            <tr>
+              <td width="40%" align="left" valign="top">
+                <xsl:if test="$navig.showtitles != 0">
+                  <xsl:apply-templates select="$prev" mode="object.title.markup"/>
+                </xsl:if>
+                <xsl:text>&#160;</xsl:text>
+              </td>
+              <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:with-param name="recursive" select="true()"/>
+                      </xsl:apply-templates>
+                      <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>
+              <td width="40%" align="right" valign="top">
+                <xsl:text>&#160;</xsl:text>
+                <xsl:if test="$navig.showtitles != 0">
+                  <xsl:apply-templates select="$next" mode="object.title.markup"/>
+                </xsl:if>
+              </td>
+            </tr>
+          </xsl:if>
+        </table>
+      </xsl:if>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="navig.content">
+    <xsl:param name="direction" select="next"/>
+    <xsl:variable name="navtext">
+        <xsl:choose>
+            <xsl:when test="$direction = 'prev'">
+                <xsl:call-template name="gentext.nav.prev"/>
+            </xsl:when>
+            <xsl:when test="$direction = 'next'">
+                <xsl:call-template name="gentext.nav.next"/>
+            </xsl:when>
+            <xsl:when test="$direction = 'up'">
+                <xsl:call-template name="gentext.nav.up"/>
+            </xsl:when>
+            <xsl:when test="$direction = 'home'">
+                <xsl:call-template name="gentext.nav.home"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:text>xxx</xsl:text>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:variable>
+
+    <xsl:choose>
+        <xsl:when test="$navig.graphics != 0">
+            <img>
+                <xsl:attribute name="src">
+                    <xsl:value-of select="$navig.graphics.path"/>
+                    <xsl:value-of select="$direction"/>
+                    <xsl:value-of select="$navig.graphics.extension"/>
+                </xsl:attribute>
+                <xsl:attribute name="alt">
+                    <xsl:value-of select="$navtext"/>
+                </xsl:attribute>
+            </img>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:value-of select="$navtext"/>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="processing-instruction('dbhtml')">
+  <!-- nop -->
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="chunk-element-content">
+  <xsl:param name="prev"/>
+  <xsl:param name="next"/>
+  <xsl:param name="nav.context"/>
+  <xsl:param name="content">
+    <xsl:apply-imports/>
+  </xsl:param>
+
+  <xsl:call-template name="user.preroot"/>
+
+  <html>
+    <xsl:call-template name="html.head">
+      <xsl:with-param name="prev" select="$prev"/>
+      <xsl:with-param name="next" select="$next"/>
+    </xsl:call-template>
+
+    <body>
+      <xsl:call-template name="body.attributes"/>
+      <xsl:call-template name="user.header.navigation"/>
+
+      <xsl:call-template name="header.navigation">
+        <xsl:with-param name="prev" select="$prev"/>
+        <xsl:with-param name="next" select="$next"/>
+        <xsl:with-param name="nav.context" select="$nav.context"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="user.header.content"/>
+
+      <xsl:copy-of select="$content"/>
+
+      <xsl:call-template name="user.footer.content"/>
+
+      <xsl:call-template name="footer.navigation">
+        <xsl:with-param name="prev" select="$prev"/>
+        <xsl:with-param name="next" select="$next"/>
+        <xsl:with-param name="nav.context" select="$nav.context"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="user.footer.navigation"/>
+    </body>
+  </html>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/chunk.xsl
===================================================================
--- public/phoenix/utils/xhtml/chunk.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/chunk.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="exsl">
+
+<!-- ********************************************************************
+     $Id: chunk.xsl,v 1.30 2003/11/30 19:42:23 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:import href="docbook.xsl"/>
+<xsl:import href="chunk-common.xsl"/>
+<xsl:include href="manifest.xsl"/>
+
+<!-- Why is chunk-code now xsl:included?
+
+Suppose you want to customize *both* the chunking algorithm used *and* the
+presentation of some elements that may be chunks. In order to do that, you
+must get the order of imports "just right". The answer is to make your own
+copy of this file, where you replace the initial import of "docbook.xsl"
+with an import of your own base.xsl (that does its own import of docbook.xsl).
+
+Put the templates for changing the presentation of elements in your base.xsl.
+
+Put the templates that control chunking after the include of chunk-code.xsl.
+
+Voila! (Man I hope we can do this better in XSLT 2.0)
+
+-->
+
+<xsl:include href="chunk-code.xsl"/>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/chunker.xsl
===================================================================
--- public/phoenix/utils/xhtml/chunker.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/chunker.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,286 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://icl.com/saxon" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:xalanredirect="org.apache.xalan.xslt.extensions.Redirect" xmlns:exsl="http://exslt.org/common" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns="http://www.w3.org/1999/xhtml" version="1.1" exclude-result-prefixes="doc" extension-element-prefixes="saxon xalanredirect lxslt exsl">
+
+<!-- ********************************************************************
+     $Id: chunker.xsl,v 1.24 2003/11/30 19:42:23 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<!-- This stylesheet works with XSLT implementations that support -->
+<!-- exsl:document, saxon:output, or xalanredirect:write -->
+<!-- Note: Only Saxon 6.4.2 or later is supported. -->
+
+<xsl:param name="chunker.output.method" select="'xml'"/>
+<xsl:param name="chunker.output.encoding" select="'UTF-8'"/>
+<xsl:param name="chunker.output.indent" select="'no'"/>
+<xsl:param name="chunker.output.omit-xml-declaration" select="'no'"/>
+<xsl:param name="chunker.output.standalone" select="'no'"/>
+<xsl:param name="chunker.output.doctype-public" select="'-//W3C//DTD XHTML 1.0 Transitional//EN'"/>
+<xsl:param name="chunker.output.doctype-system" select="'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'"/>
+<xsl:param name="chunker.output.media-type" select="''"/>
+<xsl:param name="chunker.output.cdata-section-elements" select="''"/>
+
+<xsl:param name="saxon.character.representation" select="'entity;decimal'"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="make-relative-filename">
+  <xsl:param name="base.dir" select="'./'"/>
+  <xsl:param name="base.name" select="''"/>
+
+  <xsl:choose>
+    <!-- put Saxon first to work around a bug in libxslt -->
+    <xsl:when test="element-available('saxon:output')">
+      <!-- Saxon doesn't make the chunks relative -->
+      <xsl:value-of select="concat($base.dir,$base.name)"/>
+    </xsl:when>
+    <xsl:when test="element-available('exsl:document')">
+      <!-- EXSL document does make the chunks relative, I think -->
+      <xsl:choose>
+        <xsl:when test="count(parent::*) = 0">
+          <xsl:value-of select="concat($base.dir,$base.name)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$base.name"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:when test="element-available('xalanredirect:write')">
+      <!-- Xalan doesn't make the chunks relative -->
+      <xsl:value-of select="concat($base.dir,$base.name)"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:message terminate="yes">
+        <xsl:text>Don't know how to chunk with </xsl:text>
+        <xsl:value-of select="system-property('xsl:vendor')"/>
+      </xsl:message>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="write.chunk">
+  <xsl:param name="filename" select="''"/>
+  <xsl:param name="quiet" select="0"/>
+
+  <xsl:param name="method" select="$chunker.output.method"/>
+  <xsl:param name="encoding" select="$chunker.output.encoding"/>
+  <xsl:param name="indent" select="$chunker.output.indent"/>
+  <xsl:param name="omit-xml-declaration" select="$chunker.output.omit-xml-declaration"/>
+  <xsl:param name="standalone" select="$chunker.output.standalone"/>
+  <xsl:param name="doctype-public" select="$chunker.output.doctype-public"/>
+  <xsl:param name="doctype-system" select="$chunker.output.doctype-system"/>
+  <xsl:param name="media-type" select="$chunker.output.media-type"/>
+  <xsl:param name="cdata-section-elements" select="$chunker.output.cdata-section-elements"/>
+
+  <xsl:param name="content"/>
+
+  <xsl:if test="$quiet = 0">
+    <xsl:message>
+      <xsl:text>Writing </xsl:text>
+      <xsl:value-of select="$filename"/>
+      <xsl:if test="name(.) != ''">
+        <xsl:text> for </xsl:text>
+        <xsl:value-of select="name(.)"/>
+        <xsl:if test="@id">
+          <xsl:text>(</xsl:text>
+          <xsl:value-of select="@id"/>
+          <xsl:text>)</xsl:text>
+        </xsl:if>
+      </xsl:if>
+    </xsl:message>
+  </xsl:if>
+
+  <xsl:choose>
+    <xsl:when test="element-available('exsl:document')">
+      <xsl:choose>
+        <!-- Handle the permutations ... -->
+        <xsl:when test="$media-type != ''">
+          <xsl:choose>
+            <xsl:when test="$doctype-public != '' and $doctype-system != ''">
+              <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </exsl:document>
+            </xsl:when>
+            <xsl:when test="$doctype-public != '' and $doctype-system = ''">
+              <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-public="{$doctype-public}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </exsl:document>
+            </xsl:when>
+            <xsl:when test="$doctype-public = '' and $doctype-system != ''">
+              <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-system="{$doctype-system}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </exsl:document>
+            </xsl:when>
+            <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
+              <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </exsl:document>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:choose>
+            <xsl:when test="$doctype-public != '' and $doctype-system != ''">
+              <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </exsl:document>
+            </xsl:when>
+            <xsl:when test="$doctype-public != '' and $doctype-system = ''">
+              <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-public="{$doctype-public}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </exsl:document>
+            </xsl:when>
+            <xsl:when test="$doctype-public = '' and $doctype-system != ''">
+              <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-system="{$doctype-system}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </exsl:document>
+            </xsl:when>
+            <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
+              <exsl:document href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </exsl:document>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+
+    <xsl:when test="element-available('saxon:output')">
+      <xsl:choose>
+        <!-- Handle the permutations ... -->
+        <xsl:when test="$media-type != ''">
+          <xsl:choose>
+            <xsl:when test="$doctype-public != '' and $doctype-system != ''">
+              <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </saxon:output>
+            </xsl:when>
+            <xsl:when test="$doctype-public != '' and $doctype-system = ''">
+              <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-public="{$doctype-public}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </saxon:output>
+            </xsl:when>
+            <xsl:when test="$doctype-public = '' and $doctype-system != ''">
+              <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" doctype-system="{$doctype-system}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </saxon:output>
+            </xsl:when>
+            <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
+              <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" media-type="{$media-type}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </saxon:output>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:choose>
+            <xsl:when test="$doctype-public != '' and $doctype-system != ''">
+              <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-public="{$doctype-public}" doctype-system="{$doctype-system}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </saxon:output>
+            </xsl:when>
+            <xsl:when test="$doctype-public != '' and $doctype-system = ''">
+              <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-public="{$doctype-public}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </saxon:output>
+            </xsl:when>
+            <xsl:when test="$doctype-public = '' and $doctype-system != ''">
+              <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" doctype-system="{$doctype-system}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </saxon:output>
+            </xsl:when>
+            <xsl:otherwise><!-- $doctype-public = '' and $doctype-system = ''"> -->
+              <saxon:output saxon:character-representation="{$saxon.character.representation}" href="{$filename}" method="{$method}" encoding="{$encoding}" indent="{$indent}" omit-xml-declaration="{$omit-xml-declaration}" cdata-section-elements="{$cdata-section-elements}" standalone="{$standalone}">
+                <xsl:copy-of select="$content"/>
+              </saxon:output>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+
+    <xsl:when test="element-available('xalanredirect:write')">
+      <!-- Xalan uses xalanredirect -->
+      <xalanredirect:write file="{$filename}">
+        <xsl:copy-of select="$content"/>
+      </xalanredirect:write>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <!-- it doesn't matter since we won't be making chunks... -->
+      <xsl:message terminate="yes">
+        <xsl:text>Can't make chunks with </xsl:text>
+        <xsl:value-of select="system-property('xsl:vendor')"/>
+        <xsl:text>'s processor.</xsl:text>
+      </xsl:message>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="write.chunk.with.doctype">
+  <xsl:param name="filename" select="''"/>
+  <xsl:param name="quiet" select="0"/>
+
+  <xsl:param name="method" select="$chunker.output.method"/>
+  <xsl:param name="encoding" select="$chunker.output.encoding"/>
+  <xsl:param name="indent" select="$chunker.output.indent"/>
+  <xsl:param name="omit-xml-declaration" select="$chunker.output.omit-xml-declaration"/>
+  <xsl:param name="standalone" select="$chunker.output.standalone"/>
+  <xsl:param name="doctype-public" select="$chunker.output.doctype-public"/>
+  <xsl:param name="doctype-system" select="$chunker.output.doctype-system"/>
+  <xsl:param name="media-type" select="$chunker.output.media-type"/>
+  <xsl:param name="cdata-section-elements" select="$chunker.output.cdata-section-elements"/>
+
+  <xsl:param name="content"/>
+
+  <xsl:call-template name="write.chunk">
+    <xsl:with-param name="filename" select="$filename"/>
+    <xsl:with-param name="quiet" select="$quiet"/>
+    <xsl:with-param name="method" select="$method"/>
+    <xsl:with-param name="encoding" select="$encoding"/>
+    <xsl:with-param name="indent" select="$indent"/>
+    <xsl:with-param name="omit-xml-declaration" select="$omit-xml-declaration"/>
+    <xsl:with-param name="standalone" select="$standalone"/>
+    <xsl:with-param name="doctype-public" select="$doctype-public"/>
+    <xsl:with-param name="doctype-system" select="$doctype-system"/>
+    <xsl:with-param name="media-type" select="$media-type"/>
+    <xsl:with-param name="cdata-section-elements" select="$cdata-section-elements"/>
+    <xsl:with-param name="content" select="$content"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="write.text.chunk">
+  <xsl:param name="filename" select="''"/>
+  <xsl:param name="quiet" select="0"/>
+  <xsl:param name="method" select="'text'"/>
+  <xsl:param name="encoding" select="$chunker.output.encoding"/>
+  <xsl:param name="media-type" select="$chunker.output.media-type"/>
+  <xsl:param name="content"/>
+
+  <xsl:call-template name="write.chunk">
+    <xsl:with-param name="filename" select="$filename"/>
+    <xsl:with-param name="quiet" select="$quiet"/>
+    <xsl:with-param name="method" select="$method"/>
+    <xsl:with-param name="encoding" select="$encoding"/>
+    <xsl:with-param name="indent" select="'no'"/>
+    <xsl:with-param name="omit-xml-declaration" select="'no'"/>
+    <xsl:with-param name="standalone" select="'no'"/>
+    <xsl:with-param name="doctype-public"/>
+    <xsl:with-param name="doctype-system"/>
+    <xsl:with-param name="media-type" select="$media-type"/>
+    <xsl:with-param name="cdata-section-elements"/>
+    <xsl:with-param name="content" select="$content"/>
+  </xsl:call-template>
+</xsl:template>
+
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/chunkfast.xsl
===================================================================
--- public/phoenix/utils/xhtml/chunkfast.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/chunkfast.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="cf exsl">
+
+<!-- ********************************************************************
+     $Id: chunkfast.xsl,v 1.4 2005/08/04 07:03:47 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:import href="chunk.xsl"/>
+<xsl:param name="chunk.fast" select="1"/>
+
+<xsl:variable name="chunks" select="exsl:node-set($chunk.hierarchy)//cf:div"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="process-chunk-element">
+  <xsl:choose>
+    <xsl:when test="$chunk.fast != 0 and function-available('exsl:node-set')">
+      <xsl:variable name="genid" select="generate-id()"/>
+
+      <xsl:variable name="div" select="$chunks[@id=$genid]"/>
+
+      <xsl:variable name="prevdiv" select="($div/preceding-sibling::cf:div|$div/preceding::cf:div|$div/parent::cf:div)[last()]"/>
+      <xsl:variable name="prev" select="key('genid', $prevdiv/@id)"/>
+
+      <xsl:variable name="nextdiv" select="($div/following-sibling::cf:div|$div/following::cf:div|$div/cf:div)[1]"/>
+      <xsl:variable name="next" select="key('genid', $nextdiv/@id)"/>
+
+      <xsl:choose>
+        <xsl:when test="$onechunk != 0 and parent::*">
+          <xsl:apply-imports/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="process-chunk">
+            <xsl:with-param name="prev" select="$prev"/>
+            <xsl:with-param name="next" select="$next"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="$onechunk != 0 and not(parent::*)">
+          <xsl:call-template name="chunk-all-sections"/>
+        </xsl:when>
+        <xsl:when test="$onechunk != 0">
+          <xsl:apply-imports/>
+        </xsl:when>
+        <xsl:when test="$chunk.first.sections = 0">
+          <xsl:call-template name="chunk-first-section-with-parent"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="chunk-all-sections"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/chunktoc.xsl
===================================================================
--- public/phoenix/utils/xhtml/chunktoc.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/chunktoc.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,462 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="doc">
+
+<!-- ********************************************************************
+     $Id: chunktoc.xsl,v 1.6 2005/05/31 07:46:52 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:import href="docbook.xsl"/>
+<xsl:import href="chunk-common.xsl"/>
+
+<xsl:template name="chunk">
+  <xsl:param name="node" select="."/>
+  <!-- returns 1 if $node is a chunk -->
+
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id">
+      <xsl:with-param name="object" select="$node"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="chunks" select="document($chunk.toc,/)"/>
+
+  <xsl:choose>
+    <xsl:when test="$chunks//tocentry[@linkend=$id]">1</xsl:when>
+    <xsl:otherwise>0</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*" mode="chunk-filename">
+  <!-- returns the filename of a chunk -->
+
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="chunks" select="document($chunk.toc,/)"/>
+
+  <xsl:variable name="chunk" select="$chunks//tocentry[@linkend=$id]"/>
+  <xsl:variable name="filename">
+    <xsl:call-template name="dbhtml-filename">
+      <xsl:with-param name="pis" select="$chunk/processing-instruction('dbhtml')"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$chunk">
+      <xsl:value-of select="$filename"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates select="parent::*" mode="chunk-filename"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="process-chunk">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="chunks" select="document($chunk.toc,/)"/>
+
+  <xsl:variable name="chunk" select="$chunks//tocentry[@linkend=$id]"/>
+  <xsl:variable name="prev-id" select="($chunk/preceding::tocentry                          |$chunk/ancestor::tocentry)[last()]/@linkend"/>
+  <xsl:variable name="next-id" select="($chunk/following::tocentry                          |$chunk/child::tocentry)[1]/@linkend"/>
+
+  <xsl:variable name="prev" select="key('id',$prev-id)"/>
+  <xsl:variable name="next" select="key('id',$next-id)"/>
+
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+  <xsl:variable name="chunkfn">
+    <xsl:if test="$ischunk='1'">
+      <xsl:apply-templates mode="chunk-filename" select="."/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="filename">
+    <xsl:call-template name="make-relative-filename">
+      <xsl:with-param name="base.dir" select="$base.dir"/>
+      <xsl:with-param name="base.name" select="$chunkfn"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$ischunk = 0">
+      <xsl:apply-imports/>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:call-template name="write.chunk">
+        <xsl:with-param name="filename" select="$filename"/>
+        <xsl:with-param name="content">
+          <xsl:call-template name="chunk-element-content">
+            <xsl:with-param name="prev" select="$prev"/>
+            <xsl:with-param name="next" select="$next"/>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="quiet" select="$chunk.quietly"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="set">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="book">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="book/appendix">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="book/glossary">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="book/bibliography">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="dedication" mode="dedication">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="preface|chapter">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="part|reference">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="refentry">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="colophon">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="article">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="article/appendix">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="article/glossary">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="article/bibliography">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="sect1|sect2|sect3|sect4|sect5|section">
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$ischunk != 0">
+      <xsl:call-template name="process-chunk"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-imports/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="setindex                      |book/index                      |article/index">
+  <!-- some implementations use completely empty index tags to indicate -->
+  <!-- where an automatically generated index should be inserted. so -->
+  <!-- if the index is completely empty, skip it. -->
+  <xsl:if test="count(*)&gt;0 or $generate.index != '0'">
+    <xsl:call-template name="process-chunk"/>
+  </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="/">
+  <xsl:choose>
+    <xsl:when test="$chunk.toc = ''">
+      <xsl:message terminate="yes">
+        <xsl:text>The chunk.toc file is not set.</xsl:text>
+      </xsl:message>
+    </xsl:when>
+
+    <xsl:when test="$rootid != ''">
+      <xsl:choose>
+        <xsl:when test="count(key('id',$rootid)) = 0">
+          <xsl:message terminate="yes">
+            <xsl:text>ID '</xsl:text>
+            <xsl:value-of select="$rootid"/>
+            <xsl:text>' not found in document.</xsl:text>
+          </xsl:message>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates select="key('id',$rootid)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:apply-templates select="/" mode="process.root"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*" mode="process.root">
+  <xsl:apply-templates select="."/>
+</xsl:template>
+
+<xsl:template name="make.lots">
+  <xsl:param name="toc.params" select="''"/>
+  <xsl:param name="toc"/>
+
+  <xsl:variable name="lots">
+    <xsl:if test="contains($toc.params, 'toc')">
+      <xsl:copy-of select="$toc"/>
+    </xsl:if>
+
+    <xsl:if test="contains($toc.params, 'figure')">
+      <xsl:choose>
+        <xsl:when test="$chunk.separate.lots != '0'">
+          <xsl:call-template name="make.lot.chunk">
+            <xsl:with-param name="type" select="'figure'"/>
+            <xsl:with-param name="lot">
+              <xsl:call-template name="list.of.titles">
+                <xsl:with-param name="titles" select="'figure'"/>
+                <xsl:with-param name="nodes" select=".//figure"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="list.of.titles">
+            <xsl:with-param name="titles" select="'figure'"/>
+            <xsl:with-param name="nodes" select=".//figure"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+
+    <xsl:if test="contains($toc.params, 'table')">
+      <xsl:choose>
+        <xsl:when test="$chunk.separate.lots != '0'">
+          <xsl:call-template name="make.lot.chunk">
+            <xsl:with-param name="type" select="'table'"/>
+            <xsl:with-param name="lot">
+              <xsl:call-template name="list.of.titles">
+                <xsl:with-param name="titles" select="'table'"/>
+                <xsl:with-param name="nodes" select=".//table"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="list.of.titles">
+            <xsl:with-param name="titles" select="'table'"/>
+            <xsl:with-param name="nodes" select=".//table"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+
+    <xsl:if test="contains($toc.params, 'example')">
+      <xsl:choose>
+        <xsl:when test="$chunk.separate.lots != '0'">
+          <xsl:call-template name="make.lot.chunk">
+            <xsl:with-param name="type" select="'example'"/>
+            <xsl:with-param name="lot">
+              <xsl:call-template name="list.of.titles">
+                <xsl:with-param name="titles" select="'example'"/>
+                <xsl:with-param name="nodes" select=".//example"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="list.of.titles">
+            <xsl:with-param name="titles" select="'example'"/>
+            <xsl:with-param name="nodes" select=".//example"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+
+    <xsl:if test="contains($toc.params, 'equation')">
+      <xsl:choose>
+        <xsl:when test="$chunk.separate.lots != '0'">
+          <xsl:call-template name="make.lot.chunk">
+            <xsl:with-param name="type" select="'equation'"/>
+            <xsl:with-param name="lot">
+              <xsl:call-template name="list.of.titles">
+                <xsl:with-param name="titles" select="'equation'"/>
+                <xsl:with-param name="nodes" select=".//equation"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="list.of.titles">
+            <xsl:with-param name="titles" select="'equation'"/>
+            <xsl:with-param name="nodes" select=".//equation"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+
+    <xsl:if test="contains($toc.params, 'procedure')">
+      <xsl:choose>
+        <xsl:when test="$chunk.separate.lots != '0'">
+          <xsl:call-template name="make.lot.chunk">
+            <xsl:with-param name="type" select="'procedure'"/>
+            <xsl:with-param name="lot">
+              <xsl:call-template name="list.of.titles">
+                <xsl:with-param name="titles" select="'procedure'"/>
+                <xsl:with-param name="nodes" select=".//procedure[title]"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="list.of.titles">
+            <xsl:with-param name="titles" select="'procedure'"/>
+            <xsl:with-param name="nodes" select=".//procedure[title]"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:if test="string($lots) != ''">
+    <xsl:choose>
+      <xsl:when test="$chunk.tocs.and.lots != 0 and not(parent::*)">
+        <xsl:call-template name="write.chunk">
+          <xsl:with-param name="filename">
+            <xsl:call-template name="make-relative-filename">
+              <xsl:with-param name="base.dir" select="$base.dir"/>
+              <xsl:with-param name="base.name">
+                <xsl:call-template name="dbhtml-dir"/>
+                <xsl:apply-templates select="." mode="recursive-chunk-filename">
+                  <xsl:with-param name="recursive" select="true()"/>
+                </xsl:apply-templates>
+                <xsl:text>-toc</xsl:text>
+                <xsl:value-of select="$html.ext"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="content">
+            <xsl:call-template name="chunk-element-content">
+              <xsl:with-param name="prev" select="/foo"/>
+              <xsl:with-param name="next" select="/foo"/>
+              <xsl:with-param name="nav.context" select="'toc'"/>
+              <xsl:with-param name="content">
+                <h1>
+                  <xsl:apply-templates select="." mode="object.title.markup"/>
+                </h1>
+                <xsl:copy-of select="$lots"/>
+              </xsl:with-param>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="quiet" select="$chunk.quietly"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="$lots"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="make.lot.chunk">
+  <xsl:param name="type" select="''"/>
+  <xsl:param name="lot"/>
+
+  <xsl:if test="string($lot) != ''">
+    <xsl:variable name="filename">
+      <xsl:call-template name="make-relative-filename">
+        <xsl:with-param name="base.dir" select="$base.dir"/>
+        <xsl:with-param name="base.name">
+          <xsl:call-template name="dbhtml-dir"/>
+          <xsl:value-of select="$type"/>
+          <xsl:text>-toc</xsl:text>
+          <xsl:value-of select="$html.ext"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:variable name="href">
+      <xsl:call-template name="make-relative-filename">
+        <xsl:with-param name="base.name">
+          <xsl:call-template name="dbhtml-dir"/>
+          <xsl:value-of select="$type"/>
+          <xsl:text>-toc</xsl:text>
+          <xsl:value-of select="$html.ext"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:call-template name="write.chunk">
+      <xsl:with-param name="filename" select="$filename"/>
+      <xsl:with-param name="content">
+        <xsl:call-template name="chunk-element-content">
+          <xsl:with-param name="prev" select="/foo"/>
+          <xsl:with-param name="next" select="/foo"/>
+          <xsl:with-param name="nav.context" select="'toc'"/>
+          <xsl:with-param name="content">
+            <xsl:copy-of select="$lot"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:with-param>
+      <xsl:with-param name="quiet" select="$chunk.quietly"/>
+    </xsl:call-template>
+    <!-- And output a link to this file -->
+    <div>
+      <xsl:attribute name="class">
+        <xsl:text>ListofTitles</xsl:text>
+      </xsl:attribute>
+      <a href="{$href}">
+        <xsl:call-template name="gentext">
+          <xsl:with-param name="key">
+            <xsl:choose>
+              <xsl:when test="$type='table'">ListofTables</xsl:when>
+              <xsl:when test="$type='figure'">ListofFigures</xsl:when>
+              <xsl:when test="$type='equation'">ListofEquations</xsl:when>
+              <xsl:when test="$type='example'">ListofExamples</xsl:when>
+              <xsl:when test="$type='procedure'">ListofProcedures</xsl:when>
+              <xsl:otherwise>ListofUnknown</xsl:otherwise>
+            </xsl:choose>
+          </xsl:with-param>
+        </xsl:call-template>
+      </a>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/component.xsl
===================================================================
--- public/phoenix/utils/xhtml/component.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/component.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,333 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<!-- ********************************************************************
+     $Id: component.xsl,v 1.25 2005/07/11 15:30:25 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:template name="component.title">
+  <xsl:param name="node" select="."/>
+
+  <xsl:variable name="level">
+    <xsl:choose>
+      <xsl:when test="ancestor::section">
+	<xsl:value-of select="count(ancestor::section)+1"/>
+      </xsl:when>
+      <xsl:when test="ancestor::sect5">6</xsl:when>
+      <xsl:when test="ancestor::sect4">5</xsl:when>
+      <xsl:when test="ancestor::sect3">4</xsl:when>
+      <xsl:when test="ancestor::sect2">3</xsl:when>
+      <xsl:when test="ancestor::sect1">2</xsl:when>
+      <xsl:otherwise>1</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <!-- Let's handle the case where a component (bibliography, for example)
+       occurs inside a section; will we need parameters for this? -->
+
+  <xsl:element name="h{$level+1}" namespace="http://www.w3.org/1999/xhtml">
+    <xsl:attribute name="class">title</xsl:attribute>
+    <xsl:call-template name="anchor">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="conditional" select="0"/>
+    </xsl:call-template>
+    <xsl:apply-templates select="$node" mode="object.title.markup">
+      <xsl:with-param name="allow-anchors" select="1"/>
+    </xsl:apply-templates>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template name="component.subtitle">
+  <xsl:param name="node" select="."/>
+  <xsl:variable name="subtitle" select="($node/docinfo/subtitle                         |$node/info/subtitle                         |$node/prefaceinfo/subtitle                         |$node/chapterinfo/subtitle                         |$node/appendixinfo/subtitle                         |$node/articleinfo/subtitle                         |$node/artheader/subtitle                         |$node/subtitle)[1]"/>
+
+  <xsl:if test="$subtitle">
+    <h3 class="subtitle">
+      <i>
+        <xsl:apply-templates select="$node" mode="object.subtitle.markup"/>
+      </i>
+    </h3>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="component.separator">
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="dedication" mode="dedication">
+  <div class="{name(.)}">
+    <xsl:call-template name="language.attribute"/>
+    <xsl:call-template name="dedication.titlepage"/>
+    <xsl:apply-templates/>
+    <xsl:call-template name="process.footnotes"/>
+  </div>
+</xsl:template>
+
+<xsl:template match="dedication/title" mode="titlepage.mode" priority="2">
+  <xsl:call-template name="component.title">
+    <xsl:with-param name="node" select="ancestor::dedication[1]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="dedication/subtitle" mode="titlepage.mode" priority="2">
+  <xsl:call-template name="component.subtitle">
+    <xsl:with-param name="node" select="ancestor::dedication[1]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="dedication"/> <!-- see mode="dedication" -->
+<xsl:template match="dedication/title"/>
+<xsl:template match="dedication/subtitle"/>
+<xsl:template match="dedication/titleabbrev"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="colophon">
+  <div class="{name(.)}">
+    <xsl:call-template name="language.attribute"/>
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="component.separator"/>
+    <xsl:call-template name="component.title"/>
+    <xsl:call-template name="component.subtitle"/>
+
+    <xsl:apply-templates/>
+    <xsl:call-template name="process.footnotes"/>
+  </div>
+</xsl:template>
+
+<xsl:template match="colophon/title"/>
+<xsl:template match="colophon/subtitle"/>
+<xsl:template match="colophon/titleabbrev"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="preface">
+  <div class="{name(.)}">
+    <xsl:call-template name="language.attribute"/>
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="component.separator"/>
+    <xsl:call-template name="preface.titlepage"/>
+
+    <xsl:variable name="toc.params">
+      <xsl:call-template name="find.path.params">
+        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:if test="contains($toc.params, 'toc')">
+      <xsl:call-template name="component.toc">
+        <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+      </xsl:call-template>
+      <xsl:call-template name="component.toc.separator"/>
+    </xsl:if>
+    <xsl:apply-templates/>
+    <xsl:call-template name="process.footnotes"/>
+  </div>
+</xsl:template>
+
+<xsl:template match="preface/title" mode="titlepage.mode" priority="2">
+  <xsl:call-template name="component.title">
+    <xsl:with-param name="node" select="ancestor::preface[1]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="preface/subtitle                      |preface/prefaceinfo/subtitle                      |preface/info/subtitle                      |preface/docinfo/subtitle" mode="titlepage.mode" priority="2">
+  <xsl:call-template name="component.subtitle">
+    <xsl:with-param name="node" select="ancestor::preface[1]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="preface/docinfo|prefaceinfo"/>
+<xsl:template match="preface/title"/>
+<xsl:template match="preface/titleabbrev"/>
+<xsl:template match="preface/subtitle"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="chapter">
+  <div class="{name(.)}">
+    <xsl:call-template name="language.attribute"/>
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="component.separator"/>
+    <xsl:call-template name="chapter.titlepage"/>
+
+    <xsl:variable name="toc.params">
+      <xsl:call-template name="find.path.params">
+        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:if test="contains($toc.params, 'toc')">
+      <xsl:call-template name="component.toc">
+        <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+      </xsl:call-template>
+      <xsl:call-template name="component.toc.separator"/>
+    </xsl:if>
+    <xsl:apply-templates/>
+    <xsl:call-template name="process.footnotes"/>
+  </div>
+</xsl:template>
+
+<xsl:template match="chapter/title" mode="titlepage.mode" priority="2">
+  <xsl:call-template name="component.title">
+    <xsl:with-param name="node" select="ancestor::chapter[1]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="chapter/subtitle                      |chapter/chapterinfo/subtitle                      |chapter/info/subtitle                      |chapter/docinfo/subtitle" mode="titlepage.mode" priority="2">
+  <xsl:call-template name="component.subtitle">
+    <xsl:with-param name="node" select="ancestor::chapter[1]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="chapter/docinfo|chapterinfo"/>
+<xsl:template match="chapter/title"/>
+<xsl:template match="chapter/titleabbrev"/>
+<xsl:template match="chapter/subtitle"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="appendix">
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+  <div class="{name(.)}">
+    <xsl:call-template name="language.attribute"/>
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:choose>
+      <xsl:when test="parent::article and $ischunk = 0">
+        <xsl:call-template name="section.heading">
+          <xsl:with-param name="level" select="1"/>
+          <xsl:with-param name="title">
+            <xsl:apply-templates select="." mode="object.title.markup"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="component.separator"/>
+        <xsl:call-template name="appendix.titlepage"/>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:variable name="toc.params">
+      <xsl:call-template name="find.path.params">
+        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:if test="contains($toc.params, 'toc')">
+      <xsl:call-template name="component.toc">
+        <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+      </xsl:call-template>
+      <xsl:call-template name="component.toc.separator"/>
+    </xsl:if>
+
+    <xsl:apply-templates/>
+
+    <xsl:if test="not(parent::article) or $ischunk != 0">
+      <xsl:call-template name="process.footnotes"/>
+    </xsl:if>
+  </div>
+</xsl:template>
+
+<xsl:template match="appendix/title" mode="titlepage.mode" priority="2">
+  <xsl:call-template name="component.title">
+    <xsl:with-param name="node" select="ancestor::appendix[1]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="appendix/subtitle                      |appendix/appendixinfo/subtitle                      |appendix/info/subtitle                      |appendix/docinfo/subtitle" mode="titlepage.mode" priority="2">
+  <xsl:call-template name="component.subtitle">
+    <xsl:with-param name="node" select="ancestor::appendix[1]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="appendix/docinfo|appendixinfo"/>
+<xsl:template match="appendix/title"/>
+<xsl:template match="appendix/titleabbrev"/>
+<xsl:template match="appendix/subtitle"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="article">
+  <div class="{name(.)}">
+    <xsl:call-template name="language.attribute"/>
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="article.titlepage"/>
+
+    <xsl:variable name="toc.params">
+      <xsl:call-template name="find.path.params">
+        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:call-template name="make.lots">
+      <xsl:with-param name="toc.params" select="$toc.params"/>
+      <xsl:with-param name="toc">
+        <xsl:call-template name="component.toc">
+          <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+        </xsl:call-template>
+      </xsl:with-param>
+    </xsl:call-template>
+
+    <xsl:apply-templates/>
+    <xsl:call-template name="process.footnotes"/>
+  </div>
+</xsl:template>
+
+<xsl:template match="article/title" mode="titlepage.mode" priority="2">
+  <xsl:call-template name="component.title">
+    <xsl:with-param name="node" select="ancestor::article[1]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="article/subtitle                      |article/articleinfo/subtitle                      |article/info/subtitle                      |article/artheader/subtitle" mode="titlepage.mode" priority="2">
+  <xsl:call-template name="component.subtitle">
+    <xsl:with-param name="node" select="ancestor::article[1]"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="article/artheader|article/articleinfo"/>
+<xsl:template match="article/title"/>
+<xsl:template match="article/titleabbrev"/>
+<xsl:template match="article/subtitle"/>
+
+<!-- ==================================================================== -->
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/division.xsl
===================================================================
--- public/phoenix/utils/xhtml/division.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/division.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<!-- ********************************************************************
+     $Id: division.xsl,v 1.9 2005/07/10 08:27:58 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:template match="set">
+  <div class="{name(.)}">
+    <xsl:call-template name="language.attribute"/>
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="set.titlepage"/>
+
+    <xsl:call-template name="make.lots">
+      <xsl:with-param name="toc.params">
+        <xsl:call-template name="find.path.params">
+          <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+        </xsl:call-template>
+      </xsl:with-param>
+      <xsl:with-param name="toc">
+        <xsl:call-template name="set.toc"/>
+      </xsl:with-param>
+    </xsl:call-template>
+
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
+<xsl:template match="set/setinfo"/>
+<xsl:template match="set/title"/>
+<xsl:template match="set/titleabbrev"/>
+<xsl:template match="set/subtitle"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="book">
+  <div class="{name(.)}">
+    <xsl:call-template name="language.attribute"/>
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="book.titlepage"/>
+
+    <xsl:apply-templates select="dedication" mode="dedication"/>
+
+    <xsl:call-template name="make.lots">
+      <xsl:with-param name="toc.params">
+        <xsl:call-template name="find.path.params">
+          <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+        </xsl:call-template>
+      </xsl:with-param>
+      <xsl:with-param name="toc">
+        <xsl:call-template name="division.toc"/>
+      </xsl:with-param>
+    </xsl:call-template>
+
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
+<xsl:template match="book/bookinfo"/>
+<xsl:template match="book/title"/>
+<xsl:template match="book/titleabbrev"/>
+<xsl:template match="book/subtitle"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="part">
+  <div class="{name(.)}">
+    <xsl:call-template name="language.attribute"/>
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="part.titlepage"/>
+
+    <xsl:variable name="toc.params">
+      <xsl:call-template name="find.path.params">
+        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:if test="not(partintro) and contains($toc.params, 'toc')">
+      <xsl:call-template name="division.toc"/>
+    </xsl:if>
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
+<xsl:template match="part" mode="make.part.toc">
+  <xsl:call-template name="division.toc"/>
+</xsl:template>
+
+<xsl:template match="reference" mode="make.part.toc">
+  <xsl:call-template name="division.toc"/>
+</xsl:template>
+
+<xsl:template match="part/docinfo"/>
+<xsl:template match="part/partinfo"/>
+<xsl:template match="part/title"/>
+<xsl:template match="part/titleabbrev"/>
+<xsl:template match="part/subtitle"/>
+
+<xsl:template match="partintro">
+  <div class="{name(.)}">
+    <xsl:call-template name="language.attribute"/>
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="partintro.titlepage"/>
+    <xsl:apply-templates/>
+
+    <xsl:variable name="toc.params">
+      <xsl:call-template name="find.path.params">
+        <xsl:with-param name="node" select="parent::*"/>
+        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:if test="contains($toc.params, 'toc')">
+      <!-- not ancestor::part because partintro appears in reference -->
+      <xsl:apply-templates select="parent::*" mode="make.part.toc"/>
+    </xsl:if>
+    <xsl:call-template name="process.footnotes"/>
+  </div>
+</xsl:template>
+
+<xsl:template match="partintro/title"/>
+<xsl:template match="partintro/titleabbrev"/>
+<xsl:template match="partintro/subtitle"/>
+
+<xsl:template match="partintro/title" mode="partintro.title.mode">
+  <h2>
+    <xsl:apply-templates/>
+  </h2>
+</xsl:template>
+
+<xsl:template match="partintro/subtitle" mode="partintro.title.mode">
+  <h3>
+    <i><xsl:apply-templates/></i>
+  </h3>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="book" mode="division.number">
+  <xsl:number from="set" count="book" format="1."/>
+</xsl:template>
+
+<xsl:template match="part" mode="division.number">
+  <xsl:number from="book" count="part" format="I."/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="division.title">
+  <xsl:param name="node" select="."/>
+
+  <h1>
+    <xsl:attribute name="class">title</xsl:attribute>
+    <xsl:call-template name="anchor">
+      <xsl:with-param name="node" select="$node"/>
+      <xsl:with-param name="conditional" select="0"/>
+    </xsl:call-template>
+    <xsl:apply-templates select="$node" mode="object.title.markup">
+      <xsl:with-param name="allow-anchors" select="1"/>
+    </xsl:apply-templates>
+  </h1>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/docbook.xsl
===================================================================
--- public/phoenix/utils/xhtml/docbook.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/docbook.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,456 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="db ng exsl" version="1.0">
+
+<xsl:output method="xml" encoding="UTF-8" indent="no" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+
+<!-- ********************************************************************
+     $Id: docbook.xsl,v 1.38 2005/07/14 17:04:24 nwalsh Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:include href="../VERSION"/>
+<xsl:include href="param.xsl"/>
+<xsl:include href="../lib/lib.xsl"/>
+<xsl:include href="../common/l10n.xsl"/>
+<xsl:include href="../common/common.xsl"/>
+<xsl:include href="../common/labels.xsl"/>
+<xsl:include href="../common/titles.xsl"/>
+<xsl:include href="../common/subtitles.xsl"/>
+<xsl:include href="../common/gentext.xsl"/>
+<xsl:include href="../common/targets.xsl"/>
+<xsl:include href="../common/olink.xsl"/>
+<xsl:include href="../common/pi.xsl"/>
+<xsl:include href="autotoc.xsl"/>
+<xsl:include href="autoidx.xsl"/>
+<xsl:include href="lists.xsl"/>
+<xsl:include href="callout.xsl"/>
+<xsl:include href="verbatim.xsl"/>
+<xsl:include href="graphics.xsl"/>
+<xsl:include href="xref.xsl"/>
+<xsl:include href="formal.xsl"/>
+<xsl:include href="table.xsl"/>
+<xsl:include href="htmltbl.xsl"/>
+<xsl:include href="sections.xsl"/>
+<xsl:include href="inline.xsl"/>
+<xsl:include href="footnote.xsl"/>
+<xsl:include href="html.xsl"/>
+<xsl:include href="info.xsl"/>
+<xsl:include href="keywords.xsl"/>
+<xsl:include href="division.xsl"/>
+<xsl:include href="toc.xsl"/>
+<xsl:include href="index.xsl"/>
+<xsl:include href="refentry.xsl"/>
+<xsl:include href="math.xsl"/>
+<xsl:include href="admon.xsl"/>
+<xsl:include href="component.xsl"/>
+<xsl:include href="biblio.xsl"/>
+<xsl:include href="glossary.xsl"/>
+<xsl:include href="block.xsl"/>
+<xsl:include href="task.xsl"/>
+<xsl:include href="qandaset.xsl"/>
+<xsl:include href="synop.xsl"/>
+<xsl:include href="titlepage.xsl"/>
+<xsl:include href="titlepage.templates.xsl"/>
+<xsl:include href="pi.xsl"/>
+<xsl:include href="ebnf.xsl"/>
+<xsl:include href="chunker.xsl"/>
+<xsl:include href="html-rtf.xsl"/>
+<xsl:include href="docbookng.xsl"/>
+<xsl:include href="annotations.xsl"/>
+
+<xsl:param name="stylesheet.result.type" select="'xhtml'"/>
+<xsl:param name="htmlhelp.output" select="0"/>
+
+<!-- ==================================================================== -->
+
+<xsl:key name="id" match="*" use="@id|@xml:id"/>
+<xsl:key name="gid" match="*" use="generate-id()"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*">
+  <xsl:message>
+    <xsl:text>No template matches </xsl:text>
+    <xsl:value-of select="name(.)"/>
+    <xsl:if test="parent::*">
+      <xsl:text> in </xsl:text>
+      <xsl:value-of select="name(parent::*)"/>
+    </xsl:if>
+    <xsl:text>.</xsl:text>
+  </xsl:message>
+
+  <span class="ERROR">
+    <xsl:text>&lt;</xsl:text>
+    <xsl:value-of select="name(.)"/>
+    <xsl:text>&gt;</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>&lt;/</xsl:text>
+    <xsl:value-of select="name(.)"/>
+    <xsl:text>&gt;</xsl:text>
+  </span>
+</xsl:template>
+
+<xsl:template match="text()">
+  <xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template name="body.attributes">
+<!-- no apply-templates; make it empty -->
+</xsl:template>
+
+<xsl:template name="head.content">
+  <xsl:param name="node" select="."/>
+  <xsl:param name="title">
+    <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
+  </xsl:param>
+
+  <title>
+    <xsl:copy-of select="$title"/>
+  </title>
+
+  <xsl:if test="$html.stylesheet != ''">
+    <xsl:call-template name="output.html.stylesheets">
+      <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
+    </xsl:call-template>
+  </xsl:if>
+
+  <xsl:if test="$link.mailto.url != ''">
+    <link rev="made" href="{$link.mailto.url}"/>
+  </xsl:if>
+
+  <xsl:if test="$html.base != ''">
+    <base href="{$html.base}"/>
+  </xsl:if>
+
+  <meta name="generator" content="DocBook XSL Stylesheets V{$VERSION}"/>
+
+  <xsl:if test="$generate.meta.abstract != 0">
+    <xsl:variable name="info" select="(articleinfo                                       |bookinfo                                       |prefaceinfo                                       |chapterinfo                                       |appendixinfo                                       |sectioninfo                                       |sect1info                                       |sect2info                                       |sect3info                                       |sect4info                                       |sect5info                                       |referenceinfo                                       |refentryinfo                                       |partinfo                                       |info                                       |docinfo)[1]"/>
+    <xsl:if test="$info and $info/abstract">
+      <meta name="description">
+        <xsl:attribute name="content">
+          <xsl:for-each select="$info/abstract[1]/*">
+            <xsl:value-of select="."/>
+            <xsl:if test="position() &lt; last()">
+              <xsl:text> </xsl:text>
+            </xsl:if>
+          </xsl:for-each>
+        </xsl:attribute>
+      </meta>
+    </xsl:if>
+  </xsl:if>
+
+  <xsl:if test="($draft.mode = 'yes' or                 ($draft.mode = 'maybe' and                 ancestor-or-self::*[@status][1]/@status = 'draft'))                 and $draft.watermark.image != ''">
+    <style type="text/css"><xsl:text>
+body { background-image: url('</xsl:text>
+<xsl:value-of select="$draft.watermark.image"/><xsl:text>');
+       background-repeat: no-repeat;
+       background-position: top left;
+       /* The following properties make the watermark "fixed" on the page. */
+       /* I think that's just a bit too distracting for the reader... */
+       /* background-attachment: fixed; */
+       /* background-position: center center; */
+     }</xsl:text>
+    </style>
+  </xsl:if>
+  <xsl:apply-templates select="." mode="head.keywords.content"/>
+</xsl:template>
+
+<xsl:template name="output.html.stylesheets">
+  <xsl:param name="stylesheets" select="''"/>
+
+  <xsl:choose>
+    <xsl:when test="contains($stylesheets, ' ')">
+      <link rel="stylesheet" href="{substring-before($stylesheets, ' ')}">
+        <xsl:if test="$html.stylesheet.type != ''">
+          <xsl:attribute name="type">
+            <xsl:value-of select="$html.stylesheet.type"/>
+          </xsl:attribute>
+        </xsl:if>
+      </link>
+      <xsl:call-template name="output.html.stylesheets">
+        <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$stylesheets != ''">
+      <link rel="stylesheet" href="{$stylesheets}">
+        <xsl:if test="$html.stylesheet.type != ''">
+          <xsl:attribute name="type">
+            <xsl:value-of select="$html.stylesheet.type"/>
+          </xsl:attribute>
+        </xsl:if>
+      </link>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template match="*" mode="head.keywords.content">
+  <xsl:apply-templates select="chapterinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="appendixinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="prefaceinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="bookinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="setinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="articleinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="artheader/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect1info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect2info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect3info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect4info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="sect5info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refsect1info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refsect2info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refsect3info/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="bibliographyinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="glossaryinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="indexinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="refentryinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="partinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="referenceinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="docinfo/keywordset" mode="html.header"/>
+  <xsl:apply-templates select="info/keywordset" mode="html.header"/>
+
+  <xsl:if test="$inherit.keywords != 0                 and parent::*">
+    <xsl:apply-templates select="parent::*" mode="head.keywords.content"/>
+  </xsl:if>
+</xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template name="system.head.content">
+  <xsl:param name="node" select="."/>
+
+  <!-- FIXME: When chunking, only the annotations actually used
+              in this chunk should be referenced. I don't think it
+	      does any harm to reference them all, but it adds
+	      unnecessary bloat to each chunk. -->
+  <xsl:if test="$annotation.support != 0 and //annotation">
+    <xsl:call-template name="add.annotation.links"/>
+    <script type="text/javascript">
+      <xsl:text>
+// Create PopupWindow objects</xsl:text>
+      <xsl:for-each select="//annotation">
+	<xsl:text>
+var popup_</xsl:text>
+	<xsl:value-of select="generate-id(.)"/>
+	<xsl:text> = new PopupWindow("popup-</xsl:text>
+	<xsl:value-of select="generate-id(.)"/>
+	<xsl:text>");
+</xsl:text>
+	<xsl:text>popup_</xsl:text>
+	<xsl:value-of select="generate-id(.)"/>
+	<xsl:text>.offsetY = 15;
+</xsl:text>
+	<xsl:text>popup_</xsl:text>
+	<xsl:value-of select="generate-id(.)"/>
+	<xsl:text>.autoHide();
+</xsl:text>
+      </xsl:for-each>
+    </script>
+
+    <style type="text/css">
+      <xsl:value-of select="$annotation.css"/>
+    </style>
+  </xsl:if>
+
+  <!-- system.head.content is like user.head.content, except that
+       it is called before head.content. This is important because it
+       means, for example, that <style> elements output by system.head.content
+       have a lower CSS precedence than the users stylesheet. -->
+</xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template name="user.preroot">
+  <!-- Pre-root output, can be used to output comments and PIs. -->
+  <!-- This must not output any element content! -->
+</xsl:template>
+
+<xsl:template name="user.head.content">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.header.navigation">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.header.content">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.footer.content">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template name="user.footer.navigation">
+  <xsl:param name="node" select="."/>
+</xsl:template>
+
+<xsl:template match="/">
+  <xsl:choose>
+    <xsl:when test="function-available('exsl:node-set')       and (*/self::ng:* or */self::db:*)">
+      <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
+	   toss the namespace and continue. Someday we'll reverse this logic
+	   and add the namespace to documents that don't have one.
+	   But not before the whole stylesheet has been converted to use
+	   namespaces. i.e., don't hold your breath -->
+      <xsl:message>Stripping NS from DocBook 5/NG document.</xsl:message>
+      <xsl:variable name="nons">
+	<xsl:apply-templates mode="stripNS"/>
+      </xsl:variable>
+      <xsl:message>Processing stripped document.</xsl:message>
+      <xsl:apply-templates select="exsl:node-set($nons)"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:choose>
+	<xsl:when test="$rootid != ''">
+	  <xsl:choose>
+	    <xsl:when test="count(key('id',$rootid)) = 0">
+	      <xsl:message terminate="yes">
+		<xsl:text>ID '</xsl:text>
+		<xsl:value-of select="$rootid"/>
+		<xsl:text>' not found in document.</xsl:text>
+	      </xsl:message>
+	    </xsl:when>
+	    <xsl:otherwise>
+	      <xsl:if test="$collect.xref.targets = 'yes' or               $collect.xref.targets = 'only'">
+		<xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
+	      </xsl:if>
+	      <xsl:if test="$collect.xref.targets != 'only'">
+		<xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
+		<xsl:if test="$tex.math.in.alt != ''">
+		  <xsl:apply-templates select="key('id',$rootid)" mode="collect.tex.math"/>
+		</xsl:if>
+	      </xsl:if>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:if test="$collect.xref.targets = 'yes' or           $collect.xref.targets = 'only'">
+	    <xsl:apply-templates select="/" mode="collect.targets"/>
+	  </xsl:if>
+	  <xsl:if test="$collect.xref.targets != 'only'">
+	    <xsl:apply-templates select="/" mode="process.root"/>
+	    <xsl:if test="$tex.math.in.alt != ''">
+	      <xsl:apply-templates select="/" mode="collect.tex.math"/>
+	    </xsl:if>
+	  </xsl:if>
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*" mode="process.root">
+  <xsl:variable name="doc" select="self::*"/>
+
+  <xsl:call-template name="user.preroot"/>
+  <xsl:call-template name="root.messages"/>
+
+  <html>
+    <head>
+      <xsl:call-template name="system.head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:call-template name="head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:call-template name="user.head.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+    </head>
+    <body>
+      <xsl:call-template name="body.attributes"/>
+      <xsl:call-template name="user.header.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+      <xsl:apply-templates select="."/>
+      <xsl:call-template name="user.footer.content">
+        <xsl:with-param name="node" select="$doc"/>
+      </xsl:call-template>
+    </body>
+  </html>
+</xsl:template>
+
+<xsl:template name="root.messages">
+  <!-- redefine this any way you'd like to output messages -->
+  <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="chunk">
+  <xsl:param name="node" select="."/>
+
+  <!-- The default is that we are not chunking... -->
+  <xsl:text>0</xsl:text>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*" mode="stripNS">
+  <xsl:choose>
+    <xsl:when test="self::ng:* or self::db:*">
+      <xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">
+	<xsl:copy-of select="@*"/>
+	<xsl:apply-templates mode="stripNS"/>
+      </xsl:element>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy>
+	<xsl:copy-of select="@*"/>
+	<xsl:apply-templates mode="stripNS"/>
+      </xsl:copy>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="ng:link|db:link" mode="stripNS">
+  <xsl:variable xmlns:xlink="http://www.w3.org/1999/xlink" name="href" select="@xlink:href|@href"/>
+  <xsl:choose>
+    <xsl:when test="$href != '' and not(starts-with($href,'#'))">
+      <ulink url="{$href}">
+	<xsl:for-each select="@*">
+	  <xsl:if test="local-name(.) != 'href'">
+	    <xsl:copy/>
+	  </xsl:if>
+	</xsl:for-each>
+	<xsl:apply-templates mode="stripNS"/>
+      </ulink>
+    </xsl:when>
+    <xsl:when test="$href != '' and starts-with($href,'#')">
+      <link linkend="{substring-after($href,'#')}">
+	<xsl:for-each select="@*">
+	  <xsl:if test="local-name(.) != 'href'">
+	    <xsl:copy/>
+	  </xsl:if>
+	</xsl:for-each>
+	<xsl:apply-templates mode="stripNS"/>
+      </link>
+    </xsl:when>
+    <xsl:otherwise>
+      <link>
+	<xsl:copy-of select="@*"/>
+	<xsl:apply-templates mode="stripNS"/>
+      </link>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="comment()|processing-instruction()|text()" mode="stripNS">
+  <xsl:copy/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/docbookng.xsl
===================================================================
--- public/phoenix/utils/xhtml/docbookng.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/docbookng.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<xsl:template match="info"/>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/ebnf.xsl
===================================================================
--- public/phoenix/utils/xhtml/ebnf.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/ebnf.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,326 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="doc" version="1.0">
+
+<!-- ********************************************************************
+     $Id: ebnf.xsl,v 1.9 2003/04/12 21:08:45 nwalsh Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<doc:reference xmlns="">
+<referenceinfo xmlns="http://www.w3.org/1999/xhtml">
+<releaseinfo role="meta">
+$Id: ebnf.xsl,v 1.9 2003/04/12 21:08:45 nwalsh Exp $
+</releaseinfo>
+<author><surname>Walsh</surname>
+<firstname>Norman</firstname></author>
+<copyright><year>1999</year><year>2000</year>
+<holder>Norman Walsh</holder>
+</copyright>
+</referenceinfo>
+<title xmlns="http://www.w3.org/1999/xhtml">HTML EBNF Reference</title>
+
+<partintro xmlns="http://www.w3.org/1999/xhtml">
+<section><title>Introduction</title>
+
+<para>This is technical reference documentation for the DocBook XSL
+Stylesheets; it documents (some of) the parameters, templates, and
+other elements of the stylesheets.</para>
+
+<para>This reference describes the templates and parameters relevant
+to formatting EBNF markup.</para>
+
+<para>This is not intended to be <quote>user</quote> documentation.
+It is provided for developers writing customization layers for the
+stylesheets, and for anyone who's interested in <quote>how it
+works</quote>.</para>
+
+<para>Although I am trying to be thorough, this documentation is known
+to be incomplete. Don't forget to read the source, too :-)</para>
+</section>
+</partintro>
+</doc:reference>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="productionset">
+  <table width="100%" cellpadding="5">
+    <xsl:if test="$ebnf.table.bgcolor != ''">
+      <xsl:attribute name="bgcolor">
+	<xsl:value-of select="$ebnf.table.bgcolor"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="$ebnf.table.border != 0">
+      <xsl:attribute name="border">1</xsl:attribute>
+    </xsl:if>
+    <xsl:attribute name="class">
+      <xsl:value-of select="name(.)"/>
+    </xsl:attribute>
+    <xsl:attribute name="summary">
+      <xsl:text>EBNF</xsl:text>
+      <xsl:if test="title">
+	<xsl:text> for </xsl:text>
+	<xsl:value-of select="title"/>
+      </xsl:if>
+    </xsl:attribute>
+
+    <xsl:if test="title">
+      <tr>
+	<th align="left" valign="top" class="{name(.)}">
+	  <xsl:apply-templates select="title"/>
+	</th>
+      </tr>
+    </xsl:if>
+    <tr>
+      <td>
+	<table border="0" width="99%" cellpadding="0">
+	  <xsl:if test="$ebnf.table.bgcolor != ''">
+	    <xsl:attribute name="bgcolor">
+	      <xsl:value-of select="$ebnf.table.bgcolor"/>
+	    </xsl:attribute>
+	  </xsl:if>
+	  <xsl:attribute name="class">
+	    <xsl:value-of select="name(.)"/>
+	  </xsl:attribute>
+	  <xsl:attribute name="summary">EBNF productions</xsl:attribute>
+	  <xsl:apply-templates select="production|productionrecap"/>
+	</table>
+      </td>
+    </tr>
+  </table>
+</xsl:template>
+
+<xsl:template match="productionset/title">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="production">
+  <xsl:param name="recap" select="false()"/>
+  <tr>
+    <td align="left" valign="top" width="3%">
+      <xsl:text>[</xsl:text>
+      <xsl:number count="production" level="any"/>
+      <xsl:text>]</xsl:text>
+    </td>
+    <td align="right" valign="top" width="10%">
+      <xsl:choose>
+	<xsl:when test="$recap">
+	  <a>
+	    <xsl:attribute name="href">
+	      <xsl:call-template name="href.target">
+		<xsl:with-param name="object" select="."/>
+	      </xsl:call-template>
+	    </xsl:attribute>
+	    <xsl:apply-templates select="lhs"/>
+	  </a>
+	</xsl:when>
+	<xsl:otherwise>
+          <xsl:call-template name="anchor"/>
+	  <xsl:apply-templates select="lhs"/>
+	</xsl:otherwise>
+      </xsl:choose>
+    </td>
+    <td valign="top" width="5%" align="center">
+      <xsl:copy-of select="$ebnf.assignment"/>
+    </td>
+    <td valign="top" width="52%">
+      <xsl:apply-templates select="rhs"/>
+      <xsl:copy-of select="$ebnf.statement.terminator"/>
+    </td>
+    <td align="left" valign="top" width="30%">
+      <xsl:choose>
+	<xsl:when test="rhs/lineannotation|constraint">
+          <xsl:apply-templates select="rhs/lineannotation" mode="rhslo"/>
+          <xsl:apply-templates select="constraint"/>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:text>&#160;</xsl:text>
+	</xsl:otherwise>
+      </xsl:choose>
+    </td>
+  </tr>
+</xsl:template>
+
+<xsl:template match="productionrecap">
+  <xsl:variable name="targets" select="key('id', at linkend)"/>
+  <xsl:variable name="target" select="$targets[1]"/>
+
+  <xsl:if test="count($targets)=0">
+    <xsl:message>
+      <xsl:text>Error: no ID for productionrecap linkend: </xsl:text>
+      <xsl:value-of select="@linkend"/>
+      <xsl:text>.</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <xsl:if test="count($targets)&gt;1">
+    <xsl:message>
+      <xsl:text>Warning: multiple "IDs" for productionrecap linkend: </xsl:text>
+      <xsl:value-of select="@linkend"/>
+      <xsl:text>.</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <xsl:apply-templates select="$target">
+    <xsl:with-param name="recap" select="true()"/>
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="lhs">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="rhs">
+  <xsl:apply-templates/>
+  <xsl:if test="following-sibling::rhs">
+    <xsl:text> |</xsl:text>
+    <br/>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="nonterminal">
+  <xsl:variable name="linkend">
+    <xsl:call-template name="xpointer.idref">
+      <xsl:with-param name="xpointer" select="@def"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:call-template name="check.id.unique">
+    <xsl:with-param name="linkend" select="$linkend"/>
+  </xsl:call-template>
+
+  <xsl:call-template name="check.idref.targets">
+    <xsl:with-param name="linkend" select="$linkend"/>
+    <xsl:with-param name="element-list">production</xsl:with-param>
+  </xsl:call-template>
+
+  <!-- If you don't provide content, you can't point outside this doc. -->
+  <xsl:choose>
+    <xsl:when test="*|text()"><!--nop--></xsl:when>
+    <xsl:otherwise>
+      <xsl:if test="$linkend = ''">
+	<xsl:message>
+	  <xsl:text>Non-terminals with no content must point to </xsl:text>
+	  <xsl:text>production elements in the current document.</xsl:text>
+	</xsl:message>
+	<xsl:message>
+	  <xsl:text>Invalid xpointer for empty nt: </xsl:text>
+	  <xsl:value-of select="@def"/>
+	</xsl:message>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+
+  <xsl:variable name="href">
+    <xsl:choose>
+      <xsl:when test="$linkend != ''">
+	<xsl:variable name="targets" select="key('id',$linkend)"/>
+	<xsl:variable name="target" select="$targets[1]"/>
+	<xsl:call-template name="href.target">
+	  <xsl:with-param name="object" select="$target"/>
+	</xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:value-of select="@def"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <a href="{$href}">
+    <xsl:choose>
+      <xsl:when test="*|text()">
+	<xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:choose>
+	  <xsl:when test="$linkend != ''">
+	    <xsl:variable name="targets" select="key('id',$linkend)"/>
+	    <xsl:variable name="target" select="$targets[1]"/>
+	    <xsl:apply-templates select="$target/lhs"/>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:text>???</xsl:text>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </a>
+</xsl:template>
+
+<xsl:template match="rhs/lineannotation">
+  <!--nop-->
+</xsl:template>
+
+<xsl:template match="rhs/lineannotation" mode="rhslo">
+  <xsl:text>/*&#160;</xsl:text>
+  <xsl:apply-templates/>
+  <xsl:text>&#160;*/</xsl:text>
+  <br/>
+</xsl:template>
+
+<xsl:template match="constraint">
+  <xsl:call-template name="check.id.unique">
+    <xsl:with-param name="linkend" select="@linkend"/>
+  </xsl:call-template>
+
+  <xsl:call-template name="check.idref.targets">
+    <xsl:with-param name="linkend" select="@linkend"/>
+    <xsl:with-param name="element-list">constraintdef</xsl:with-param>
+  </xsl:call-template>
+
+  <xsl:variable name="href">
+    <xsl:variable name="targets" select="key('id', at linkend)"/>
+    <xsl:variable name="target" select="$targets[1]"/>
+    <xsl:call-template name="href.target">
+      <xsl:with-param name="object" select="$target"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:text>[&#160;</xsl:text>
+
+  <xsl:choose>
+    <xsl:when test="@role">
+      <xsl:value-of select="@role"/>
+      <xsl:text>: </xsl:text>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="targets" select="key('id', at linkend)"/>
+      <xsl:variable name="target" select="$targets[1]"/>
+      <xsl:if test="$target/@role">
+	<xsl:value-of select="$target/@role"/>
+	<xsl:text>: </xsl:text>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+
+  <a href="{$href}">
+    <xsl:variable name="targets" select="key('id', at linkend)"/>
+    <xsl:variable name="target" select="$targets[1]"/>
+    <xsl:apply-templates select="$target" mode="title.markup"/>
+  </a>
+  <xsl:text>&#160;]</xsl:text>
+  <xsl:if test="following-sibling::constraint">
+    <br/>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="constraintdef">
+  <div class="{name(.)}">
+    <xsl:call-template name="anchor"/>
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
+<xsl:template match="constraintdef/title">
+  <p><b><xsl:apply-templates/></b></p>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/footnote.xsl
===================================================================
--- public/phoenix/utils/xhtml/footnote.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/footnote.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,277 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="exsl" version="1.0">
+
+<!-- ********************************************************************
+     $Id: footnote.xsl,v 1.19 2005/07/14 14:30:43 nwalsh Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<xsl:template match="footnote">
+  <xsl:variable name="name">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+  <xsl:variable name="href">
+    <xsl:text>#ftn.</xsl:text>
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="ancestor::tgroup">
+      <sup>
+        <xsl:text>[</xsl:text>
+        <a id="{$name}" href="{$href}">
+          <xsl:apply-templates select="." mode="footnote.number"/>
+        </a>
+        <xsl:text>]</xsl:text>
+      </sup>
+    </xsl:when>
+    <xsl:otherwise>
+      <sup>
+        <xsl:text>[</xsl:text>
+        <a id="{$name}" href="{$href}">
+          <xsl:apply-templates select="." mode="footnote.number"/>
+        </a>
+        <xsl:text>]</xsl:text>
+      </sup>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="footnoteref">
+  <xsl:variable name="targets" select="key('id', at linkend)"/>
+  <xsl:variable name="footnote" select="$targets[1]"/>
+  <xsl:variable name="href">
+    <xsl:text>#ftn.</xsl:text>
+    <xsl:call-template name="object.id">
+      <xsl:with-param name="object" select="$footnote"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <sup>
+    <xsl:text>[</xsl:text>
+    <a href="{$href}">
+      <xsl:apply-templates select="$footnote" mode="footnote.number"/>
+    </a>
+    <xsl:text>]</xsl:text>
+  </sup>
+</xsl:template>
+
+<xsl:template match="footnote" mode="footnote.number">
+  <xsl:choose>
+    <xsl:when test="string-length(@label) != 0">
+      <xsl:value-of select="@label"/>
+    </xsl:when>
+    <xsl:when test="ancestor::tgroup">
+      <xsl:variable name="tfnum">
+        <xsl:number level="any" from="table|informaltable" format="1"/>
+      </xsl:variable>
+
+      <xsl:choose>
+        <xsl:when test="string-length($table.footnote.number.symbols) &gt;= $tfnum">
+          <xsl:value-of select="substring($table.footnote.number.symbols, $tfnum, 1)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:number level="any" from="tgroup" format="{$table.footnote.number.format}"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="pfoot" select="preceding::footnote[not(@label)]"/>
+      <xsl:variable name="ptfoot" select="preceding::tgroup//footnote"/>
+      <xsl:variable name="fnum" select="count($pfoot) - count($ptfoot) + 1"/>
+
+      <xsl:choose>
+        <xsl:when test="string-length($footnote.number.symbols) &gt;= $fnum">
+          <xsl:value-of select="substring($footnote.number.symbols, $fnum, 1)"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:number value="$fnum" format="{$footnote.number.format}"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="footnote/para[1]|footnote/simpara[1]" priority="2">
+  <!-- this only works if the first thing in a footnote is a para, -->
+  <!-- which is ok, because it usually is. -->
+  <xsl:variable name="name">
+    <xsl:text>ftn.</xsl:text>
+    <xsl:call-template name="object.id">
+      <xsl:with-param name="object" select="ancestor::footnote"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:variable name="href">
+    <xsl:text>#</xsl:text>
+    <xsl:call-template name="object.id">
+      <xsl:with-param name="object" select="ancestor::footnote"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <p>
+    <xsl:if test="@role and $para.propagates.style != 0">
+      <xsl:attribute name="class">
+        <xsl:value-of select="@role"/>
+      </xsl:attribute>
+    </xsl:if>
+    <sup>
+      <xsl:text>[</xsl:text>
+      <a id="{$name}" href="{$href}">
+        <xsl:apply-templates select="ancestor::footnote" mode="footnote.number"/>
+      </a>
+      <xsl:text>] </xsl:text>
+    </sup>
+    <xsl:apply-templates/>
+  </p>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*" mode="footnote.body.number">
+  <xsl:variable name="name">
+    <xsl:text>ftn.</xsl:text>
+    <xsl:call-template name="object.id">
+      <xsl:with-param name="object" select="ancestor::footnote"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:variable name="href">
+    <xsl:text>#</xsl:text>
+    <xsl:call-template name="object.id">
+      <xsl:with-param name="object" select="ancestor::footnote"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:variable name="footnote.mark">
+    <sup>
+      <xsl:text>[</xsl:text>
+      <a id="{$name}" href="{$href}">
+        <xsl:apply-templates select="ancestor::footnote" mode="footnote.number"/>
+      </a>
+      <xsl:text>] </xsl:text>
+    </sup>
+  </xsl:variable>
+
+  <xsl:variable name="html">
+    <xsl:apply-templates select="."/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="function-available('exsl:node-set')">
+      <xsl:variable name="html-nodes" select="exsl:node-set($html)"/>
+      <xsl:choose>
+        <xsl:when test="$html-nodes//p">
+          <xsl:apply-templates select="$html-nodes" mode="insert.html.p">
+            <xsl:with-param name="mark" select="$footnote.mark"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates select="$html-nodes" mode="insert.html.text">
+            <xsl:with-param name="mark" select="$footnote.mark"/>
+          </xsl:apply-templates>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy-of select="$html"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<!--
+<xsl:template name="count-element-from">
+  <xsl:param name="from" select=".."/>
+  <xsl:param name="to" select="."/>
+  <xsl:param name="count" select="0"/>
+  <xsl:param name="list" select="$from/following::*[name(.)=name($to)]
+                                 |$from/descendant-or-self::*[name(.)=name($to)]"/>
+
+  <xsl:choose>
+    <xsl:when test="not($list)">
+      <xsl:text>-1</xsl:text>
+    </xsl:when>
+    <xsl:when test="$list[1] = $to">
+      <xsl:value-of select="$count + 1"/>
+    </xsl:when>
+    <xsl:otherwise>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+-->
+
+<!-- ==================================================================== -->
+
+<xsl:template name="process.footnotes">
+  <xsl:variable name="footnotes" select=".//footnote"/>
+  <xsl:variable name="table.footnotes" select=".//tgroup//footnote"/>
+
+  <!-- Only bother to do this if there's at least one non-table footnote -->
+  <xsl:if test="count($footnotes)&gt;count($table.footnotes)">
+    <div class="footnotes">
+      <br/>
+      <hr width="100" align="left"/>
+      <xsl:apply-templates select="$footnotes" mode="process.footnote.mode"/>
+    </div>
+  </xsl:if>
+
+  <xsl:if test="$annotation.support != 0 and //annotation">
+    <div class="annotation-list">
+      <div class="annotation-nocss">
+	<p>The following annotations are from this essay. You are seeing
+	them here because your browser doesn&#8217;t support the user-interface
+	techniques used to make them appear as &#8216;popups&#8217; on modern browsers.</p>
+      </div>
+
+      <xsl:apply-templates select="//annotation" mode="annotation-popup"/>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="process.chunk.footnotes">
+  <!-- nop -->
+</xsl:template>
+
+<xsl:template match="footnote" name="process.footnote" mode="process.footnote.mode">
+  <xsl:choose>
+    <xsl:when test="local-name(*[1]) = 'para' or local-name(*[1]) = 'simpara'">
+      <div class="{name(.)}">
+        <xsl:apply-templates/>
+      </div>
+    </xsl:when>
+
+    <xsl:when test="$html.cleanup != 0 and function-available('exsl:node-set')">
+      <div class="{name(.)}">
+        <xsl:apply-templates select="*[1]" mode="footnote.body.number"/>
+        <xsl:apply-templates select="*[position() &gt; 1]"/>
+      </div>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:message>
+        <xsl:text>Warning: footnote number may not be generated </xsl:text>
+        <xsl:text>correctly; </xsl:text>
+        <xsl:value-of select="local-name(*[1])"/>
+        <xsl:text> unexpected as first child of footnote.</xsl:text>
+      </xsl:message>
+      <div class="{name(.)}">
+        <xsl:apply-templates/>
+      </div>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="tgroup//footnote" mode="process.footnote.mode">
+</xsl:template>
+
+<xsl:template match="footnote" mode="table.footnote.mode">
+  <xsl:call-template name="process.footnote"/>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/formal.xsl
===================================================================
--- public/phoenix/utils/xhtml/formal.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/formal.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,330 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<!-- ********************************************************************
+     $Id: formal.xsl,v 1.18 2004/04/11 22:41:29 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<xsl:template name="formal.object">
+  <xsl:param name="placement" select="'before'"/>
+  <xsl:param name="class" select="local-name(.)"/>
+
+  <div class="{$class}">
+    <xsl:call-template name="anchor">
+      <xsl:with-param name="conditional" select="0"/>
+    </xsl:call-template>
+
+    <xsl:choose>
+      <xsl:when test="$placement = 'before'">
+        <xsl:call-template name="formal.object.heading"/>
+        <xsl:apply-templates/>
+
+        <!-- HACK: This doesn't belong inside formal.object; it should be done by -->
+        <!-- the table template, but I want the link to be inside the DIV, so... -->
+        <xsl:if test="local-name(.) = 'table'">
+          <xsl:call-template name="table.longdesc"/>
+        </xsl:if>
+
+        <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
+        <xsl:apply-templates/>
+
+        <!-- HACK: This doesn't belong inside formal.object; it should be done by -->
+        <!-- the table template, but I want the link to be inside the DIV, so... -->
+        <xsl:if test="local-name(.) = 'table'">
+          <xsl:call-template name="table.longdesc"/>
+        </xsl:if>
+
+        <xsl:call-template name="formal.object.heading"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </div>
+</xsl:template>
+
+<xsl:template name="formal.object.heading">
+  <xsl:param name="object" select="."/>
+  <xsl:param name="title">
+    <xsl:apply-templates select="$object" mode="object.title.markup">
+      <xsl:with-param name="allow-anchors" select="1"/>
+    </xsl:apply-templates>
+  </xsl:param>
+
+  <p class="title">
+    <b>
+      <xsl:copy-of select="$title"/>
+    </b>
+  </p>
+</xsl:template>
+
+<xsl:template name="informal.object">
+  <xsl:param name="class" select="local-name(.)"/>
+
+  <div class="{$class}">
+    <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
+    <xsl:call-template name="anchor"/>
+    <xsl:apply-templates/>
+
+    <!-- HACK: This doesn't belong inside formal.object; it should be done by -->
+    <!-- the table template, but I want the link to be inside the DIV, so... -->
+    <xsl:if test="local-name(.) = 'informaltable'">
+      <xsl:call-template name="table.longdesc"/>
+    </xsl:if>
+
+    <xsl:if test="$spacing.paras != 0"><p/></xsl:if>
+  </div>
+</xsl:template>
+
+<xsl:template name="semiformal.object">
+  <xsl:param name="placement" select="'before'"/>
+  <xsl:param name="class" select="local-name(.)"/>
+
+  <xsl:choose>
+    <xsl:when test="title">
+      <xsl:call-template name="formal.object">
+        <xsl:with-param name="placement" select="$placement"/>
+        <xsl:with-param name="class" select="$class"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="informal.object">
+        <xsl:with-param name="class" select="$class"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="figure">
+  <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement),                                         concat(local-name(.), ' '))"/>
+
+  <xsl:variable name="placement">
+    <xsl:choose>
+      <xsl:when test="contains($param.placement, ' ')">
+        <xsl:value-of select="substring-before($param.placement, ' ')"/>
+      </xsl:when>
+      <xsl:when test="$param.placement = ''">before</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$param.placement"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="@float and @float != 0">
+      <xsl:variable name="float">
+        <xsl:choose>
+          <xsl:when test="@float = 1">
+            <xsl:value-of select="$default.float.class"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="@float"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
+      <div class="figure-float">
+        <xsl:if test="$float = 'left' or $float = 'right'">
+          <xsl:attribute name="style">
+            <xsl:text>float: </xsl:text>
+            <xsl:value-of select="$float"/>
+            <xsl:text>;</xsl:text>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:call-template name="formal.object">
+          <xsl:with-param name="placement" select="$placement"/>
+        </xsl:call-template>
+      </div>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="formal.object">
+        <xsl:with-param name="placement" select="$placement"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="table">
+  <xsl:choose>
+    <xsl:when test="tgroup|mediaobject|graphic">
+      <xsl:call-template name="calsTable"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy>
+        <xsl:copy-of select="@*"/>
+	<xsl:if test="not(@id)">
+	  <xsl:attribute name="id">
+	    <xsl:call-template name="object.id"/>
+	  </xsl:attribute>
+	</xsl:if>
+        <xsl:call-template name="htmlTable"/>
+      </xsl:copy>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="calsTable">
+  <xsl:if test="tgroup/tbody/tr                 |tgroup/thead/tr                 |tgroup/tfoot/tr">
+    <xsl:message terminate="yes">Broken table: tr descendent of CALS Table.</xsl:message>
+  </xsl:if>
+
+  <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement),                                         concat(local-name(.), ' '))"/>
+
+  <xsl:variable name="placement">
+    <xsl:choose>
+      <xsl:when test="contains($param.placement, ' ')">
+        <xsl:value-of select="substring-before($param.placement, ' ')"/>
+      </xsl:when>
+      <xsl:when test="$param.placement = ''">before</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$param.placement"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:call-template name="formal.object">
+    <xsl:with-param name="placement" select="$placement"/>
+    <xsl:with-param name="class">
+      <xsl:choose>
+        <xsl:when test="@tabstyle">
+          <!-- hack, this will only ever occur on table, not example -->
+          <xsl:value-of select="@tabstyle"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="local-name(.)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="htmlTable">
+  <xsl:if test="tgroup/tbody/row                 |tgroup/thead/row                 |tgroup/tfoot/row">
+    <xsl:message terminate="yes">Broken table: row descendent of HTML table.</xsl:message>
+  </xsl:if>
+
+  <xsl:apply-templates mode="htmlTable"/>
+</xsl:template>
+
+<xsl:template match="example">
+  <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement),                                         concat(local-name(.), ' '))"/>
+
+  <xsl:variable name="placement">
+    <xsl:choose>
+      <xsl:when test="contains($param.placement, ' ')">
+        <xsl:value-of select="substring-before($param.placement, ' ')"/>
+      </xsl:when>
+      <xsl:when test="$param.placement = ''">before</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$param.placement"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:call-template name="formal.object">
+    <xsl:with-param name="placement" select="$placement"/>
+    <xsl:with-param name="class" select="local-name(.)"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="equation">
+  <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement),                                         concat(local-name(.), ' '))"/>
+
+  <xsl:variable name="placement">
+    <xsl:choose>
+      <xsl:when test="contains($param.placement, ' ')">
+        <xsl:value-of select="substring-before($param.placement, ' ')"/>
+      </xsl:when>
+      <xsl:when test="$param.placement = ''">before</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$param.placement"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:call-template name="semiformal.object">
+    <xsl:with-param name="placement" select="$placement"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="figure/title"/>
+<xsl:template match="figure/titleabbrev"/>
+<xsl:template match="table/title"/>
+<xsl:template match="table/titleabbrev"/>
+<xsl:template match="table/textobject"/>
+<xsl:template match="example/title"/>
+<xsl:template match="example/titleabbrev"/>
+<xsl:template match="equation/title"/>
+<xsl:template match="equation/titleabbrev"/>
+
+<xsl:template match="informalfigure">
+  <xsl:call-template name="informal.object"/>
+</xsl:template>
+
+<xsl:template match="informalexample">
+  <xsl:call-template name="informal.object"/>
+</xsl:template>
+
+<xsl:template match="informaltable">
+  <xsl:choose>
+    <xsl:when test="tgroup|mediaobject|graphic">
+      <xsl:call-template name="informal.object">
+        <xsl:with-param name="class">
+          <xsl:choose>
+            <xsl:when test="@tabstyle">
+              <xsl:value-of select="@tabstyle"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="local-name(.)"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <table>
+        <xsl:copy-of select="@*"/>
+        <xsl:call-template name="htmlTable"/>
+      </table>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="informaltable/textobject"/>
+
+<xsl:template name="table.longdesc">
+  <!-- HACK: This doesn't belong inside formal.objectt; it should be done by -->
+  <!-- the table template, but I want the link to be inside the DIV, so... -->
+  <xsl:variable name="longdesc.uri">
+    <xsl:call-template name="longdesc.uri">
+      <xsl:with-param name="mediaobject" select="."/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="irrelevant">
+    <!-- write.longdesc returns the filename ... -->
+    <xsl:call-template name="write.longdesc">
+      <xsl:with-param name="mediaobject" select="."/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0                 and textobject[not(phrase)]">
+    <xsl:call-template name="longdesc.link">
+      <xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template match="informalequation">
+  <xsl:call-template name="informal.object"/>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/glossary.xsl
===================================================================
--- public/phoenix/utils/xhtml/glossary.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/glossary.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,388 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
+
+<!-- ********************************************************************
+     $Id: glossary.xsl,v 1.19 2005/05/13 17:23:42 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:template match="glossary">
+  <div class="{name(.)}">
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="glossary.titlepage"/>
+
+    <xsl:choose>
+      <xsl:when test="glossdiv">
+        <xsl:apply-templates select="(glossdiv[1]/preceding-sibling::*)"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:choose>
+      <xsl:when test="glossdiv">
+        <xsl:apply-templates select="glossdiv"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <dl>
+          <xsl:apply-templates select="glossentry"/>
+        </dl>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:if test="not(parent::article)">
+      <xsl:call-template name="process.footnotes"/>
+    </xsl:if>
+  </div>
+</xsl:template>
+
+<xsl:template match="glossary/glossaryinfo"/>
+<xsl:template match="glossary/title"/>
+<xsl:template match="glossary/subtitle"/>
+<xsl:template match="glossary/titleabbrev"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="glosslist">
+  <div class="{name(.)}">
+    <xsl:call-template name="anchor"/>
+    <xsl:if test="blockinfo/title|title">
+      <xsl:call-template name="formal.object.heading"/>
+    </xsl:if>
+    <dl>
+      <xsl:apply-templates select="glossentry"/>
+    </dl>
+  </div>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="glossdiv">
+  <div class="{name(.)}">
+    <xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
+
+    <dl>
+      <xsl:apply-templates select="glossentry"/>
+    </dl>
+  </div>
+</xsl:template>
+
+<xsl:template match="glossdiv/title">
+  <h3 class="{name(.)}">
+    <xsl:apply-templates/>
+  </h3>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<!--
+GlossEntry ::=
+  GlossTerm, Acronym?, Abbrev?,
+  (IndexTerm)*,
+  RevHistory?,
+  (GlossSee | GlossDef+)
+-->
+
+<xsl:template match="glossentry">
+  <xsl:choose>
+    <xsl:when test="$glossentry.show.acronym = 'primary'">
+      <dt>
+        <xsl:call-template name="anchor">
+          <xsl:with-param name="conditional">
+            <xsl:choose>
+              <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
+              <xsl:otherwise>1</xsl:otherwise>
+            </xsl:choose>
+          </xsl:with-param>
+        </xsl:call-template>
+
+        <xsl:choose>
+          <xsl:when test="acronym|abbrev">
+            <xsl:apply-templates select="acronym|abbrev"/>
+            <xsl:text> (</xsl:text>
+            <xsl:apply-templates select="glossterm"/>
+            <xsl:text>)</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="glossterm"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </dt>
+    </xsl:when>
+    <xsl:when test="$glossentry.show.acronym = 'yes'">
+      <dt>
+        <xsl:call-template name="anchor">
+          <xsl:with-param name="conditional">
+            <xsl:choose>
+              <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
+              <xsl:otherwise>1</xsl:otherwise>
+            </xsl:choose>
+          </xsl:with-param>
+        </xsl:call-template>
+
+        <xsl:apply-templates select="glossterm"/>
+
+        <xsl:if test="acronym|abbrev">
+          <xsl:text> (</xsl:text>
+          <xsl:apply-templates select="acronym|abbrev"/>
+          <xsl:text>)</xsl:text>
+        </xsl:if>
+      </dt>
+    </xsl:when>
+    <xsl:otherwise>
+      <dt>
+        <xsl:call-template name="anchor">
+          <xsl:with-param name="conditional">
+            <xsl:choose>
+              <xsl:when test="$glossterm.auto.link != 0">0</xsl:when>
+              <xsl:otherwise>1</xsl:otherwise>
+            </xsl:choose>
+          </xsl:with-param>
+        </xsl:call-template>
+
+        <xsl:apply-templates select="glossterm"/>
+      </dt>
+    </xsl:otherwise>
+  </xsl:choose>
+
+  <xsl:apply-templates select="indexterm|revhistory|glosssee|glossdef"/>
+</xsl:template>
+
+<xsl:template match="glossentry/glossterm">
+  <xsl:apply-templates/>
+  <xsl:if test="following-sibling::glossterm">, </xsl:if>
+</xsl:template>
+
+<xsl:template match="glossentry/acronym">
+  <xsl:apply-templates/>
+  <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
+</xsl:template>
+
+<xsl:template match="glossentry/abbrev">
+  <xsl:apply-templates/>
+  <xsl:if test="following-sibling::acronym|following-sibling::abbrev">, </xsl:if>
+</xsl:template>
+
+<xsl:template match="glossentry/revhistory">
+</xsl:template>
+
+<xsl:template match="glossentry/glosssee">
+  <xsl:variable name="otherterm" select="@otherterm"/>
+  <xsl:variable name="targets" select="//node()[@id=$otherterm]"/>
+  <xsl:variable name="target" select="$targets[1]"/>
+
+  <dd>
+    <p>
+      <xsl:variable name="template">
+        <xsl:call-template name="gentext.template">
+          <xsl:with-param name="context" select="'glossary'"/>
+          <xsl:with-param name="name" select="'see'"/>
+        </xsl:call-template>
+      </xsl:variable>
+
+      <xsl:variable name="title">
+        <xsl:choose>
+          <xsl:when test="$target">
+            <a>
+              <xsl:attribute name="href">
+                <xsl:call-template name="href.target">
+                  <xsl:with-param name="object" select="$target"/>
+                </xsl:call-template>
+              </xsl:attribute>
+              <xsl:apply-templates select="$target" mode="xref-to"/>
+            </a>
+          </xsl:when>
+          <xsl:when test="$otherterm != '' and not($target)">
+            <xsl:message>
+              <xsl:text>Warning: glosssee @otherterm reference not found: </xsl:text>
+              <xsl:value-of select="$otherterm"/>
+            </xsl:message>
+            <xsl:apply-templates/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
+      <xsl:call-template name="substitute-markup">
+        <xsl:with-param name="template" select="$template"/>
+        <xsl:with-param name="title" select="$title"/>
+      </xsl:call-template>
+      <xsl:text>.</xsl:text>
+    </p>
+  </dd>
+</xsl:template>
+
+<xsl:template match="glossentry/glossdef">
+  <dd>
+    <xsl:apply-templates select="*[local-name(.) != 'glossseealso']"/>
+    <xsl:if test="glossseealso">
+      <p>
+        <xsl:variable name="template">
+          <xsl:call-template name="gentext.template">
+            <xsl:with-param name="context" select="'glossary'"/>
+            <xsl:with-param name="name" select="'seealso'"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:variable name="title">
+          <xsl:apply-templates select="glossseealso"/>
+        </xsl:variable>
+        <xsl:call-template name="substitute-markup">
+          <xsl:with-param name="template" select="$template"/>
+          <xsl:with-param name="title" select="$title"/>
+        </xsl:call-template>
+      </p>
+    </xsl:if>
+  </dd>
+</xsl:template>
+
+<xsl:template match="glossseealso">
+  <xsl:variable name="otherterm" select="@otherterm"/>
+  <xsl:variable name="targets" select="//node()[@id=$otherterm]"/>
+  <xsl:variable name="target" select="$targets[1]"/>
+
+  <xsl:choose>
+    <xsl:when test="$target">
+      <a>
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$target"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:apply-templates select="$target" mode="xref-to"/>
+      </a>
+    </xsl:when>
+    <xsl:when test="$otherterm != '' and not($target)">
+      <xsl:message>
+        <xsl:text>Warning: glossseealso @otherterm reference not found: </xsl:text>
+        <xsl:value-of select="$otherterm"/>
+      </xsl:message>
+      <xsl:apply-templates/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates/>
+    </xsl:otherwise>
+  </xsl:choose>
+
+  <xsl:choose>
+    <xsl:when test="position() = last()">
+      <xsl:text>.</xsl:text>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:text>, </xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<!-- Glossary collection -->
+
+<xsl:template match="glossary[@role='auto']" priority="2">
+  <xsl:variable name="terms" select="//glossterm[not(parent::glossdef)]|//firstterm"/>
+  <xsl:variable name="collection" select="document($glossary.collection, .)"/>
+
+  <xsl:if test="$glossary.collection = ''">
+    <xsl:message>
+      <xsl:text>Warning: processing automatic glossary </xsl:text>
+      <xsl:text>without a glossary.collection file.</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <xsl:if test="not($collection) and $glossary.collection != ''">
+    <xsl:message>
+      <xsl:text>Warning: processing automatic glossary but unable to </xsl:text>
+      <xsl:text>open glossary.collection file '</xsl:text>
+      <xsl:value-of select="$glossary.collection"/>
+      <xsl:text>'</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
+  <div class="{name(.)}">
+    <xsl:if test="$generate.id.attributes != 0">
+      <xsl:attribute name="id">
+        <xsl:call-template name="object.id"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <xsl:call-template name="glossary.titlepage"/>
+
+    <xsl:choose>
+      <xsl:when test="glossdiv and $collection//glossdiv">
+        <xsl:for-each select="$collection//glossdiv">
+          <!-- first see if there are any in this div -->
+          <xsl:variable name="exist.test">
+            <xsl:for-each select="glossentry">
+              <xsl:variable name="cterm" select="glossterm"/>
+              <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
+                <xsl:value-of select="glossterm"/>
+              </xsl:if>
+            </xsl:for-each>
+          </xsl:variable>
+
+          <xsl:if test="$exist.test != ''">
+            <xsl:apply-templates select="." mode="auto-glossary">
+              <xsl:with-param name="terms" select="$terms"/>
+            </xsl:apply-templates>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <dl>
+          <xsl:for-each select="$collection//glossentry">
+            <xsl:variable name="cterm" select="glossterm"/>
+            <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
+              <xsl:apply-templates select="." mode="auto-glossary"/>
+            </xsl:if>
+          </xsl:for-each>
+        </dl>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:if test="not(parent::article)">
+      <xsl:call-template name="process.footnotes"/>
+    </xsl:if>
+  </div>
+</xsl:template>
+
+<xsl:template match="*" mode="auto-glossary">
+  <!-- pop back out to the default mode for most elements -->
+  <xsl:apply-templates select="."/>
+</xsl:template>
+
+<xsl:template match="glossdiv" mode="auto-glossary">
+  <xsl:param name="terms" select="."/>
+
+  <div class="{name(.)}">
+    <xsl:apply-templates select="(glossentry[1]/preceding-sibling::*)"/>
+
+    <dl>
+      <xsl:for-each select="glossentry">
+        <xsl:variable name="cterm" select="glossterm"/>
+        <xsl:if test="$terms[@baseform = $cterm or . = $cterm]">
+          <xsl:apply-templates select="." mode="auto-glossary"/>
+        </xsl:if>
+      </xsl:for-each>
+    </dl>
+  </div>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/graphics.xsl
===================================================================
--- public/phoenix/utils/xhtml/graphics.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/graphics.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,1303 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:stext="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.TextFactory" xmlns:simg="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.ImageIntrinsics" xmlns:ximg="xaln://com.nwalsh.xalan.ImageIntrinsics" xmlns:xtext="com.nwalsh.xalan.Text" xmlns:lxslt="http://xml.apache.org/xslt" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xlink stext xtext lxslt simg ximg" extension-element-prefixes="stext xtext" version="1.0">
+
+<!-- ********************************************************************
+     $Id: graphics.xsl,v 1.55 2005/05/16 08:27:18 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     Contributors:
+     Colin Paul Adams, <colin at colina.demon.co.uk>
+
+     ******************************************************************** -->
+
+<lxslt:component prefix="xtext" elements="insertfile"/>
+<lxslt:component prefix="ximg" functions="new getWidth getDepth"/>
+
+<!-- ==================================================================== -->
+<!-- Graphic format tests for the HTML backend -->
+
+<xsl:template name="is.graphic.format">
+  <xsl:param name="format"/>
+  <xsl:if test="$format = 'SVG'                 or $format = 'PNG'                 or $format = 'JPG'                 or $format = 'JPEG'                 or $format = 'linespecific'                 or $format = 'GIF'                 or $format = 'GIF87a'                 or $format = 'GIF89a'                 or $format = 'BMP'">1</xsl:if>
+</xsl:template>
+
+<xsl:template name="is.graphic.extension">
+  <xsl:param name="ext"/>
+  <xsl:variable name="lcext" select="translate($ext,                                        'ABCDEFGHIJKLMNOPQRSTUVWXYZ',                                        'abcdefghijklmnopqrstuvwxyz')"/>
+  <xsl:if test="$lcext = 'svg'              or $lcext = 'png'              or $lcext = 'jpeg'              or $lcext = 'jpg'              or $lcext = 'avi'              or $lcext = 'mpg'              or $lcext = 'mpeg'              or $lcext = 'qt'              or $lcext = 'gif'              or $lcext = 'bmp'">1</xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="screenshot">
+  <div class="{name(.)}">
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
+<xsl:template match="screeninfo">
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="process.image">
+  <!-- When this template is called, the current node should be  -->
+  <!-- a graphic, inlinegraphic, imagedata, or videodata. All    -->
+  <!-- those elements have the same set of attributes, so we can -->
+  <!-- handle them all in one place.                             -->
+  <xsl:param name="tag" select="'img'"/>
+  <xsl:param name="alt"/>
+  <xsl:param name="longdesc"/>
+
+  <!-- The HTML img element only supports the notion of content-area
+       scaling; it doesn't support the distinction between a
+       content-area and a viewport-area, so we have to make some
+       compromises.
+
+       1. If only the content-area is specified, everything is fine.
+          (If you ask for a three inch image, that's what you'll get.)
+
+       2. If only the viewport-area is provided:
+          - If scalefit=1, treat it as both the content-area and
+            the viewport-area. (If you ask for an image in a five inch
+            area, we'll make the image five inches to fill that area.)
+          - If scalefit=0, ignore the viewport-area specification.
+
+          Note: this is not quite the right semantic and has the additional
+          problem that it can result in anamorphic scaling, which scalefit
+          should never cause.
+
+       3. If both the content-area and the viewport-area is specified
+          on a graphic element, ignore the viewport-area.
+          (If you ask for a three inch image in a five inch area, we'll assume
+           it's better to give you a three inch image in an unspecified area
+           than a five inch image in a five inch area.
+
+       Relative units also cause problems. As a general rule, the stylesheets
+       are operating too early and too loosely coupled with the rendering engine
+       to know things like the current font size or the actual dimensions of
+       an image. Therefore:
+
+       1. We use a fixed size for pixels, $pixels.per.inch
+
+       2. We use a fixed size for "em"s, $points.per.em
+
+       Percentages are problematic. In the following discussion, we speak
+       of width and contentwidth, but the same issues apply to depth and
+       contentdepth
+
+       1. A width of 50% means "half of the available space for the image."
+          That's fine. But note that in HTML, this is a dynamic property and
+          the image size will vary if the browser window is resized.
+
+       2. A contentwidth of 50% means "half of the actual image width". But
+          the stylesheets have no way to assess the image's actual size. Treating
+          this as a width of 50% is one possibility, but it produces behavior
+          (dynamic scaling) that seems entirely out of character with the
+          meaning.
+
+          Instead, the stylesheets define a $nominal.image.width
+          and convert percentages to actual values based on that nominal size.
+
+       Scale can be problematic. Scale applies to the contentwidth, so
+       a scale of 50 when a contentwidth is not specified is analagous to a
+       width of 50%. (If a contentwidth is specified, the scaling factor can
+       be applied to that value and no problem exists.)
+
+       If scale is specified but contentwidth is not supplied, the
+       nominal.image.width is used to calculate a base size
+       for scaling.
+
+       Warning: as a consequence of these decisions, unless the aspect ratio
+       of your image happens to be exactly the same as (nominal width / nominal height),
+       specifying contentwidth="50%" and contentdepth="50%" is NOT going to
+       scale the way you expect (or really, the way it should).
+
+       Don't do that. In fact, a percentage value is not recommended for content
+       size at all. Use scale instead.
+
+       Finally, align and valign are troublesome. Horizontal alignment is now
+       supported by wrapping the image in a <div align="{@align}"> (in block
+       contexts!). I can't think of anything (practical) to do about vertical
+       alignment.
+  -->
+
+  <xsl:variable name="width-units">
+    <xsl:choose>
+      <xsl:when test="$ignore.image.scaling != 0"/>
+      <xsl:when test="@width">
+        <xsl:call-template name="length-units">
+          <xsl:with-param name="length" select="@width"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="not(@depth) and $default.image.width != ''">
+        <xsl:call-template name="length-units">
+          <xsl:with-param name="length" select="$default.image.width"/>
+        </xsl:call-template>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="width">
+    <xsl:choose>
+      <xsl:when test="$ignore.image.scaling != 0"/>
+      <xsl:when test="@width">
+        <xsl:choose>
+          <xsl:when test="$width-units = '%'">
+            <xsl:value-of select="@width"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="length-spec">
+              <xsl:with-param name="length" select="@width"/>
+            </xsl:call-template>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="not(@depth) and $default.image.width != ''">
+        <xsl:value-of select="$default.image.width"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="scalefit">
+    <xsl:choose>
+      <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
+      <xsl:when test="@contentwidth or @contentdepth">0</xsl:when>
+      <xsl:when test="@scale">0</xsl:when>
+      <xsl:when test="@scalefit"><xsl:value-of select="@scalefit"/></xsl:when>
+      <xsl:when test="$width != '' or @depth">1</xsl:when>
+      <xsl:otherwise>0</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="scale">
+    <xsl:choose>
+      <xsl:when test="$ignore.image.scaling != 0">1.0</xsl:when>
+      <xsl:when test="@contentwidth or @contentdepth">1.0</xsl:when>
+      <xsl:when test="@scale">
+        <xsl:value-of select="@scale div 100.0"/>
+      </xsl:when>
+      <xsl:otherwise>1.0</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="filename">
+    <xsl:choose>
+      <xsl:when test="local-name(.) = 'graphic'                       or local-name(.) = 'inlinegraphic'">
+        <!-- handle legacy graphic and inlinegraphic by new template --> 
+        <xsl:call-template name="mediaobject.filename">
+          <xsl:with-param name="object" select="."/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <!-- imagedata, videodata, audiodata -->
+        <xsl:call-template name="mediaobject.filename">
+          <xsl:with-param name="object" select=".."/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="img.src.path.pi">
+    <xsl:call-template name="dbhtml-attribute">
+      <xsl:with-param name="pis" select="../processing-instruction('dbhtml')"/>
+      <xsl:with-param name="attribute" select="'img.src.path'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="filename.for.graphicsize">
+    <xsl:choose>
+      <xsl:when test="$img.src.path.pi != ''">
+        <xsl:value-of select="concat($img.src.path.pi, $filename)"/>
+      </xsl:when>
+      <xsl:when test="$img.src.path != '' and                       $graphicsize.use.img.src.path != 0 and                       $tag = 'img' and                       not(starts-with($filename, '/')) and                       not(contains($filename, '://'))">
+        <xsl:value-of select="concat($img.src.path, $filename)"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$filename"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="realintrinsicwidth">
+    <!-- This funny compound test works around a bug in XSLTC -->
+    <xsl:choose>
+      <xsl:when test="$use.extensions != 0 and $graphicsize.extension != 0">
+        <xsl:choose>
+          <xsl:when test="function-available('simg:getWidth')">
+            <xsl:value-of select="simg:getWidth(simg:new($filename.for.graphicsize),                                                 $nominal.image.width)"/>
+          </xsl:when>
+          <xsl:when test="function-available('ximg:getWidth')">
+            <xsl:value-of select="ximg:getWidth(ximg:new($filename.for.graphicsize),                                                 $nominal.image.width)"/>
+          </xsl:when>
+          <xsl:otherwise>
+	    <xsl:value-of select="0"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="0"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="intrinsicwidth">
+    <xsl:choose>
+      <xsl:when test="$realintrinsicwidth = 0">
+	<xsl:value-of select="$nominal.image.width"/>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:value-of select="$realintrinsicwidth"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="intrinsicdepth">
+    <!-- This funny compound test works around a bug in XSLTC -->
+    <xsl:choose>
+      <xsl:when test="$use.extensions != 0 and $graphicsize.extension != 0">
+        <xsl:choose>
+          <xsl:when test="function-available('simg:getDepth')">
+            <xsl:value-of select="simg:getDepth(simg:new($filename.for.graphicsize),                                                 $nominal.image.depth)"/>
+          </xsl:when>
+          <xsl:when test="function-available('ximg:getDepth')">
+            <xsl:value-of select="ximg:getDepth(ximg:new($filename.for.graphicsize),                                                 $nominal.image.depth)"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$nominal.image.depth"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$nominal.image.depth"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="contentwidth">
+    <xsl:choose>
+      <xsl:when test="$ignore.image.scaling != 0"/>
+      <xsl:when test="@contentwidth">
+        <xsl:variable name="units">
+          <xsl:call-template name="length-units">
+            <xsl:with-param name="length" select="@contentwidth"/>
+          </xsl:call-template>
+        </xsl:variable>
+
+        <xsl:choose>
+          <xsl:when test="$units = '%'">
+            <xsl:variable name="cmagnitude">
+              <xsl:call-template name="length-magnitude">
+                <xsl:with-param name="length" select="@contentwidth"/>
+              </xsl:call-template>
+            </xsl:variable>
+            <xsl:value-of select="$intrinsicwidth * $cmagnitude div 100.0"/>
+            <xsl:text>px</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="length-spec">
+              <xsl:with-param name="length" select="@contentwidth"/>
+            </xsl:call-template>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$intrinsicwidth"/>
+        <xsl:text>px</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="scaled.contentwidth">
+    <xsl:if test="$contentwidth != ''">
+      <xsl:variable name="cwidth.in.points">
+        <xsl:call-template name="length-in-points">
+          <xsl:with-param name="length" select="$contentwidth"/>
+          <xsl:with-param name="pixels.per.inch" select="$pixels.per.inch"/>
+          <xsl:with-param name="em.size" select="$points.per.em"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:value-of select="$cwidth.in.points div 72.0 * $pixels.per.inch * $scale"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="html.width">
+    <xsl:choose>
+      <xsl:when test="$ignore.image.scaling != 0"/>
+      <xsl:when test="$width-units = '%'">
+        <xsl:value-of select="$width"/>
+      </xsl:when>
+      <xsl:when test="$width != ''">
+        <xsl:variable name="width.in.points">
+          <xsl:call-template name="length-in-points">
+            <xsl:with-param name="length" select="$width"/>
+            <xsl:with-param name="pixels.per.inch" select="$pixels.per.inch"/>
+            <xsl:with-param name="em.size" select="$points.per.em"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:value-of select="round($width.in.points div 72.0 * $pixels.per.inch)"/>
+      </xsl:when>
+      <xsl:otherwise/>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="contentdepth">
+    <xsl:choose>
+      <xsl:when test="$ignore.image.scaling != 0"/>
+      <xsl:when test="@contentdepth">
+        <xsl:variable name="units">
+          <xsl:call-template name="length-units">
+            <xsl:with-param name="length" select="@contentdepth"/>
+          </xsl:call-template>
+        </xsl:variable>
+
+        <xsl:choose>
+          <xsl:when test="$units = '%'">
+            <xsl:variable name="cmagnitude">
+              <xsl:call-template name="length-magnitude">
+                <xsl:with-param name="length" select="@contentdepth"/>
+              </xsl:call-template>
+            </xsl:variable>
+            <xsl:value-of select="$intrinsicdepth * $cmagnitude div 100.0"/>
+            <xsl:text>px</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="length-spec">
+              <xsl:with-param name="length" select="@contentdepth"/>
+            </xsl:call-template>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$intrinsicdepth"/>
+        <xsl:text>px</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="scaled.contentdepth">
+    <xsl:if test="$contentdepth != ''">
+      <xsl:variable name="cdepth.in.points">
+        <xsl:call-template name="length-in-points">
+          <xsl:with-param name="length" select="$contentdepth"/>
+          <xsl:with-param name="pixels.per.inch" select="$pixels.per.inch"/>
+          <xsl:with-param name="em.size" select="$points.per.em"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:value-of select="$cdepth.in.points div 72.0 * $pixels.per.inch * $scale"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="depth-units">
+    <xsl:if test="@depth">
+      <xsl:call-template name="length-units">
+        <xsl:with-param name="length" select="@depth"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="depth">
+    <xsl:if test="@depth">
+      <xsl:choose>
+        <xsl:when test="$depth-units = '%'">
+          <xsl:value-of select="@depth"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="length-spec">
+            <xsl:with-param name="length" select="@depth"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="html.depth">
+    <xsl:choose>
+      <xsl:when test="$ignore.image.scaling != 0"/>
+      <xsl:when test="$depth-units = '%'">
+        <xsl:value-of select="$depth"/>
+      </xsl:when>
+      <xsl:when test="@depth and @depth != ''">
+        <xsl:variable name="depth.in.points">
+          <xsl:call-template name="length-in-points">
+            <xsl:with-param name="length" select="$depth"/>
+            <xsl:with-param name="pixels.per.inch" select="$pixels.per.inch"/>
+            <xsl:with-param name="em.size" select="$points.per.em"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:value-of select="round($depth.in.points div 72.0 * $pixels.per.inch)"/>
+      </xsl:when>
+      <xsl:otherwise/>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="viewport">
+    <xsl:choose>
+      <xsl:when test="$ignore.image.scaling != 0">0</xsl:when>
+      <xsl:when test="local-name(.) = 'inlinegraphic'                       or ancestor::inlinemediaobject                       or ancestor::inlineequation">0</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$make.graphic.viewport"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+<!--
+  <xsl:message>=====================================
+scale: <xsl:value-of select="$scale"/>, <xsl:value-of select="$scalefit"/>
+ at contentwidth <xsl:value-of select="@contentwidth"/>
+$contentwidth <xsl:value-of select="$contentwidth"/>
+scaled.contentwidth: <xsl:value-of select="$scaled.contentwidth"/>
+ at width: <xsl:value-of select="@width"/>
+width: <xsl:value-of select="$width"/>
+html.width: <xsl:value-of select="$html.width"/>
+ at contentdepth <xsl:value-of select="@contentdepth"/>
+$contentdepth <xsl:value-of select="$contentdepth"/>
+scaled.contentdepth: <xsl:value-of select="$scaled.contentdepth"/>
+ at depth: <xsl:value-of select="@depth"/>
+depth: <xsl:value-of select="$depth"/>
+html.depth: <xsl:value-of select="$html.depth"/>
+align: <xsl:value-of select="@align"/>
+valign: <xsl:value-of select="@valign"/></xsl:message>
+-->
+
+  <xsl:variable name="scaled" select="@width|@depth|@contentwidth|@contentdepth                         |@scale|@scalefit"/>
+
+  <xsl:variable name="img">
+    <xsl:choose>
+      <xsl:when test="@format = 'SVG'">
+        <object data="{$filename}" type="image/svg+xml">
+          <xsl:call-template name="process.image.attributes">
+            <!--xsl:with-param name="alt" select="$alt"/ there's no alt here-->
+            <xsl:with-param name="html.depth" select="$html.depth"/>
+            <xsl:with-param name="html.width" select="$html.width"/>
+            <xsl:with-param name="longdesc" select="$longdesc"/>
+            <xsl:with-param name="scale" select="$scale"/>
+            <xsl:with-param name="scalefit" select="$scalefit"/>
+            <xsl:with-param name="scaled.contentdepth" select="$scaled.contentdepth"/>
+            <xsl:with-param name="scaled.contentwidth" select="$scaled.contentwidth"/>
+            <xsl:with-param name="viewport" select="$viewport"/>
+          </xsl:call-template>
+          <xsl:if test="@align">
+            <xsl:attribute name="align">
+                <xsl:choose>
+                  <xsl:when test="@align = 'center'">middle</xsl:when>
+                  <xsl:otherwise>
+                    <xsl:value-of select="@align"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+            </xsl:attribute>
+          </xsl:if>
+          <xsl:if test="$use.embed.for.svg != 0">
+            <embed src="{$filename}" type="image/svg+xml">
+              <xsl:call-template name="process.image.attributes">
+                <!--xsl:with-param name="alt" select="$alt"/ there's no alt here -->
+                <xsl:with-param name="html.depth" select="$html.depth"/>
+                <xsl:with-param name="html.width" select="$html.width"/>
+                <xsl:with-param name="longdesc" select="$longdesc"/>
+                <xsl:with-param name="scale" select="$scale"/>
+                <xsl:with-param name="scalefit" select="$scalefit"/>
+                <xsl:with-param name="scaled.contentdepth" select="$scaled.contentdepth"/>
+                <xsl:with-param name="scaled.contentwidth" select="$scaled.contentwidth"/>
+                <xsl:with-param name="viewport" select="$viewport"/>
+              </xsl:call-template>
+            </embed>
+          </xsl:if>
+        </object>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:element name="{$tag}" namespace="http://www.w3.org/1999/xhtml">
+	  <xsl:if test="$tag = 'img' and ../../self::imageobjectco">
+	    <xsl:choose>
+	      <xsl:when test="$scaled">
+		<!-- It might be possible to handle some scaling; needs -->
+		<!-- more investigation -->
+		<xsl:message>
+		  <xsl:text>Warning: imagemaps not supported </xsl:text>
+		  <xsl:text>on scaled images</xsl:text>
+		</xsl:message>
+	      </xsl:when>
+	      <xsl:otherwise>
+		<xsl:attribute name="border">0</xsl:attribute>
+		<xsl:attribute name="usemap">
+		  <xsl:value-of select="generate-id(../..)"/>
+		</xsl:attribute>
+	      </xsl:otherwise>
+	    </xsl:choose>
+	  </xsl:if>
+
+          <xsl:attribute name="src">
+	    <xsl:choose>
+	      <xsl:when test="$img.src.path != '' and          $tag = 'img' and                        not(starts-with($filename, '/')) and          not(contains($filename, '://'))">
+	        <xsl:value-of select="$img.src.path"/>
+	      </xsl:when>
+	    </xsl:choose>
+            <xsl:value-of select="$filename"/>
+          </xsl:attribute>
+
+          <xsl:if test="@align">
+            <xsl:attribute name="align">
+              <xsl:choose>
+                <xsl:when test="@align = 'center'">middle</xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="@align"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:attribute>
+          </xsl:if>
+
+          <xsl:call-template name="process.image.attributes">
+            <xsl:with-param name="alt">
+              <xsl:choose>
+                <xsl:when test="$alt != ''">
+                  <xsl:copy-of select="$alt"/>
+                </xsl:when>
+                <xsl:when test="ancestor::figure">
+                  <xsl:value-of select="normalize-space(ancestor::figure/title)"/>
+                </xsl:when>
+              </xsl:choose>
+            </xsl:with-param>
+            <xsl:with-param name="html.depth" select="$html.depth"/>
+            <xsl:with-param name="html.width" select="$html.width"/>
+            <xsl:with-param name="longdesc" select="$longdesc"/>
+            <xsl:with-param name="scale" select="$scale"/>
+            <xsl:with-param name="scalefit" select="$scalefit"/>
+            <xsl:with-param name="scaled.contentdepth" select="$scaled.contentdepth"/>
+            <xsl:with-param name="scaled.contentwidth" select="$scaled.contentwidth"/>
+            <xsl:with-param name="viewport" select="$viewport"/>
+          </xsl:call-template>
+        </xsl:element>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="bgcolor">
+    <xsl:call-template name="dbhtml-attribute">
+      <xsl:with-param name="pis" select="../processing-instruction('dbhtml')"/>
+      <xsl:with-param name="attribute" select="'background-color'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="use.viewport" select="$viewport != 0                         and ($html.width != ''                              or ($html.depth != '' and $depth-units != '%')                              or $bgcolor != ''                              or @valign)"/>
+
+  <xsl:choose>
+    <xsl:when test="$use.viewport">
+      <table border="0" summary="manufactured viewport for HTML img" cellspacing="0" cellpadding="0">
+        <xsl:if test="$html.width != ''">
+          <xsl:attribute name="width">
+            <xsl:value-of select="$html.width"/>
+          </xsl:attribute>
+        </xsl:if>
+        <tr>
+          <xsl:if test="$html.depth != '' and $depth-units != '%'">
+            <!-- don't do this for percentages because browsers get confused -->
+            <xsl:choose>
+              <xsl:when test="$css.decoration != 0">
+                <xsl:attribute name="style">
+                  <xsl:text>height: </xsl:text>
+                  <xsl:value-of select="$html.depth"/>
+                  <xsl:text>px</xsl:text>
+                </xsl:attribute>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:attribute name="height">
+                  <xsl:value-of select="$html.depth"/>
+                </xsl:attribute>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:if>
+          <td>
+            <xsl:if test="$bgcolor != ''">
+              <xsl:choose>
+                <xsl:when test="$css.decoration != 0">
+                  <xsl:attribute name="style">
+                    <xsl:text>background-color: </xsl:text>
+                    <xsl:value-of select="$bgcolor"/>
+                  </xsl:attribute>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:attribute name="bgcolor">
+                    <xsl:value-of select="$bgcolor"/>
+                  </xsl:attribute>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:if>
+            <xsl:if test="@align">
+              <xsl:attribute name="align">
+                <xsl:value-of select="@align"/>
+              </xsl:attribute>
+            </xsl:if>
+            <xsl:if test="@valign">
+              <xsl:attribute name="valign">
+                <xsl:value-of select="@valign"/>
+              </xsl:attribute>
+            </xsl:if>
+            <xsl:copy-of select="$img"/>
+          </td>
+        </tr>
+      </table>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy-of select="$img"/>
+    </xsl:otherwise>
+  </xsl:choose>
+
+  <xsl:if test="$tag = 'img' and ../../self::imageobjectco and not($scaled)">
+    <map name="{generate-id(../..)}">
+      <xsl:for-each select="../../areaspec//area">
+	<xsl:variable name="units">
+	  <xsl:choose>
+	    <xsl:when test="@units">
+	      <xsl:value-of select="@units"/>
+	    </xsl:when>
+	    <xsl:when test="../@units">
+	      <xsl:value-of select="../@units"/>
+	    </xsl:when>
+	    <xsl:otherwise>calspair</xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+
+	<xsl:choose>
+	  <xsl:when test="$units = 'calspair'">
+	    <xsl:variable name="coords" select="normalize-space(@coords)"/>
+	    <xsl:variable name="p1" select="substring-before($coords, ' ')"/>
+	    <xsl:variable name="p2" select="substring-after($coords, ' ')"/>
+
+	    <xsl:variable name="x1" select="substring-before($p1,',')"/>
+	    <xsl:variable name="y1" select="substring-after($p1,',')"/>
+	    <xsl:variable name="x2" select="substring-before($p2,',')"/>
+	    <xsl:variable name="y2" select="substring-after($p2,',')"/>
+
+	    <xsl:variable name="x1p" select="$x1 div 100.0"/>
+	    <xsl:variable name="y1p" select="$y1 div 100.0"/>
+	    <xsl:variable name="x2p" select="$x2 div 100.0"/>
+	    <xsl:variable name="y2p" select="$y2 div 100.0"/>
+
+<!--
+	    <xsl:message>
+	      <xsl:text>units: </xsl:text>
+	      <xsl:value-of select="$units"/>
+	      <xsl:text> </xsl:text>
+	      <xsl:value-of select="$x1p"/><xsl:text>, </xsl:text>
+	      <xsl:value-of select="$y1p"/><xsl:text>, </xsl:text>
+	      <xsl:value-of select="$x2p"/><xsl:text>, </xsl:text>
+	      <xsl:value-of select="$y2p"/><xsl:text>, </xsl:text>
+	    </xsl:message>
+
+	    <xsl:message>
+	      <xsl:text>      </xsl:text>
+	      <xsl:value-of select="$intrinsicwidth"/>
+	      <xsl:text>, </xsl:text>
+	      <xsl:value-of select="$intrinsicdepth"/>
+	    </xsl:message>
+
+	    <xsl:message>
+	      <xsl:text>      </xsl:text>
+	      <xsl:value-of select="$units"/>
+	      <xsl:text> </xsl:text>
+	      <xsl:value-of select="round($x1p * $intrinsicwidth div 100.0)"/>
+	      <xsl:text>,</xsl:text>
+	      <xsl:value-of select="round($intrinsicdepth
+				    - ($y1p * $intrinsicdepth div 100.0))"/>
+	      <xsl:text>,</xsl:text>
+	      <xsl:value-of select="round($x2p * $intrinsicwidth div 100.0)"/>
+	      <xsl:text>,</xsl:text>
+	      <xsl:value-of select="round($intrinsicdepth
+				    - ($y2p * $intrinsicdepth div 100.0))"/>
+	    </xsl:message>
+-->
+
+	    <area shape="rect">
+	      <xsl:choose>
+		<xsl:when test="@linkends">
+		  <xsl:variable name="linkends" select="normalize-space(@linkends)"/>
+		  <xsl:variable name="linkend">
+		    <xsl:choose>
+		      <xsl:when test="contains($linkends, ' ')">
+			<xsl:value-of select="substring-before($linkends, ' ')"/>
+		      </xsl:when>
+		      <xsl:otherwise>
+			<xsl:value-of select="$linkends"/>
+		      </xsl:otherwise>
+		    </xsl:choose>
+		  </xsl:variable>
+
+		  <xsl:variable name="target" select="key('id', $linkend)[1]"/>
+		
+		  <xsl:if test="$target">
+		    <xsl:attribute name="href">
+		      <xsl:call-template name="href.target">
+			<xsl:with-param name="object" select="$target"/>
+		      </xsl:call-template>
+		    </xsl:attribute>
+		  </xsl:if>
+		</xsl:when>
+		<xsl:when test="@xlink:href">
+		  <xsl:attribute name="href">
+		    <xsl:value-of select="@xlink:href"/>
+		  </xsl:attribute>
+		</xsl:when>
+	      </xsl:choose>
+
+	      <xsl:if test="alt">
+		<xsl:attribute name="alt">
+		  <xsl:value-of select="alt[1]"/>
+		</xsl:attribute>
+	      </xsl:if>
+
+	      <xsl:attribute name="coords">
+		<xsl:value-of select="round($x1p * $intrinsicwidth div 100.0)"/>
+		<xsl:text>,</xsl:text>
+                <xsl:value-of select="round($intrinsicdepth                                         - ($y1p * $intrinsicdepth div 100.0))"/>
+		<xsl:text>,</xsl:text>
+		<xsl:value-of select="round($x2p * $intrinsicwidth div 100.0)"/>
+		<xsl:text>,</xsl:text>
+		<xsl:value-of select="round($intrinsicdepth             - ($y2p * $intrinsicdepth div 100.0))"/>
+	      </xsl:attribute>
+	    </area>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <xsl:message>
+	      <xsl:text>Warning: only calspair supported </xsl:text>
+	      <xsl:text>in imageobjectco</xsl:text>
+	    </xsl:message>
+	  </xsl:otherwise>
+	</xsl:choose>
+      </xsl:for-each>
+    </map>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="process.image.attributes">
+  <xsl:param name="alt"/>
+  <xsl:param name="html.width"/>
+  <xsl:param name="html.depth"/>
+  <xsl:param name="longdesc"/>
+  <xsl:param name="scale"/>
+  <xsl:param name="scalefit"/>
+  <xsl:param name="scaled.contentdepth"/>
+  <xsl:param name="scaled.contentwidth"/>
+  <xsl:param name="viewport"/>
+
+  <xsl:choose>
+    <xsl:when test="@contentwidth or @contentdepth">
+      <!-- ignore @width/@depth, @scale, and @scalefit if specified -->
+      <xsl:if test="@contentwidth">
+        <xsl:attribute name="width">
+          <xsl:value-of select="$scaled.contentwidth"/>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:if test="@contentdepth">
+        <xsl:attribute name="height">
+          <xsl:value-of select="$scaled.contentdepth"/>
+        </xsl:attribute>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="number($scale) != 1.0">
+      <!-- scaling is always uniform, so we only have to specify one dimension -->
+      <!-- ignore @scalefit if specified -->
+      <xsl:attribute name="width">
+        <xsl:value-of select="$scaled.contentwidth"/>
+      </xsl:attribute>
+    </xsl:when>
+
+    <xsl:when test="$scalefit != 0">
+      <xsl:choose>
+        <xsl:when test="contains($html.width, '%')">
+          <xsl:choose>
+            <xsl:when test="$viewport != 0">
+              <!-- The *viewport* will be scaled, so use 100% here! -->
+              <xsl:attribute name="width">
+                <xsl:value-of select="'100%'"/>
+              </xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:attribute name="width">
+                <xsl:value-of select="$html.width"/>
+              </xsl:attribute>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+
+        <xsl:when test="contains($html.depth, '%')">
+          <!-- HTML doesn't deal with this case very well...do nothing -->
+        </xsl:when>
+
+        <xsl:when test="$scaled.contentwidth != '' and $html.width != ''                         and $scaled.contentdepth != '' and $html.depth != ''">
+          <!-- scalefit should not be anamorphic; figure out which direction -->
+          <!-- has the limiting scale factor and scale in that direction -->
+          <xsl:choose>
+            <xsl:when test="$html.width div $scaled.contentwidth &gt;                             $html.depth div $scaled.contentdepth">
+              <xsl:attribute name="height">
+                <xsl:value-of select="$html.depth"/>
+              </xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:attribute name="width">
+                <xsl:value-of select="$html.width"/>
+              </xsl:attribute>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+
+        <xsl:when test="$scaled.contentwidth != '' and $html.width != ''">
+          <xsl:attribute name="width">
+            <xsl:value-of select="$html.width"/>
+          </xsl:attribute>
+        </xsl:when>
+
+        <xsl:when test="$scaled.contentdepth != '' and $html.depth != ''">
+          <xsl:attribute name="height">
+            <xsl:value-of select="$html.depth"/>
+          </xsl:attribute>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:when>
+  </xsl:choose>
+
+  <xsl:if test="$alt != ''">
+    <xsl:attribute name="alt">
+      <xsl:value-of select="$alt"/>
+    </xsl:attribute>
+  </xsl:if>
+
+  <xsl:if test="$longdesc != ''">
+    <xsl:attribute name="longdesc">
+      <xsl:value-of select="$longdesc"/>
+    </xsl:attribute>
+  </xsl:if>
+
+  <xsl:if test="@align and $viewport = 0">
+    <xsl:attribute name="align">
+      <xsl:choose>
+        <xsl:when test="@align = 'center'">middle</xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="@align"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:attribute>
+  </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="graphic">
+  <xsl:choose>
+    <xsl:when test="parent::inlineequation">
+      <xsl:call-template name="anchor"/>
+      <xsl:call-template name="process.image"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <div>
+        <xsl:if test="@align">
+          <xsl:attribute name="align">
+            <xsl:value-of select="@align"/>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:call-template name="anchor"/>
+        <xsl:call-template name="process.image"/>
+      </div>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="inlinegraphic">
+  <xsl:variable name="filename">
+    <xsl:choose>
+      <xsl:when test="@entityref">
+        <xsl:value-of select="unparsed-entity-uri(@entityref)"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="@fileref"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:if test="@id">
+    <a id="{@id}"/>
+  </xsl:if>
+
+  <xsl:choose>
+    <xsl:when test="@format='linespecific'">
+      <xsl:choose>
+        <xsl:when test="$use.extensions != '0'                         and $textinsert.extension != '0'">
+          <xsl:choose>
+            <xsl:when test="element-available('stext:insertfile')">
+              <stext:insertfile href="{$filename}" encoding="{$textdata.default.encoding}"/>
+            </xsl:when>
+            <xsl:when test="element-available('xtext:insertfile')">
+              <xtext:insertfile href="{$filename}"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:message terminate="yes">
+                <xsl:text>No insertfile extension available.</xsl:text>
+              </xsl:message>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <a xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" href="{$filename}"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="process.image"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="mediaobject|mediaobjectco">
+
+  <xsl:variable name="olist" select="imageobject|imageobjectco                      |videoobject|audioobject                      |textobject"/>
+
+  <xsl:variable name="object.index">
+    <xsl:call-template name="select.mediaobject.index">
+      <xsl:with-param name="olist" select="$olist"/>
+      <xsl:with-param name="count" select="1"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="object" select="$olist[position() = $object.index]"/>
+
+  <xsl:variable name="align">
+    <xsl:value-of select="$object/descendant::imagedata[@align][1]/@align"/>
+  </xsl:variable>
+
+  <div class="{name(.)}">
+    <xsl:if test="$align != '' ">
+      <xsl:attribute name="align">
+        <xsl:value-of select="$align"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@id">
+      <a id="{@id}"/>
+    </xsl:if>
+
+    <xsl:apply-templates select="$object"/>
+    <xsl:apply-templates select="caption"/>
+  </div>
+</xsl:template>
+
+<xsl:template match="inlinemediaobject">
+  <span class="{name(.)}">
+    <xsl:if test="@id">
+      <a id="{@id}"/>
+    </xsl:if>
+    <xsl:call-template name="select.mediaobject"/>
+  </span>
+</xsl:template>
+
+<xsl:template match="programlisting/inlinemediaobject                      |screen/inlinemediaobject" priority="2">
+  <!-- the additional span causes problems in some cases -->
+  <xsl:call-template name="select.mediaobject"/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="imageobjectco">
+  <xsl:if test="@id">
+    <a id="{@id}"/>
+  </xsl:if>
+  <xsl:apply-templates select="imageobject"/>
+  <xsl:apply-templates select="calloutlist"/>
+</xsl:template>
+
+<xsl:template match="imageobject">
+  <xsl:choose>
+    <xsl:when xmlns:svg="http://www.w3.org/2000/svg" test="svg:*">
+      <xsl:apply-templates/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates select="imagedata"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="imagedata">
+  <xsl:variable name="filename">
+    <xsl:call-template name="mediaobject.filename">
+      <xsl:with-param name="object" select=".."/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="@format='linespecific'">
+      <xsl:choose>
+        <xsl:when test="$use.extensions != '0'                         and $textinsert.extension != '0'">
+          <xsl:choose>
+            <xsl:when test="element-available('stext:insertfile')">
+              <stext:insertfile href="{$filename}" encoding="{$textdata.default.encoding}"/>
+            </xsl:when>
+            <xsl:when test="element-available('xtext:insertfile')">
+              <xtext:insertfile href="{$filename}"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:message terminate="yes">
+                <xsl:text>No insertfile extension available.</xsl:text>
+              </xsl:message>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <a xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" href="{$filename}"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:variable name="longdesc.uri">
+        <xsl:call-template name="longdesc.uri">
+          <xsl:with-param name="mediaobject" select="ancestor::imageobject/parent::*"/>
+        </xsl:call-template>
+      </xsl:variable>
+
+      <xsl:variable name="phrases" select="ancestor::mediaobject/textobject[phrase]                             |ancestor::inlinemediaobject/textobject[phrase]                             |ancestor::mediaobjectco/textobject[phrase]"/>
+
+      <xsl:call-template name="process.image">
+        <xsl:with-param name="alt">
+          <xsl:apply-templates select="$phrases[not(@role) or @role!='tex'][1]"/>
+        </xsl:with-param>
+        <xsl:with-param name="longdesc">
+          <xsl:call-template name="write.longdesc">
+            <xsl:with-param name="mediaobject" select="ancestor::imageobject/parent::*"/>
+          </xsl:call-template>
+        </xsl:with-param>
+      </xsl:call-template>
+
+      <xsl:if test="$html.longdesc != 0 and $html.longdesc.link != 0                     and ancestor::imageobject/parent::*/textobject[not(phrase)]">
+        <xsl:call-template name="longdesc.link">
+          <xsl:with-param name="longdesc.uri" select="$longdesc.uri"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="longdesc.uri">
+  <xsl:param name="mediaobject" select="."/>
+
+  <xsl:if test="$html.longdesc">
+    <xsl:if test="$mediaobject/textobject[not(phrase)]">
+      <xsl:variable name="image-id">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="$mediaobject"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:variable name="dbhtml.dir">
+        <xsl:call-template name="dbhtml-dir"/>
+      </xsl:variable>
+      <xsl:variable name="filename">
+        <xsl:call-template name="make-relative-filename">
+          <xsl:with-param name="base.dir">
+            <xsl:choose>
+              <xsl:when test="$dbhtml.dir != ''">
+                <xsl:value-of select="$dbhtml.dir"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="$base.dir"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:with-param>
+          <xsl:with-param name="base.name" select="concat('ld-',$image-id,$html.ext)"/>
+        </xsl:call-template>
+      </xsl:variable>
+
+      <xsl:value-of select="$filename"/>
+    </xsl:if>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="write.longdesc">
+  <xsl:param name="mediaobject" select="."/>
+  <xsl:if test="$html.longdesc != 0 and $mediaobject/textobject[not(phrase)]">
+    <xsl:variable name="filename">
+      <xsl:call-template name="longdesc.uri">
+        <xsl:with-param name="mediaobject" select="$mediaobject"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:value-of select="$filename"/>
+
+    <xsl:call-template name="write.chunk">
+      <xsl:with-param name="filename" select="$filename"/>
+      <xsl:with-param name="quiet" select="$chunk.quietly"/>
+      <xsl:with-param name="content">
+      <xsl:call-template name="user.preroot"/>
+        <html>
+          <head>
+            <xsl:call-template name="system.head.content"/>
+            <xsl:call-template name="head.content">
+              <xsl:with-param name="title" select="'Long Description'"/>
+            </xsl:call-template>
+            <xsl:call-template name="user.head.content"/>
+          </head>
+          <body>
+            <xsl:call-template name="body.attributes"/>
+            <xsl:for-each select="$mediaobject/textobject[not(phrase)]">
+              <xsl:apply-templates select="./*"/>
+            </xsl:for-each>
+          </body>
+        </html>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="longdesc.link">
+  <xsl:param name="longdesc.uri" select="''"/>
+
+  <xsl:variable name="this.uri">
+    <xsl:call-template name="make-relative-filename">
+      <xsl:with-param name="base.dir" select="$base.dir"/>
+      <xsl:with-param name="base.name">
+        <xsl:call-template name="href.target.uri"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="href.to">
+    <xsl:call-template name="trim.common.uri.paths">
+      <xsl:with-param name="uriA" select="$longdesc.uri"/>
+      <xsl:with-param name="uriB" select="$this.uri"/>
+      <xsl:with-param name="return" select="'A'"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <div class="longdesc-link" align="right">
+    <br clear="all"/>
+    <span class="longdesc-link">
+      <xsl:text>[</xsl:text>
+      <a href="{$href.to}" target="longdesc">D</a>
+      <xsl:text>]</xsl:text>
+    </span>
+  </div>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="videoobject">
+  <xsl:apply-templates select="videodata"/>
+</xsl:template>
+
+<xsl:template match="videodata">
+  <xsl:call-template name="process.image">
+    <xsl:with-param name="tag" select="'embed'"/>
+    <xsl:with-param name="alt">
+      <xsl:apply-templates select="(../../textobject/phrase)[1]"/>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="audioobject">
+  <xsl:apply-templates select="audiodata"/>
+</xsl:template>
+
+<xsl:template match="audiodata">
+  <xsl:call-template name="process.image">
+    <xsl:with-param name="tag" select="'embed'"/>
+    <xsl:with-param name="alt">
+      <xsl:apply-templates select="(../../textobject/phrase)[1]"/>
+    </xsl:with-param>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="textobject">
+  <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="textdata">
+  <xsl:variable name="filename">
+    <xsl:choose>
+      <xsl:when test="@entityref">
+        <xsl:value-of select="unparsed-entity-uri(@entityref)"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="@fileref"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="encoding">
+    <xsl:choose>
+      <xsl:when test="@encoding">
+        <xsl:value-of select="@encoding"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$textdata.default.encoding"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$use.extensions != '0'                     and $textinsert.extension != '0'">
+      <xsl:choose>
+        <xsl:when test="element-available('stext:insertfile')">
+          <stext:insertfile href="{$filename}" encoding="{$encoding}"/>
+        </xsl:when>
+        <xsl:when test="element-available('xtext:insertfile')">
+          <xtext:insertfile href="{$filename}"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:message terminate="yes">
+            <xsl:text>No insertfile extension available.</xsl:text>
+          </xsl:message>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <a xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" href="{$filename}"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="caption">
+  <div class="{name(.)}">
+    <xsl:if test="@align = 'right' or @align = 'left' or @align='center'">
+      <xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute>
+    </xsl:if>
+    <xsl:apply-templates/>
+  </div>
+</xsl:template>
+
+<!-- ==================================================================== -->
+<!-- "Support" for SVG -->
+
+<xsl:template xmlns:svg="http://www.w3.org/2000/svg" match="svg:*">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+
+<!-- Resolve xml:base attributes -->
+<xsl:template match="@fileref">
+  <!-- need a check for absolute urls -->
+  <xsl:choose>
+    <xsl:when test="contains(., ':')">
+      <!-- it has a uri scheme so it is an absolute uri -->
+      <xsl:value-of select="."/>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- its a relative uri -->
+      <xsl:call-template name="relative-uri">
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>

Added: public/phoenix/utils/xhtml/html-rtf.xsl
===================================================================
--- public/phoenix/utils/xhtml/html-rtf.xsl	2006-04-26 15:54:08 UTC (rev 12837)
+++ public/phoenix/utils/xhtml/html-rtf.xsl	2006-04-26 16:09:22 UTC (rev 12838)
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!--This file was created automatically by html2xhtml-->
+<!--from the HTML stylesheets. Do not edit this file.-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:set="http://exslt.org/sets" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="exsl set" version="1.0">
+
+<!-- ********************************************************************
+     $Id: html-rtf.xsl,v 1.11 2003/11/30 19:42:23 bobstayton Exp $
+     ********************************************************************
+
+     This file is part of the XSL DocBook Stylesheet distribution.
+     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+     and other information.
+
+     ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<!-- This module contains templates that match against HTML nodes. It is used
+     to post-process result tree fragments for some sorts of cleanup.
+     These templates can only ever be fired by a processor that supports
+     exslt:node-set(). -->
+
+<!-- ==================================================================== -->
+
+<!-- insert.html.p mode templates insert a particular RTF at the beginning
+     of the first paragraph in the primary RTF. -->
+
+<xsl:template match="/" mode="insert.html.p">
+  <xsl:param name="mark" select="'?'"/>
+  <xsl:apply-templates mode="insert.html.p">
+    <xsl:with-param name="mark" select="$mark"/>
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="*" mode="insert.html.p">
+  <xsl:param name="mark" select="'?'"/>
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates mode="insert.html.p">
+      <xsl:with-param name="mark" select="$mark"/>
+    </xsl:apply-templates>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template xmlns:html="http://www.w3.org/1999/xhtml" match="html:p|p" mode="insert.html.p">
+  <xsl:param name="mark" select="'?'"/>
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:if test="not(preceding::p|preceding::html:p)">
+      <xsl:copy-of select="$mark"/>
+    </xsl:if>
+    <xsl:apply-templates mode="insert.html.p">
+      <xsl:with-param name="mark" select="$mark"/>
+    </xsl:apply-templates>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="text()|processing-instruction()|comment()" mode="insert.html.p">
+  <xsl:param name="mark" select="'?'"/>
+  <xsl:copy/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<!-- insert.html.text mode templates insert a particular RTF at the beginning
+     of the first text-node in the primary RTF. -->
+
+<xsl:template match="/" mode="insert.html.text">
+  <xsl:param name="mark" select="'?'"/>
+  <xsl:apply-templates mode="insert.html.text">
+    <xsl:with-param name="mark" select="$mark"/>
+  </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="*" mode="insert.html.text">
+  <xsl:param name="mark" select="'?'"/>
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates mode="insert.html.text">
+      <xsl:with-param name="mark" select="$mark"/>
+    </xsl:apply-templates>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="text()|processing-instruction()|comment()" mode="insert.html.text">
+  <xsl:param name="mark" select="'?'"/>
+
+  <xsl:if test="not(preceding::text())">
+    <xsl:copy-of select="$mark"/>
+  </xsl:if>
+
+  <xsl:copy/>
+</xsl:template>
+
+<xsl:template match="processing-instruction()|comment()" mode="insert.html.text">
+  <xsl:param name="mark" select="'?'"/>
+  <xsl:copy/>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<!-- unwrap.p mode templates remove blocks from HTML p elements (and
+     other places where blocks aren't allowed) -->
+
+<xsl:template name="unwrap.p">
+  <xsl:param name="p"/>
+  <xsl:choose>
+    <xsl:when test="function-available('exsl:node-set')                     and function-available('set:leading')                     and function-available('set:trailing')">
+      <xsl:apply-templates select="exsl:node-set($p)" mode="unwrap.p"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy-of select="$p"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template xmlns:html="http://www.w3.org/1999/xhtml" match="html:p|p" mode="unwrap.p">
+  <!-- xmlns:html is necessary for the xhtml stylesheet case -->
+  <xsl:variable name="blocks" select="address|blockquote|div|hr|h1|h2|h3|h4|h5|h6                         |layer|p|pre|table|dl|menu|ol|ul|form                         |html:address|html:blockquote|html:div|html:hr                         |html:h1|html:h2|html:h3|html:h4|html:h5|html:h6                         |html:layer|html:p|html:pre|html:table|html:dl                         |html:menu|html:ol|html:ul|html:form"/>
+  <xsl:choose>
+    <xsl:when test="$blocks">
+      <xsl:call-template name="unwrap.p.nodes">
+        <xsl:with-param name="wrap" select="."/>
+        <xsl:with-param name="first" select="1"/>
+        <xsl:with-param name="nodes" select="node()"/>
+        <xsl:with-param name="blocks" select="$blocks"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy>
+        <xsl:copy-of select="@*"/>
+        <xsl:apply-templates mode="unwrap.p"/>
+      </xsl:copy>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*" mode="unwrap.p">
+  <xsl:copy>
+    <xsl:copy-of select="@*"/>
+    <xsl:apply-templates mode="unwrap.p"/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template match="text()|processing-instruction()|comment()" mode="unwrap.p">
+  <xsl:copy/>
+</xsl:template>
+
+<xsl:template name="unwrap.p.nodes">
+  <xsl:param name="wrap" select="."/>
+  <xsl: