$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: matias_at_[hidden]
Date: 2007-06-14 20:53:52
Author: matias
Date: 2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
New Revision: 7049
URL: http://svn.boost.org/trac/boost/changeset/7049
Log:
xsl test
Added:
   sandbox/doc_test/xsl_test/
   sandbox/doc_test/xsl_test/admon.xsl
   sandbox/doc_test/xsl_test/annotation.xsl
   sandbox/doc_test/xsl_test/callout.xsl
   sandbox/doc_test/xsl_test/chunk-common.xsl
   sandbox/doc_test/xsl_test/docbook-layout.xsl
   sandbox/doc_test/xsl_test/docbook.xsl
   sandbox/doc_test/xsl_test/error.xsl
   sandbox/doc_test/xsl_test/fo.xsl
   sandbox/doc_test/xsl_test/footer.xsl
   sandbox/doc_test/xsl_test/function.xsl
   sandbox/doc_test/xsl_test/global.xsl   (contents, props changed)
   sandbox/doc_test/xsl_test/header.xsl
   sandbox/doc_test/xsl_test/html-single.xsl
   sandbox/doc_test/xsl_test/html.xsl
   sandbox/doc_test/xsl_test/index.xsl
   sandbox/doc_test/xsl_test/javascript.xsl
   sandbox/doc_test/xsl_test/library.xsl
   sandbox/doc_test/xsl_test/lookup.xsl
   sandbox/doc_test/xsl_test/macro.xsl
   sandbox/doc_test/xsl_test/manpages.xsl
   sandbox/doc_test/xsl_test/navbar.xsl
   sandbox/doc_test/xsl_test/reference.xsl
   sandbox/doc_test/xsl_test/relative-href.xsl
   sandbox/doc_test/xsl_test/source-highlight.xsl
   sandbox/doc_test/xsl_test/template.xsl
   sandbox/doc_test/xsl_test/type.xsl
   sandbox/doc_test/xsl_test/utility.xsl
   sandbox/doc_test/xsl_test/xhtml.xsl
   sandbox/doc_test/xsl_test/xref.xsl
Added: sandbox/doc_test/xsl_test/admon.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/admon.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+<!-- Not needed?
+
+xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/admon.xsl"/
+
+-->
+
+<xsl:import href="relative-href.xsl"/>
+
+   <xsl:template name="admon.graphic">
+      <xsl:param name="node" select="."/>
+
+      <xsl:call-template name="href.target.relative">
+         <xsl:with-param name="target" select="$admon.graphics.path"/>
+      </xsl:call-template>
+
+      <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>
+
+
+   <!-- overwrites docbook graphical.admonition -->
+
+   <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(.)}">
+         <div class="admonition-graphic">
+            <img alt="[{$alt}]">
+               <xsl:attribute name="src">
+                  <xsl:call-template name="admon.graphic"/>
+               </xsl:attribute>
+            </img>
+         </div>
+         <div class="admonition-body">
+         <div class="admonition-title">
+            <xsl:call-template name="anchor"/>
+            <xsl:if test="$admon.textlabel != 0 or title">
+               <xsl:apply-templates select="." mode="object.title.markup"/>
+            </xsl:if>
+         </div>
+         <div class="admonition-content">
+            <xsl:apply-templates/>
+         </div>
+         </div>
+      </div>
+
+   </xsl:template>
+
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/annotation.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/annotation.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,385 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+  <xsl:key name="classes" match="class|struct|union" use="@name"/>
+  <xsl:key name="methods" match="method|overloaded-method" use="@name"/>
+  <xsl:key name="functions" match="function|overloaded-function" use="@name"/>
+  <xsl:key name="enums" match="enum" use="@name"/>
+  <xsl:key name="concepts" match="concept" use="@name"/>
+  <xsl:key name="libraries" match="library" use="@name"/>
+  <xsl:key name="macros" match="macro" use="@name"/>
+  <xsl:key name="headers" match="header" use="@name"/>
+  <xsl:key name="named-entities" match="class|struct|union|concept|function|overloaded-function|macro|library|namespace/data-member|header/data-member|*[attribute::id]" use="@name|@id"/>
+
+  <xsl:template match="function|overloaded-function" mode="generate.id">
+    <xsl:variable name="name" select="normalize-space(@name)"/>
+    <xsl:variable name="translated-name"
+                  select="translate($name, 
+                                    '~!%^&*()[].,<>|/ +-=', 
+                                    'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')"/>
+                      
+    <xsl:choose>
+      <xsl:when test="count(key('named-entities', $name))=1
+                      and ($translated-name=$name)">
+        <xsl:call-template name="fully-qualified-name">
+          <xsl:with-param name="node" select="."/>
+          <xsl:with-param name="separator" select="'.'"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text>-bb</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="classname" mode="annotation">
+    <!-- Determine the (possibly qualified) class name we are looking for -->
+    <xsl:variable name="fullname">
+      <xsl:choose>
+        <xsl:when test="@alt">
+          <xsl:value-of select="@alt"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="string(.)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- Strip off any instantiation -->
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="contains($fullname, '<')">
+          <xsl:value-of select="substring-before($fullname, '<')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$fullname"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- Determine the unqualified name -->
+    <xsl:variable name="unqualified-name">
+      <xsl:call-template name="strip-qualifiers">
+        <xsl:with-param name="name" select="$name"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:call-template name="cxx-link-name">
+      <xsl:with-param name="lookup" select="."/>
+      <xsl:with-param name="type" select="'class'"/>
+      <xsl:with-param name="name" select="$name"/>
+      <xsl:with-param name="display-name" select="string(.)"/>
+      <xsl:with-param name="unqualified-name" select="$unqualified-name"/>
+      <xsl:with-param name="nodes" select="key('classes', $unqualified-name)"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="methodname" mode="annotation">
+    <!-- Determine the (possibly qualified) method name we are looking for -->
+    <xsl:variable name="fullname">
+      <xsl:choose>
+        <xsl:when test="@alt">
+          <xsl:value-of select="@alt"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="string(.)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- Strip off any call -->
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="contains($fullname, '(')">
+          <xsl:value-of select="substring-before($fullname, '(')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$fullname"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- Determine the unqualified name -->
+    <xsl:variable name="unqualified-name">
+      <xsl:call-template name="strip-qualifiers">
+        <xsl:with-param name="name" select="$name"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:call-template name="cxx-link-name">
+      <xsl:with-param name="lookup" select="."/>
+      <xsl:with-param name="type" select="'method'"/>
+      <xsl:with-param name="name" select="$name"/>
+      <xsl:with-param name="display-name" select="string(.)"/>
+      <xsl:with-param name="unqualified-name" select="$unqualified-name"/>
+      <xsl:with-param name="nodes" select="key('methods', $unqualified-name)"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="functionname" mode="annotation">
+    <!-- Determine the (possibly qualified) function name we are
+         looking for -->
+    <xsl:variable name="fullname">
+      <xsl:choose>
+        <xsl:when test="@alt">
+          <xsl:value-of select="@alt"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="string(.)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- Strip off any call -->
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="contains($fullname, '(')">
+          <xsl:value-of select="substring-before($fullname, '(')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$fullname"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- Determine the unqualified name -->
+    <xsl:variable name="unqualified-name">
+      <xsl:call-template name="strip-qualifiers">
+        <xsl:with-param name="name" select="$name"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:call-template name="cxx-link-name">
+      <xsl:with-param name="lookup" select="."/>
+      <xsl:with-param name="type" select="'function'"/>
+      <xsl:with-param name="name" select="$name"/>
+      <xsl:with-param name="display-name" select="string(.)"/>
+      <xsl:with-param name="unqualified-name" select="$unqualified-name"/>
+      <xsl:with-param name="nodes" 
+        select="key('functions', $unqualified-name)"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="enumname" mode="annotation">
+    <!-- Determine the (possibly qualified) enum name we are
+         looking for -->
+    <xsl:variable name="fullname">
+      <xsl:choose>
+        <xsl:when test="@alt">
+          <xsl:value-of select="@alt"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="string(.)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- Strip off any call -->
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="contains($fullname, '(')">
+          <xsl:value-of select="substring-before($fullname, '(')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$fullname"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- Determine the unqualified name -->
+    <xsl:variable name="unqualified-name">
+      <xsl:call-template name="strip-qualifiers">
+        <xsl:with-param name="name" select="$name"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:call-template name="cxx-link-name">
+      <xsl:with-param name="lookup" select="."/>
+      <xsl:with-param name="type" select="'enum'"/>
+      <xsl:with-param name="name" select="$name"/>
+      <xsl:with-param name="display-name" select="string(.)"/>
+      <xsl:with-param name="unqualified-name" select="$unqualified-name"/>
+      <xsl:with-param name="nodes" 
+        select="key('enums', $unqualified-name)"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="libraryname" mode="annotation">
+    <xsl:variable name="name">
+      <xsl:choose>
+        <xsl:when test="@alt">
+          <xsl:value-of select="@alt"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="text()"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:variable name="node" select="key('libraries', $name)"/>
+    
+    <xsl:choose>
+      <xsl:when test="count($node)=0">
+        <xsl:message>
+          <xsl:text>warning: Cannot find library '</xsl:text>
+          <xsl:value-of select="$name"/>
+          <xsl:text>'</xsl:text>
+        </xsl:message>
+        <xsl:value-of select="$name"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="library.link">
+          <xsl:with-param name="node" select="$node"/>
+          <xsl:with-param name="name" select="text()"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="conceptname" mode="annotation">
+    <xsl:param name="name" select="text()"/>
+
+    <xsl:call-template name="concept.link">
+      <xsl:with-param name="name" select="$name"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="macroname" mode="annotation">
+    <xsl:param name="name" select="text()"/>
+    
+    <xsl:variable name="node" select="key('macros', $name)"/>
+    <xsl:choose>
+      <xsl:when test="count($node) = 0">
+        <xsl:message>
+          <xsl:text>warning: cannot find macro `</xsl:text>
+          <xsl:value-of select="$name"/>
+          <xsl:text>'</xsl:text>
+        </xsl:message>
+        <xsl:value-of select="$name"/>
+      </xsl:when>
+
+      <xsl:when test="count($node) = 1">
+        <xsl:call-template name="internal-link">
+          <xsl:with-param name="to">
+            <xsl:call-template name="generate.id">
+              <xsl:with-param name="node" select="$node"/>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="text" select="$name"/>
+        </xsl:call-template>
+      </xsl:when>
+
+      <xsl:otherwise>
+        <xsl:message>
+          <xsl:text>error: macro `</xsl:text>
+          <xsl:value-of select="$name"/>
+          <xsl:text>' is multiply defined.</xsl:text>
+        </xsl:message>
+        <xsl:value-of select="$node"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="headername" mode="annotation">
+    <xsl:param name="name" select="text()"/>
+    
+    <xsl:variable name="node" select="key('headers', $name)"/>
+    <xsl:choose>
+      <xsl:when test="count($node) = 0">
+        <xsl:message>
+          <xsl:text>warning: cannot find header `</xsl:text>
+          <xsl:value-of select="$name"/>
+          <xsl:text>'</xsl:text>
+        </xsl:message>
+        <xsl:value-of select="$name"/>
+      </xsl:when>
+
+      <xsl:when test="count($node) = 1">
+        <xsl:call-template name="internal-link">
+          <xsl:with-param name="to">
+            <xsl:call-template name="generate.id">
+              <xsl:with-param name="node" select="$node"/>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="text" select="$name"/>
+        </xsl:call-template>
+      </xsl:when>
+
+      <xsl:otherwise>
+        <xsl:message>
+          <xsl:text>error: header `</xsl:text>
+          <xsl:value-of select="$name"/>
+          <xsl:text>' is multiply defined.</xsl:text>
+        </xsl:message>
+        <xsl:value-of select="$node"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="text()" mode="annotation">
+    <xsl:param name="highlight" select="false()"/>
+    <xsl:choose>
+      <xsl:when test="$highlight">
+        <xsl:call-template name="source-highlight">
+          <xsl:with-param name="text" select="."/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="code" mode="annotation">
+    <computeroutput>
+      <xsl:apply-templates mode="annotation"/>
+    </computeroutput>
+  </xsl:template>
+
+  <xsl:template match="bold" mode="annotation">
+    <emphasis role="bold">
+      <xsl:apply-templates mode="annotation"/>
+    </emphasis>
+  </xsl:template>
+
+  <xsl:template match="comment()" mode="annotation">
+    <xsl:copy/>
+  </xsl:template>
+
+  <xsl:template match="node()" mode="annotation">
+    <xsl:param name="highlight" select="false()"/>
+
+    <xsl:element name="{name(.)}">
+      <xsl:for-each select="./@*">
+        <xsl:attribute name="{name(.)}">
+          <xsl:value-of select="."/>
+        </xsl:attribute>
+      </xsl:for-each>
+      <xsl:apply-templates select="./*|./text()" mode="annotation">
+        <xsl:with-param name="highlight" select="$highlight"/>
+      </xsl:apply-templates>
+    </xsl:element>
+  </xsl:template>
+
+  <!-- The "purpose" mode strips simpara/para elements so that we can
+       place the resulting text into a comment in the synopsis. -->
+  <xsl:template match="para|simpara" mode="purpose">
+    <xsl:apply-templates mode="annotation"/>
+  </xsl:template>
+
+  <xsl:template match="*" mode="purpose">
+    <xsl:apply-templates select="." mode="annotation"/>
+  </xsl:template>
+
+  <xsl:template match="text()" mode="purpose">
+    <xsl:apply-templates select="." mode="annotation"/>
+  </xsl:template>
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/callout.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/callout.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2007 Joel de Guzman <djowel -at- gmail.com>
+
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+<!-- Not needed?
+
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/callout.xsl"/>
+
+-->
+
+<xsl:import href="relative-href.xsl"/>
+
+<xsl:template name="callout-bug">
+  <xsl:param name="conum" select='1'/>
+
+  <xsl:choose>
+    <xsl:when test="$callout.graphics != 0
+                    and $conum <= $callout.graphics.number.limit">
+
+      <xsl:variable name="relative_callout_graphics_path">
+        <xsl:call-template name="href.target.relative">
+          <xsl:with-param name="target" select="$callout.graphics.path"/>
+        </xsl:call-template>
+      </xsl:variable>
+
+      <img src="{$relative_callout_graphics_path}{$conum}{$callout.graphics.extension}"
+           alt="{$conum}" border="0"/>
+    </xsl:when>
+
+    <xsl:when test="$callout.unicode != 0
+                    and $conum <= $callout.unicode.number.limit">
+      <xsl:choose>
+        <xsl:when test="$callout.unicode.start.character = 10102">
+          <xsl:choose>
+            <xsl:when test="$conum = 1">❶</xsl:when>
+            <xsl:when test="$conum = 2">❷</xsl:when>
+            <xsl:when test="$conum = 3">❸</xsl:when>
+            <xsl:when test="$conum = 4">❹</xsl:when>
+            <xsl:when test="$conum = 5">❺</xsl:when>
+            <xsl:when test="$conum = 6">❻</xsl:when>
+            <xsl:when test="$conum = 7">❼</xsl:when>
+            <xsl:when test="$conum = 8">❽</xsl:when>
+            <xsl:when test="$conum = 9">❾</xsl:when>
+            <xsl:when test="$conum = 10">❿</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: sandbox/doc_test/xsl_test/chunk-common.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/chunk-common.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,172 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+
+<!-- Not needed?
+
+Import the HTML chunking stylesheet
+
+<xsl:import
+    href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-common.xsl"/>
+
+-->
+
+<xsl:import href="header.xsl"/>
+<xsl:import href="footer.xsl"/>
+<xsl:import href="relative-href.xsl"/>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*" mode="recursive-chunk-filename">
+    <xsl:param name="recursive" select="false()"/>
+
+    <xsl:variable name="their">
+        <xsl:apply-imports mode="recursive-chunk-filename" select="."/>
+    </xsl:variable>
+
+    <xsl:variable name="basename" select="substring-before( $their, $html.ext )"/>
+    <xsl:choose>
+        <xsl:when test="not($recursive)">
+            <xsl:value-of select="translate( $basename, '.', '/' )"/>
+            <xsl:value-of select="$html.ext"/>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:value-of select="$basename"/>
+            <xsl:value-of select="'.'"/>
+        </xsl:otherwise>
+    </xsl:choose>
+
+</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:call-template name="href.target.relative">
+                <xsl:with-param name="target" select="$navig.graphics.path"/>
+            </xsl:call-template>
+		    <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="@fileref">
+    <xsl:choose>
+        <xsl:when test="contains(., ':')">
+            <xsl:value-of select="."/>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:call-template name="href.target.relative">
+                <xsl:with-param name="target" select="."/>
+                <xsl:with-param name="context" select=".."/>
+            </xsl:call-template>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="@url">
+    <xsl:choose>
+        <xsl:when test="contains(., ':')">
+            <xsl:value-of select="."/>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:text>XXX</xsl:text>
+            <xsl:value-of select="."/>
+            <xsl:text>XXX</xsl:text>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<!-- overwrites chunk-element-content -->
+
+<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="boostbook.header">
+        <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>
+
+      <div id="body">
+         <div id="body-inner">
+            <div id="content">
+               <xsl:copy-of select="$content"/>
+            </div>
+            <div class="clear"></div>
+         </div>
+      </div>
+
+      <xsl:call-template name="boostbook.footer">
+        <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>
+
+    </body>
+  </html>
+</xsl:template>
+
+
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/docbook-layout.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/docbook-layout.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,213 @@
+<?xml version = "1.0" encoding = "utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+
+<xsl:stylesheet version = "1.0"
+   xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
+>
+  <!-- needed for calsTable template -->
+
+  <!-- not needed ?
+  <xsl:import
+    href="http://docbook.sourceforge.net/release/xsl/current/html/formal.xsl"/>
+-->
+  <!--
+     Override the behaviour of some DocBook elements for better
+     integration with the new look & feel.
+  -->
+
+  <xsl:template match = "programlisting[ancestor::informaltable]">
+     <pre class = "table-{name(.)}"><xsl:apply-templates/></pre>
+  </xsl:template>
+
+  <xsl:template match = "refsynopsisdiv">
+     <h2 class = "{name(.)}-title">Synopsis</h2>
+     <div class = "{name(.)}"><xsl:apply-templates/></div>
+  </xsl:template>
+
+  <!-- table: remove border = '1' -->
+
+  <xsl:template match = "table|informaltable">
+     <xsl:choose>
+        <xsl:when test = "self::table and tgroup|mediaobject|graphic">
+           <xsl:apply-imports/>
+        </xsl:when><xsl:when test = "self::informaltable and 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 class = "table"><xsl:copy-of select = "@*[not(local-name(.)='border')]"/>
+              <xsl:call-template name = "htmlTable"/>
+           </table>
+        </xsl:otherwise>
+     </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match = "tgroup" name = "tgroup">
+     <xsl:variable name="summary"><xsl:call-template name="dbhtml-attribute">
+        <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
+        <xsl:with-param name="attribute" select="'table-summary'"/>
+     </xsl:call-template></xsl:variable>
+
+     <xsl:variable name="cellspacing"><xsl:call-template name="dbhtml-attribute">
+        <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
+        <xsl:with-param name="attribute" select="'cellspacing'"/>
+     </xsl:call-template></xsl:variable>
+
+     <xsl:variable name="cellpadding"><xsl:call-template name="dbhtml-attribute">
+        <xsl:with-param name="pis" select="processing-instruction('dbhtml')[1]"/>
+        <xsl:with-param name="attribute" select="'cellpadding'"/>
+     </xsl:call-template></xsl:variable>
+
+     <table class = "table">
+        <xsl:choose>
+           <xsl:when test="../textobject/phrase">
+              <xsl:attribute name="summary">
+                 <xsl:value-of select="../textobject/phrase"/>
+              </xsl:attribute>
+           </xsl:when><xsl:when test="$summary != ''">
+              <xsl:attribute name="summary">
+                 <xsl:value-of select="$summary"/>
+              </xsl:attribute>
+           </xsl:when><xsl:when test="../title">
+              <xsl:attribute name="summary">
+                 <xsl:value-of select="string(../title)"/>
+              </xsl:attribute>
+           </xsl:when>
+           <xsl:otherwise/>
+        </xsl:choose><xsl:if test="$cellspacing != '' or $html.cellspacing != ''">
+           <xsl:attribute name="cellspacing"><xsl:choose>
+              <xsl:when test="$cellspacing != ''"><xsl:value-of select="$cellspacing"/></xsl:when>
+              <xsl:otherwise><xsl:value-of select="$html.cellspacing"/></xsl:otherwise>
+           </xsl:choose></xsl:attribute>
+        </xsl:if><xsl:if test="$cellpadding != '' or $html.cellpadding != ''">
+           <xsl:attribute name="cellpadding"><xsl:choose>
+              <xsl:when test="$cellpadding != ''"><xsl:value-of select="$cellpadding"/></xsl:when>
+              <xsl:otherwise><xsl:value-of select="$html.cellpadding"/></xsl:otherwise>
+           </xsl:choose></xsl:attribute>
+        </xsl:if><xsl:if test="../@pgwide=1">
+           <xsl:attribute name="width">100%</xsl:attribute>
+        </xsl:if>
+
+        <xsl:variable name="colgroup">
+           <colgroup><xsl:call-template name="generate.colgroup">
+              <xsl:with-param name="cols" select="@cols"/>
+           </xsl:call-template></colgroup>
+        </xsl:variable>
+
+        <xsl:variable name="explicit.table.width"><xsl:call-template name="dbhtml-attribute">
+           <xsl:with-param name="pis" select="../processing-instruction('dbhtml')[1]"/>
+           <xsl:with-param name="attribute" select="'table-width'"/>
+        </xsl:call-template></xsl:variable>
+
+        <xsl:variable name="table.width"><xsl:choose>
+           <xsl:when test="$explicit.table.width != ''">
+              <xsl:value-of select="$explicit.table.width"/>
+           </xsl:when><xsl:when test="$default.table.width = ''">
+              <xsl:text>100%</xsl:text>
+           </xsl:when><xsl:otherwise>
+              <xsl:value-of select="$default.table.width"/>
+           </xsl:otherwise>
+        </xsl:choose></xsl:variable>
+
+        <xsl:if test="$default.table.width != '' or $explicit.table.width != ''">
+           <xsl:attribute name="width"><xsl:choose>
+              <xsl:when test="contains($table.width, '%')">
+                 <xsl:value-of select="$table.width"/>
+              </xsl:when><xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
+                 <xsl:choose>
+                    <xsl:when test="function-available('stbl:convertLength')">
+                       <xsl:value-of select="stbl:convertLength($table.width)"/>
+                    </xsl:when><xsl:when test="function-available('xtbl:convertLength')">
+                       <xsl:value-of select="xtbl:convertLength($table.width)"/>
+                    </xsl:when><xsl:otherwise>
+                       <xsl:message terminate="yes">
+                          <xsl:text>No convertLength function available.</xsl:text>
+                       </xsl:message>
+                    </xsl:otherwise>
+                 </xsl:choose>
+              </xsl:when><xsl:otherwise>
+                 <xsl:value-of select="$table.width"/>
+              </xsl:otherwise>
+           </xsl:choose></xsl:attribute>
+        </xsl:if>
+
+        <xsl:choose>
+           <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0">
+              <xsl:choose>
+                 <xsl:when test="function-available('stbl:adjustColumnWidths')">
+                    <xsl:copy-of select="stbl:adjustColumnWidths($colgroup)"/>
+                 </xsl:when><xsl:when test="function-available('xtbl:adjustColumnWidths')">
+                    <xsl:copy-of select="xtbl:adjustColumnWidths($colgroup)"/>
+                 </xsl:when><xsl:when test="function-available('ptbl:adjustColumnWidths')">
+                    <xsl:copy-of select="ptbl:adjustColumnWidths($colgroup)"/>
+                 </xsl:when><xsl:otherwise>
+                    <xsl:message terminate="yes">
+                       <xsl:text>No adjustColumnWidths function available.</xsl:text>
+                    </xsl:message>
+                 </xsl:otherwise>
+              </xsl:choose>
+           </xsl:when><xsl:otherwise>
+              <xsl:copy-of select="$colgroup"/>
+           </xsl:otherwise>
+        </xsl:choose>
+
+        <xsl:apply-templates select="thead"/>
+        <xsl:apply-templates select="tfoot"/>
+        <xsl:apply-templates select="tbody"/>
+
+        <xsl:if test=".//footnote"><tbody class="footnotes">
+           <tr><td colspan="{@cols}">
+              <xsl:apply-templates select=".//footnote" mode="table.footnote.mode"/>
+           </td></tr>
+        </tbody></xsl:if>
+     </table>
+  </xsl:template>
+
+  <!-- table of contents 
+       
+    The standard Docbook template selects, amoung others,
+    the 'refentry' element for inclusion in TOC. In some
+    cases, this creates empty TOC. The most possible reason
+    is that there's 'refentry' element without 'refentrytitle',
+    but it's a mistery why it occurs. Even if we fix that
+    problem, we'll get non-empty TOC where no TOC is desired
+    (e.g. for section corresponding to each header file in
+    library doc). So, don't bother for now.
+  -->
+
+  <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|
+           bridgehead[$bridgehead.in.toc != 0]
+        "/>
+     </xsl:call-template>
+  </xsl:template>
+
+  <!-- When there is both a title and a caption for a table, only use the 
+       title. -->
+  <xsl:template match="table" mode="title.markup">
+    <xsl:param name="allow-anchors" select="0"/>
+    <xsl:apply-templates select="(title|caption)[1]" mode="title.markup">
+      <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/docbook.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/docbook.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,491 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xi="http://www.w3.org/2001/XInclude"
+                version="1.0">
+
+  <xsl:include
+    href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunker.xsl"/>
+
+  <xsl:include href="reference.xsl"/>
+
+  <xsl:output method="xml"
+    doctype-public="-//OASIS//DTD DocBook XML V4.2//EN"
+    doctype-system="http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"/>
+
+  <!-- The maximum number of columns allowed in preformatted text -->
+  <xsl:param name="max-columns" select="78"/>
+
+  <!-- The root of the Boost directory -->
+  <xsl:param name="boost.root" select="'../..'"/>
+  <xsl:param name="boost.header.root" select="$boost.root"/>
+
+  <!-- A space-separated list of libraries to include in the
+       output. If this list is empty, all libraries will be included. -->
+  <xsl:param name="boost.include.libraries" select="''"/>
+
+  <!-- A space-separated list of xml elements in the input file for which
+       whitespace should be preserved -->
+  <xsl:preserve-space elements="*"/>
+
+  <xsl:template match="library-reference">
+    <xsl:choose>
+      <xsl:when test="ancestor::library-reference">
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+        <section>
+          <xsl:choose>
+            <xsl:when test="@id">
+              <xsl:attribute name="id">
+                <xsl:value-of select="@id"/>
+              </xsl:attribute>
+            </xsl:when>
+            <xsl:when test="ancestor::library/attribute::id">
+              <xsl:attribute name="id">
+                <xsl:value-of select="ancestor::library/attribute::id"/>
+                <xsl:text>.reference</xsl:text>
+              </xsl:attribute>
+            </xsl:when>
+          </xsl:choose>
+          <xsl:if test="not(title)">
+            <title>
+              <xsl:text>Reference</xsl:text>
+            </title>    
+          </xsl:if>
+
+          <xsl:if test="concept">
+            <section>
+              <xsl:choose>
+                <xsl:when test="@id">
+                  <xsl:attribute name="id">
+                    <xsl:value-of select="@id"/>
+                    <xsl:text>.concepts</xsl:text>
+                  </xsl:attribute>
+                </xsl:when>
+                <xsl:when test="ancestor::library/attribute::id">
+                  <xsl:attribute name="id">
+                    <xsl:value-of select="ancestor::library/attribute::id"/>
+                    <xsl:text>.concepts</xsl:text>
+                  </xsl:attribute>
+                </xsl:when>
+              </xsl:choose>
+
+              <title>Concepts</title>
+              
+              <itemizedlist>
+                <xsl:for-each select="concept">
+                  <listitem>
+                    <xsl:call-template name="internal-link">
+                      <xsl:with-param name="to">
+                        <xsl:call-template name="generate.id"/>
+                      </xsl:with-param>
+                      <xsl:with-param name="text" select="@name"/>
+                    </xsl:call-template>
+                  </listitem>
+                </xsl:for-each>
+              </itemizedlist>
+            </section>
+          </xsl:if>
+
+          <xsl:apply-templates/>
+        </section>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="header">
+    <xsl:if test="*">
+      <section>
+        <xsl:attribute name="id">
+          <xsl:call-template name="generate.id"/>
+        </xsl:attribute>
+
+        <title>
+          <xsl:text>Header <</xsl:text>
+          <ulink>
+            <xsl:attribute name="url">
+              <xsl:value-of select="$boost.header.root"/>
+              <xsl:text>/</xsl:text>
+              <xsl:value-of select="@name"/>
+            </xsl:attribute>
+            <xsl:value-of select="@name"/>
+          </ulink>
+          <xsl:text>></xsl:text>
+        </title>
+
+        <xsl:apply-templates select="para|section" mode="annotation"/>
+        
+        <xsl:if test="macro">
+          <xsl:call-template name="synopsis">
+            <xsl:with-param name="text">
+              <xsl:apply-templates mode="synopsis" select="macro">
+                <xsl:with-param name="indentation" select="0"/>
+              </xsl:apply-templates>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+
+        <xsl:if test="descendant::class|descendant::struct|descendant::union
+                     |descendant::function|descendant::free-function-group
+                     |descendant::overloaded-function|descendant::enum
+                     |descendant::typedef">
+          <xsl:call-template name="synopsis">
+            <xsl:with-param name="text">
+              <xsl:apply-templates mode="synopsis" 
+                select="namespace|class|struct|union
+                       |function|free-function-group
+                       |overloaded-function|enum
+                       |typedef">
+                <xsl:with-param name="indentation" select="0"/>
+              </xsl:apply-templates>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+
+        <xsl:apply-templates mode="namespace-reference"/>
+      </section>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="header" mode="generate.id">
+    <xsl:text>header.</xsl:text>
+    <xsl:value-of select="translate(@name, '/','.')"/>
+  </xsl:template>
+
+  <xsl:template match="*" mode="passthrough">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+
+  <!-- Syntax highlighting -->
+  <xsl:template name="highlight-keyword">
+    <xsl:param name="keyword"/>
+    <xsl:choose>
+      <xsl:when test="$boost.syntax.highlight='1'">
+        <emphasis role="bold"><xsl:value-of select="$keyword"/></emphasis>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$keyword"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="highlight-comment">
+    <xsl:param name="text"/>
+    <emphasis><xsl:copy-of select="$text"/></emphasis>
+  </xsl:template>
+
+  <xsl:template name="monospaced">
+    <xsl:param name="text"/>
+    <computeroutput><xsl:value-of select="$text"/></computeroutput>
+  </xsl:template>
+
+  <!-- Linking -->
+  <xsl:template name="internal-link">
+    <xsl:param name="to"/>
+    <xsl:param name="text"/>
+    <xsl:param name="highlight" select="false()"/>
+
+    <link linkend="{$to}">
+      <xsl:if test="$highlight">
+        <xsl:call-template name="source-highlight">
+          <xsl:with-param name="text" select="$text"/>
+        </xsl:call-template>
+      </xsl:if>
+      <xsl:if test="not($highlight)">
+        <xsl:value-of select="string($text)"/>
+      </xsl:if>
+    </link>
+  </xsl:template>
+
+  <xsl:template name="anchor">
+    <xsl:param name="to"/>
+    <xsl:param name="text"/>
+    <xsl:param name="highlight" select="false()"/>
+
+    <anchor id="{$to}"/>
+    <xsl:if test="$highlight">
+      <xsl:call-template name="source-highlight">
+        <xsl:with-param name="text" select="$text"/>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:if test="not($highlight)">
+      <xsl:value-of select="$text"/>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="link-or-anchor">
+    <xsl:param name="to"/>
+    <xsl:param name="text"/>
+
+    <!-- True if we should create an anchor, otherwise we will create
+         a link. If you require more control (e.g., with the possibility of
+         having no link or anchor), set link-type instead: if present, it
+         takes precedence. -->
+    <xsl:param name="is-anchor"/>
+
+    <!-- 'anchor', 'link', or 'none' -->
+    <xsl:param name="link-type">
+      <xsl:choose>
+        <xsl:when test="$is-anchor">
+          <xsl:text>anchor</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>link</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:param>
+
+    <xsl:param name="highlight" select="false()"/>
+
+    <xsl:choose>
+      <xsl:when test="$link-type='anchor'">
+        <xsl:call-template name="anchor">
+          <xsl:with-param name="to" select="$to"/>
+          <xsl:with-param name="text" select="$text"/>
+          <xsl:with-param name="highlight" select="$highlight"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="$link-type='link'">
+        <xsl:call-template name="internal-link">
+          <xsl:with-param name="to" select="$to"/>
+          <xsl:with-param name="text" select="$text"/>
+          <xsl:with-param name="highlight" select="$highlight"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="$link-type='none'">
+        <xsl:if test="$highlight">
+          <xsl:call-template name="source-highlight">
+            <xsl:with-param name="text" select="$text"/>
+          </xsl:call-template>
+        </xsl:if>
+        <xsl:if test="not($highlight)">
+          <xsl:value-of select="$text"/>
+        </xsl:if>        
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:message>
+Error: XSL template 'link-or-anchor' called with invalid link-type '<xsl:value-of select="$link-type"/>'
+        </xsl:message>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="separator"/>
+
+  <xsl:template name="reference-documentation">
+    <xsl:param name="name"/>
+    <xsl:param name="refname"/>
+    <xsl:param name="purpose"/>
+    <xsl:param name="anchor"/>
+    <xsl:param name="synopsis"/>
+    <xsl:param name="text"/>
+
+    <refentry id="{$anchor}">
+      <refmeta>
+        <refentrytitle><xsl:value-of select="$name"/></refentrytitle>
+        <manvolnum>3</manvolnum>
+      </refmeta>
+      <refnamediv>
+        <refname><xsl:value-of select="$refname"/></refname>
+        <refpurpose>
+		  <xsl:apply-templates mode="annotation" select="$purpose"/>
+		</refpurpose>
+      </refnamediv>
+      <refsynopsisdiv>
+        <synopsis>
+          <xsl:copy-of select="$synopsis"/>
+        </synopsis>
+      </refsynopsisdiv>
+      <xsl:if test="not(string($text)='')">
+        <refsect1>
+          <title>Description</title>
+          <xsl:copy-of select="$text"/>
+        </refsect1>
+      </xsl:if>
+    </refentry>
+  </xsl:template>
+
+  <xsl:template name="member-documentation">
+    <xsl:param name="name"/>
+    <xsl:param name="text"/>
+
+    <refsect2>
+      <title><xsl:copy-of select="$name"/></title>
+      <xsl:copy-of select="$text"/>
+    </refsect2>
+  </xsl:template>
+
+  <xsl:template name="preformatted">
+    <xsl:param name="text"/>
+
+    <literallayout class="monospaced">
+      <xsl:copy-of select="$text"/>
+    </literallayout>
+  </xsl:template>
+
+  <xsl:template name="synopsis">
+    <xsl:param name="text"/>
+
+    <synopsis>
+      <xsl:copy-of select="$text"/>
+    </synopsis>
+  </xsl:template>
+
+  <!-- Fallthrough for DocBook elements -->
+  <xsl:template match="*">
+    <xsl:element name="{name(.)}">
+      <xsl:for-each select="./@*">
+        <xsl:choose>
+          <xsl:when test="local-name(.)='last-revision'">
+            <xsl:attribute 
+              name="rev:last-revision"
+              namespace="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision">
+              <xsl:value-of select="."/>
+            </xsl:attribute>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:attribute name="{name(.)}">
+              <xsl:value-of select="."/>
+            </xsl:attribute>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:for-each>
+      <xsl:apply-templates/>
+    </xsl:element>
+  </xsl:template>
+
+  <xsl:template match="code">
+    <computeroutput>
+      <xsl:apply-templates mode="annotation"/>
+    </computeroutput>
+  </xsl:template>
+
+  <xsl:template match="bold">
+    <emphasis role="bold">
+      <xsl:apply-templates mode="annotation"/>
+    </emphasis>
+  </xsl:template>
+
+  <xsl:template match="library">
+    <xsl:if test="not(@html-only = 1) and
+                  ($boost.include.libraries='' or
+                   contains($boost.include.libraries, @id))">
+      <xsl:message>################################################</xsl:message>
+
+      <xsl:variable name="grouped.links.sections.xml.content">
+            It works!
+      </xsl:variable>
+      <xsl:call-template name="write.chunk">
+         <xsl:with-param name="filename" select="'/home/matias/sections.xml'" />
+         <xsl:with-param name="content" select="$grouped.links.sections.xml.content" />
+      </xsl:call-template>
+
+      <chapter>
+        <xsl:attribute name="id">
+          <xsl:choose>
+            <xsl:when test="@id">
+              <xsl:value-of select="@id"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:call-template name="generate.id"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:attribute>
+
+        <xsl:if test="@last-revision">
+          <xsl:attribute 
+            name="rev:last-revision"
+            namespace="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision">
+            <xsl:value-of select="@last-revision"/>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:apply-templates/>
+      </chapter>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="chapter">
+    <xsl:if test="$boost.include.libraries=''">
+      <chapter>
+        <xsl:for-each select="./@*">
+          <xsl:attribute name="{name(.)}">
+            <xsl:value-of select="."/>
+          </xsl:attribute>
+        </xsl:for-each>
+
+        <xsl:apply-templates/>
+      </chapter>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="boostbook">
+    <book><xsl:apply-templates/></book>
+  </xsl:template>
+
+  <xsl:template match="programlisting">
+    <programlisting><xsl:apply-templates/></programlisting>
+  </xsl:template>
+
+  <!-- These DocBook elements have special meaning. Use the annotation mode -->
+  <xsl:template match="classname|methodname|functionname|enumname|
+                       macroname|headername">
+    <computeroutput>
+      <xsl:apply-templates select="." mode="annotation"/>
+    </computeroutput>
+  </xsl:template>
+
+  <xsl:template match="libraryname|conceptname">
+    <xsl:apply-templates select="." mode="annotation"/>
+  </xsl:template>
+
+  <xsl:template match="description">
+    <xsl:apply-templates mode="annotation"/>
+  </xsl:template>
+
+  <!-- Swallow using-namespace and using-class directives along with
+       last-revised elements -->
+  <xsl:template match="using-namespace|using-class|last-revised"/>
+
+  <!-- If there is no "namespace-reference" mode, forward to
+       "reference" mode -->
+  <xsl:template match="*" mode="namespace-reference">
+    <xsl:apply-templates select="." mode="reference"/>
+  </xsl:template>
+  
+  <!-- Make the various blocks immediately below a "part" be
+       "chapter"-s. Must also take into account turning
+       chapters within chpaters into sections. -->
+  <xsl:template match="part/part|part/article">
+    <chapter>
+      <xsl:for-each select="./@*">
+        <xsl:attribute name="{name(.)}">
+          <xsl:value-of select="."/>
+        </xsl:attribute>
+      </xsl:for-each>
+      <xsl:apply-templates/>
+    </chapter>
+  </xsl:template>
+  <xsl:template match="part/part/partinfo|part/article/articleinfo">
+    <chapterinfo><xsl:apply-templates/></chapterinfo>
+  </xsl:template>
+  <xsl:template match="part/part/chapter">
+    <section>
+      <xsl:for-each select="./@*">
+        <xsl:attribute name="{name(.)}">
+          <xsl:value-of select="."/>
+        </xsl:attribute>
+      </xsl:for-each>
+      <xsl:apply-templates/>
+    </section>
+  </xsl:template>
+  <xsl:template match="part/part/chapter/chapterinfo">
+    <sectioninfo><xsl:apply-templates/></sectioninfo>
+  </xsl:template>
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/error.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/error.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+  <xsl:template name="print.warning.context">
+    <xsl:message>
+      <xsl:text>  In </xsl:text>
+      <xsl:call-template name="fully-qualified-name">
+        <xsl:with-param name="node" select="."/>
+      </xsl:call-template>
+    </xsl:message>
+  </xsl:template>
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/fo.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/fo.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,259 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2003 Douglas Gregor -->
+<!-- Distributed under the Boost Software License, Version 1.0. -->
+<!-- (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                version="1.0">
+
+  <!-- Import the FO stylesheet -->
+  <xsl:import 
+    href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
+
+  <xsl:param name="chapter.autolabel" select="0"/>
+  <xsl:param name="refentry.generate.name" select="0"/>
+  <xsl:param name="refentry.generate.title" select="1"/>
+  <xsl:param name="fop.extensions" select="1"/>
+  <xsl:param name="make.year.ranges" select="1"/>
+  <xsl:param name="ulink.show" select="0"/>
+
+  <!-- The question and answer templates are copied here from the
+       1.61.3 DocBook XSL stylesheets so that we can eliminate the emission
+       of id attributes in the emitted fo:list-item-label elements. FOP
+       0.20.5 has problems with these id attributes, and they are otherwise
+       unused. -->
+<xsl:template match="question">
+  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
+
+  <xsl:variable name="entry.id">
+    <xsl:call-template name="object.id">
+      <xsl:with-param name="object" select="parent::*"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="deflabel">
+    <xsl:choose>
+      <xsl:when test="ancestor-or-self::*[@defaultlabel]">
+        <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
+                              /@defaultlabel"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$qanda.defaultlabel"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <fo:list-item id="{$entry.id}" xsl:use-attribute-sets="list.item.spacing">
+    <fo:list-item-label end-indent="label-end()">
+      <xsl:choose>
+        <xsl:when test="$deflabel = 'none'">
+          <fo:block/>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:block>
+            <xsl:apply-templates select="." mode="label.markup"/>
+            <xsl:text>.</xsl:text> <!-- FIXME: Hack!!! This should be in the locale! -->
+          </fo:block>
+        </xsl:otherwise>
+      </xsl:choose>
+    </fo:list-item-label>
+    <fo:list-item-body start-indent="body-start()">
+      <xsl:choose>
+        <xsl:when test="$deflabel = 'none'">
+          <fo:block font-weight="bold">
+            <xsl:apply-templates select="*[local-name(.)!='label']"/>
+          </fo:block>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates select="*[local-name(.)!='label']"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </fo:list-item-body>
+  </fo:list-item>
+</xsl:template>
+
+<xsl:template match="answer">
+  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
+  <xsl:variable name="entry.id">
+    <xsl:call-template name="object.id">
+      <xsl:with-param name="object" select="parent::*"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="deflabel">
+    <xsl:choose>
+      <xsl:when test="ancestor-or-self::*[@defaultlabel]">
+        <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
+                              /@defaultlabel"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$qanda.defaultlabel"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <fo:list-item xsl:use-attribute-sets="list.item.spacing">
+    <fo:list-item-label end-indent="label-end()">
+      <xsl:choose>
+        <xsl:when test="$deflabel = 'none'">
+          <fo:block/>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:block>
+            <!-- FIXME: Hack!!! This should be in the locale! -->
+            <xsl:variable name="answer.label">
+              <xsl:apply-templates select="." mode="label.markup"/>
+            </xsl:variable>
+            <xsl:copy-of select="$answer.label"/>
+            <xsl:if test="string($answer.label) != ''">
+              <xsl:text>.</xsl:text>
+            </xsl:if>
+          </fo:block>
+        </xsl:otherwise>
+      </xsl:choose>
+    </fo:list-item-label>
+    <fo:list-item-body start-indent="body-start()">
+      <xsl:apply-templates select="*[local-name(.)!='label']"/>
+    </fo:list-item-body>
+  </fo:list-item>
+</xsl:template>
+
+<!-- 
+
+ The following rules apply syntax highlighting to phrases
+ that have been appropriately marked up, the highlighting
+ used is the same as that used by our CSS style sheets,
+ but potentially we have the option to do better here
+ since we can add bold and italic formatting quite easily
+ 
+ -->
+
+<xsl:template match="phrase[@role='keyword']">
+  <fo:inline color="#3300CC"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="phrase[@role='special']">
+  <fo:inline color="#707070"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="phrase[@role='preprocessor']">
+  <fo:inline color="#009999"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="phrase[@role='char']">
+  <fo:inline color="teal"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="phrase[@role='comment']">
+  <fo:inline color="#009900"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="phrase[@role='string']">
+  <fo:inline color="teal"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="phrase[@role='number']">
+  <fo:inline color="teal"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="phrase[@role='white_bkd']">
+  <fo:inline color="#E8FBE9"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="phrase[@role='dk_grey_bkd']">
+  <fo:inline color="#A0DAAC"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+
+<!--
+Make all hyperlinks colored:
+-->
+<xsl:attribute-set name="xref.properties">
+  <xsl:attribute name="color">#0C7445</xsl:attribute>
+</xsl:attribute-set>
+
+<!--
+Put a box around admonishments and keep them together:
+-->
+<xsl:attribute-set name="graphical.admonition.properties">
+   <xsl:attribute name="border-color">#DCDCDC</xsl:attribute>
+   <xsl:attribute name="border-width">1px</xsl:attribute>
+   <xsl:attribute name="border-bottom-color">#9D9D9D</xsl:attribute>
+   <xsl:attribute name="border-bottom-width">3px</xsl:attribute>
+   <xsl:attribute name="border-right-color">#9D9D9D</xsl:attribute>
+   <xsl:attribute name="border-right-width">3px</xsl:attribute>
+   <xsl:attribute name="border-style">solid</xsl:attribute>
+   <xsl:attribute name="padding-left">0.2cm</xsl:attribute>
+   <xsl:attribute name="padding-right">0.2cm</xsl:attribute>
+   <xsl:attribute name="padding-top">0.2cm</xsl:attribute>
+   <xsl:attribute name="padding-bottom">0.2cm</xsl:attribute>
+   <xsl:attribute name="keep-together">1</xsl:attribute>
+   <xsl:attribute name="background-color">#FAFFFB</xsl:attribute>
+</xsl:attribute-set>
+
+<!-- TOC border setup -->
+<xsl:attribute-set name="toc.margin.properties">
+   <xsl:attribute name="border-color">#DCDCDC</xsl:attribute>
+   <xsl:attribute name="border-width">1px</xsl:attribute>
+   <xsl:attribute name="border-bottom-color">#9D9D9D</xsl:attribute>
+   <xsl:attribute name="border-bottom-width">3px</xsl:attribute>
+   <xsl:attribute name="border-right-color">#9D9D9D</xsl:attribute>
+   <xsl:attribute name="border-right-width">3px</xsl:attribute>
+   <xsl:attribute name="border-style">solid</xsl:attribute>
+   <xsl:attribute name="padding-left">0.2cm</xsl:attribute>
+   <xsl:attribute name="padding-right">0.2cm</xsl:attribute>
+   <xsl:attribute name="padding-top">0.2cm</xsl:attribute>
+   <xsl:attribute name="padding-bottom">0.2cm</xsl:attribute>
+   <xsl:attribute name="keep-together">1</xsl:attribute>
+   <xsl:attribute name="background-color">#FAFFFB</xsl:attribute>
+</xsl:attribute-set>
+
+<!--
+Put a box around code blocks, also set the font size
+and keep the block together if we can:
+-->
+<xsl:attribute-set name="monospace.verbatim.properties">
+  <xsl:attribute name="border-color">#DCDCDC</xsl:attribute>
+  <xsl:attribute name="border-width">1px</xsl:attribute>
+  <xsl:attribute name="border-bottom-color">#9D9D9D</xsl:attribute>
+  <xsl:attribute name="border-bottom-width">3px</xsl:attribute>
+  <xsl:attribute name="border-right-color">#9D9D9D</xsl:attribute>
+  <xsl:attribute name="border-right-width">3px</xsl:attribute>
+  <xsl:attribute name="border-style">solid</xsl:attribute>
+  <xsl:attribute name="padding-left">0.2cm</xsl:attribute>
+  <xsl:attribute name="padding-right">0.2cm</xsl:attribute>
+  <xsl:attribute name="padding-top">0.2cm</xsl:attribute>
+  <xsl:attribute name="padding-bottom">0.2cm</xsl:attribute>
+  <xsl:attribute name="keep-together">1</xsl:attribute>
+  <xsl:attribute name="font-size">9pt</xsl:attribute>
+  <xsl:attribute name="background-color">#FAFFFB</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:attribute-set name="table.cell.padding">
+  <xsl:attribute name="padding-left">0.2cm</xsl:attribute>
+  <xsl:attribute name="padding-right">0.2cm</xsl:attribute>
+  <xsl:attribute name="padding-top">0.2cm</xsl:attribute>
+  <xsl:attribute name="padding-bottom">0.2cm</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:attribute-set name="table.properties">
+  <xsl:attribute name="keep-together">1</xsl:attribute>
+  <xsl:attribute name="background-color">#FAFFFB</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:param name="table.frame.border.color">#DCDCDC</xsl:param>
+<xsl:param name="table.cell.border.color">#DCDCDC</xsl:param>
+<xsl:param name="admon.graphics.extension">.svg</xsl:param>
+
+<!-- Render sidebars the same as Admonishments -->
+<xsl:attribute-set name="sidebar.properties">
+   <xsl:attribute name="border-color">#DCDCDC</xsl:attribute>
+   <xsl:attribute name="border-width">1px</xsl:attribute>
+   <xsl:attribute name="border-bottom-color">#9D9D9D</xsl:attribute>
+   <xsl:attribute name="border-bottom-width">3px</xsl:attribute>
+   <xsl:attribute name="border-right-color">#9D9D9D</xsl:attribute>
+   <xsl:attribute name="border-right-width">3px</xsl:attribute>
+   <xsl:attribute name="border-style">solid</xsl:attribute>
+   <xsl:attribute name="padding-left">0.2cm</xsl:attribute>
+   <xsl:attribute name="padding-right">0.2cm</xsl:attribute>
+   <xsl:attribute name="padding-top">0.2cm</xsl:attribute>
+   <xsl:attribute name="padding-bottom">0.2cm</xsl:attribute>
+   <xsl:attribute name="keep-together">1</xsl:attribute>
+   <xsl:attribute name="background-color">#FAFFFB</xsl:attribute>
+</xsl:attribute-set>
+
+</xsl:stylesheet>
+
+
Added: sandbox/doc_test/xsl_test/footer.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/footer.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,290 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2007 Matias Capeletto
+
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+
+<!--
+   Footer stylesheet
+  -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"
+                version="1.0">
+
+<xsl:import href="navbar.xsl"/>
+
+   <!--
+       The style of the html pages
+         *website   - like the beta.boost.org
+          textlinks - old logo and links style
+   -->
+   <xsl:param name = "page.style" select = "'website'"/>
+
+
+
+   <xsl:template name = "boostbook.footer">
+      <xsl:param name = "prev" select = "/foo"/>
+      <xsl:param name = "next" select = "/foo"/>
+      <xsl:param name = "nav.context"/>
+
+      <xsl:choose>
+      <xsl:when test = "$page.style = 'website'">
+
+      <!-- Navigation -->
+
+      <xsl:call-template name="boost.navbar">
+         <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>
+
+      <!-- website footer -->
+
+      <div id="footer">
+         <div id="footer-left">
+            <xsl:variable name="revised.time">
+               <xsl:call-template name = "find.revised.time"/>
+            </xsl:variable>
+            <xsl:choose>
+               <xsl:when test="$revised.time='unknown'">
+               <!-- unknown revised time, skip revised time -->
+               </xsl:when>
+               <xsl:otherwise>
+                  <div id="revised">Revised: <xsl:value-of select="$revised.time"/></div>
+               </xsl:otherwise>
+            </xsl:choose>
+            <div id="copyright">
+               <xsl:apply-templates select="ancestor::*/*/copyright"
+                                    mode="boost.footer"/>
+            </div>
+            <div id="license">
+               <p>Distributed under the
+                  <a href="/LICENSE_1_0.txt"
+                     class="internal">Boost Software License, Version 1.0</a>.
+               </p>
+            </div>
+         </div>
+         <div id="footer-right">
+            <div id="banners">
+               <p id="banner-xhtml">
+                  <a href="http://validator.w3.org/check?uri=referer"
+                     class="external">XHTML 1.0</a>
+               </p>
+               <p id="banner-css">
+                  <a href="http://jigsaw.w3.org/css-validator/check/referer"
+                     class="external">CSS</a>
+               </p>
+               <p id="banner-sourceforge">
+                  <a href="http://sourceforge.net"
+                     class="external">SourceForge</a>
+               </p>
+            </div>
+         </div>
+         <div class="clear"></div>
+      </div>
+
+
+      <!-- Old style, textlinks -->
+
+      </xsl:when>
+      <xsl:when test = "$page.style = 'textlinks'">
+      <xsl:call-template name="footer.content.textlinks"/>
+      <hr />
+      <xsl:call-template name="boost.navbar">
+         <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:when>
+      </xsl:choose>
+
+   </xsl:template>
+
+
+
+   <xsl:template name = "month.name.from.number" >
+      <xsl:param name = "month"/>
+      <xsl:choose>
+         <xsl:when test="$month=1">January</xsl:when>
+         <xsl:when test="$month=2">February</xsl:when>
+         <xsl:when test="$month=3">March</xsl:when>
+         <xsl:when test="$month=4">April</xsl:when>
+         <xsl:when test="$month=5">May</xsl:when>
+         <xsl:when test="$month=6">June</xsl:when>
+         <xsl:when test="$month=7">July</xsl:when>
+         <xsl:when test="$month=8">August</xsl:when>
+         <xsl:when test="$month=9">September</xsl:when>
+         <xsl:when test="$month=10">October</xsl:when>
+         <xsl:when test="$month=11">November</xsl:when>
+         <xsl:when test="$month=12">December</xsl:when>
+      </xsl:choose>
+   </xsl:template> 
+
+
+   <xsl:template name="format.cvs.revision">
+      <xsl:param name="text"/>
+
+      <!-- Remove the "$Date: " -->
+      <xsl:variable name="text.noprefix"
+         select="substring-after($text, '$Date: ')"/>
+
+      <!-- Grab the year -->
+      <xsl:variable name="year" select="substring-before($text.noprefix, '/')"/>
+      <xsl:variable name="text.noyear"
+         select="substring-after($text.noprefix, '/')"/>
+
+      <!-- Grab the month -->
+      <xsl:variable name="month" select="substring-before($text.noyear, '/')"/>
+      <xsl:variable name="text.nomonth"
+         select="substring-after($text.noyear, '/')"/>
+
+      <!-- Grab the year -->
+      <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
+      <xsl:variable name="text.noday"
+         select="substring-after($text.nomonth, ' ')"/>
+
+      <!-- Get the time -->
+      <xsl:variable name="time" select="substring-before($text.noday, ' ')"/>
+
+      <xsl:variable name="month.name">
+         <xsl:call-template name = "month.name.from.number" >
+            <xsl:with-param name = "month" select="$month" />
+         </xsl:call-template>
+      </xsl:variable>
+
+      <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
+                                   $time, ' GMT')"/>
+   </xsl:template>
+
+
+   <xsl:template name="format.svn.revision">
+       <xsl:param name="text"/>
+
+       <!-- Remove the "$Date: " -->
+       <xsl:variable name="text.noprefix"
+          select="substring-after($text, '$Date: ')"/>
+
+       <!-- Grab the year -->
+       <xsl:variable name="year" select="substring-before($text.noprefix, '-')"/>
+       <xsl:variable name="text.noyear"
+          select="substring-after($text.noprefix, '-')"/>
+
+       <!-- Grab the month -->
+       <xsl:variable name="month" select="substring-before($text.noyear, '-')"/>
+       <xsl:variable name="text.nomonth"
+          select="substring-after($text.noyear, '-')"/>
+
+       <!-- Grab the year -->
+       <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
+       <xsl:variable name="text.noday"
+          select="substring-after($text.nomonth, ' ')"/>
+
+       <!-- Get the time -->
+       <xsl:variable name="time" select="substring-before($text.noday, ' ')"/>
+       <xsl:variable name="text.notime"
+          select="substring-after($text.noday, ' ')"/>
+
+       <!-- Get the timezone -->
+       <xsl:variable name="timezone" select="substring-before($text.notime, ' ')"/>
+
+       <xsl:variable name="month.name">
+         <xsl:call-template name = "month.name.from.number" >
+            <xsl:with-param name = "month" select="$month" />
+         </xsl:call-template>
+       </xsl:variable>
+
+       <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
+                                    $time, ' ', $timezone)"/>
+    </xsl:template>
+
+
+    <xsl:template match="copyright" mode="boost.footer">
+       <!--xsl:if test="position() > 1"-->
+       <p>
+       <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:call-template name="copyright.years">
+          <xsl:with-param name="years" select="year"/>
+          <xsl:with-param name="print.ranges" select="$make.year.ranges"/>
+          <xsl:with-param name="single.year.ranges"
+                          select="$make.single.year.ranges"/>
+       </xsl:call-template>
+       <xsl:call-template name="gentext.space"/>
+       <xsl:apply-templates select="holder" mode="titlepage.mode"/>
+       </p>
+    </xsl:template>
+
+
+    <xsl:template name= "find.revised.time" >
+       <xsl:variable name="revision-nodes"
+                     select="ancestor-or-self::*
+                    [not (attribute::rev:last-revision='')]"/>
+
+       <xsl:if test="count($revision-nodes) > 0">
+          <xsl:variable name="revision-node"
+                        select="$revision-nodes[last()]"/>
+          <xsl:variable name="revision-text">
+             <xsl:value-of
+                select="normalize-space($revision-node/attribute::rev:last-revision)"/>
+          </xsl:variable>
+          <xsl:choose>
+             <xsl:when test="string-length($revision-text) > 0">
+                 <xsl:choose>
+                     <xsl:when test="contains($revision-text, '/')">
+                         <xsl:call-template name="format.cvs.revision">
+                            <xsl:with-param name="text" select="$revision-text"/>
+                         </xsl:call-template>
+                     </xsl:when>
+                     <xsl:otherwise>
+                         <xsl:call-template name="format.svn.revision">
+                             <xsl:with-param name="text" select="$revision-text"/>
+                         </xsl:call-template>
+                     </xsl:otherwise>
+                 </xsl:choose>
+             </xsl:when>
+             <xsl:otherwise>unknown</xsl:otherwise>
+          </xsl:choose>
+       </xsl:if>
+    </xsl:template>
+
+   <!-- Old footer ( was user.footer.content in html.xsl ) -->
+
+   <xsl:template name="footer.content.textlinks">
+      <table width="100%">
+         <tr>
+            <td align="left">
+               <xsl:variable name="revised.time">
+                  <xsl:call-template name = "find.revised.time"/>
+               </xsl:variable>
+               <xsl:choose>
+                  <xsl:when test="$revised.time='unknown'">
+                  <!-- unknown revised time, skip revised time -->
+                  </xsl:when>
+                  <xsl:otherwise>
+                     <small>Last revised: <xsl:value-of select="$revised.time"/>
+                     </small>
+                  </xsl:otherwise>
+               </xsl:choose>
+            </td>
+            <td align="right">
+               <small>
+                  <xsl:apply-templates select="ancestor::*/*/copyright"
+                                       mode="boost.footer"/>
+               </small>
+            </td>
+         </tr>
+      </table>
+   </xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file
Added: sandbox/doc_test/xsl_test/function.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/function.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,1109 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+  <xsl:strip-space elements="requires effects postconditions returns throws 
+                             complexity notes rationale purpose"/>
+
+  <!-- When true, the stylesheet will emit compact definitions of
+       functions when the function does not have any detailed
+       description. -->
+  <xsl:param name="boost.compact.function">1</xsl:param>
+
+  <!-- The longest type length that is considered "short" for the
+       layout of function return types. When the length of the result type
+       and any storage specifiers is greater than this length, they will be
+       placed on a separate line from the function name and parameters
+       unless everything fits on a single line. -->
+  <xsl:param name="boost.short.result.type">12</xsl:param>
+
+  <!-- Display a function declaration -->
+  <xsl:template name="function">
+    <xsl:param name="indentation"/>
+    <xsl:param name="is-reference"/>
+
+    <!-- Whether or not we should include parameter names in the output -->
+    <xsl:param name="include-names" select="$is-reference"/>
+
+    <!-- What type of link the function name should have. This shall
+         be one of 'anchor' (the function output will be the target of
+         links), 'link' (the function output will link to a definition), or
+         'none' (the function output will not be either a link or a link
+         target) -->
+    <xsl:param name="link-type">
+      <xsl:choose>
+        <xsl:when test="$is-reference">
+          <xsl:text>anchor</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>link</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:param>
+
+    <!-- The id we should link to or anchor as -->
+    <xsl:param name="link-to">
+      <xsl:call-template name="generate.id"/>
+    </xsl:param>
+
+    <!-- If we are printing a constructor -->
+    <xsl:param name="constructor-for"/>
+
+    <!-- If we are printing a destructor -->
+    <xsl:param name="destructor-for"/>
+
+    <!-- If we are printing a copy assignment operator -->
+    <xsl:param name="copy-assign-for"/>
+
+    <!-- The name of this function -->
+    <xsl:param name="name" select="@name"/>
+
+    <!-- True if this is the function's separate documentation -->
+    <xsl:param name="standalone" select="false()"/>
+
+    <!-- True if we should suppress the template header -->
+    <xsl:param name="suppress-template" select="false()"/>
+
+    <!-- Calculate the specifiers -->
+    <xsl:variable name="specifiers">
+      <xsl:if test="@specifiers">
+        <xsl:value-of select="concat(@specifiers, ' ')"/>
+      </xsl:if>
+    </xsl:variable>
+
+    <!-- Calculate the type -->
+    <xsl:variable name="type">
+      <xsl:value-of select="$specifiers"/>
+
+      <xsl:choose>
+        <!-- Conversion operators have an empty type, because the return
+             type is part of the name -->
+        <xsl:when test="$name='conversion-operator'"/>
+
+        <!-- Constructors and destructors have no return type -->
+        <xsl:when test="$constructor-for or $destructor-for"/>
+
+        <!-- Copy assignment operators return a reference to the class
+             they are in, unless another type has been explicitly
+             provided in the element. -->
+        <xsl:when test="$copy-assign-for and not(type)">
+          <xsl:value-of select="concat($copy-assign-for, '& ')"/>
+        </xsl:when>
+
+        <xsl:otherwise>
+          <xsl:apply-templates select="type" mode="annotation"/>
+          <xsl:text> </xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- Build the function name with return type -->
+    <xsl:variable name="function-name">
+      <xsl:choose>
+        <xsl:when test="$constructor-for">
+          <xsl:value-of select="$constructor-for"/>
+        </xsl:when>
+        <xsl:when test="$destructor-for">
+          <xsl:value-of select="concat('~',$destructor-for)"/>
+        </xsl:when>
+        <xsl:when test="$copy-assign-for">
+          <xsl:value-of select="'operator='"/>
+        </xsl:when>
+        <xsl:when test="$name='conversion-operator'">
+          <xsl:text>operator </xsl:text>
+          <xsl:apply-templates select="type" mode="annotation"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$name"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:if test="not ($standalone) or 
+                  (local-name(.)='signature' and (position() > 1))
+                  or $suppress-template">
+      <xsl:text>
</xsl:text>
+    </xsl:if>
+
+    <!-- Indent this declaration -->
+    <xsl:call-template name="indent">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:call-template>
+    
+    <!-- Build the template header -->
+    <xsl:variable name="template-length">
+      <xsl:choose>
+        <xsl:when test="$suppress-template">
+          0
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="template.synopsis.length"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+        
+    <!-- Build a full parameter string (without line breaks) -->
+    <xsl:variable name="param-string">
+      <xsl:text>(</xsl:text>
+      <xsl:call-template name="function-parameters">
+        <xsl:with-param name="include-names" select="$include-names"/>
+        <xsl:with-param name="wrap" select="false()"/>
+      </xsl:call-template>
+      <xsl:text>)</xsl:text>
+    </xsl:variable>
+
+    <!-- Build the text that follows the declarator-->
+    <xsl:variable name="postdeclarator">
+      <xsl:if test="@cv">
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="@cv"/>
+      </xsl:if>
+    </xsl:variable>
+
+    <!-- Build the full declaration text -->
+    <xsl:variable name="decl-string" 
+      select="concat($type, $function-name, $param-string, $postdeclarator)"/>
+    <xsl:variable name="end-column" 
+      select="$template-length + string-length($decl-string) + $indentation"/>
+    
+    <xsl:choose>
+      <!-- Check if we should put the template header on its own line to
+           save horizontal space. -->
+      <xsl:when test="($template-length > 0) and 
+                      ($end-column > $max-columns)">
+        <!-- Emit template header on its own line -->
+        <xsl:apply-templates select="template" mode="synopsis">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:apply-templates>
+        
+        <!-- Emit the rest of the function declaration (without the
+             template header) indented two extra spaces. -->
+        <xsl:call-template name="function">
+          <xsl:with-param name="indentation" select="$indentation + 2"/>
+          <xsl:with-param name="is-reference" select="$is-reference"/>
+          <xsl:with-param name="include-names" select="$include-names"/>
+          <xsl:with-param name="link-type" select="$link-type"/>
+          <xsl:with-param name="link-to" select="$link-to"/>
+          <xsl:with-param name="constructor-for" select="$constructor-for"/>
+          <xsl:with-param name="destructor-for" select="$destructor-for"/>
+          <xsl:with-param name="copy-assign-for" select="$copy-assign-for"/>
+          <xsl:with-param name="name" select="$name"/>
+          <xsl:with-param name="standalone" select="$standalone"/>
+          <xsl:with-param name="suppress-template" select="true()"/>
+        </xsl:call-template>
+      </xsl:when>
+
+      <!-- Check if we can put the entire declaration on a single
+           line. -->
+      <xsl:when test="not($end-column > $max-columns)">
+        <!-- Emit template header, if not suppressed -->
+        <xsl:if test="not($suppress-template)">
+          <xsl:apply-templates select="template" mode="synopsis">
+            <xsl:with-param name="indentation" select="$indentation"/>
+            <xsl:with-param name="wrap" select="false()"/>
+            <xsl:with-param name="highlight" select="true()"/>
+          </xsl:apply-templates>
+        </xsl:if>
+
+        <!-- Emit specifiers -->
+        <xsl:call-template name="source-highlight">
+          <xsl:with-param name="text" select="$specifiers"/>
+        </xsl:call-template>
+
+        <!-- Emit type, if any -->
+        <xsl:choose>
+          <!-- Conversion operators have an empty type, because the return
+               type is part of the name -->
+          <xsl:when test="$name='conversion-operator'"/>
+
+          <!-- Constructors and destructors have no return type -->
+          <xsl:when test="$constructor-for or $destructor-for"/>
+
+          <!-- Copy assignment operators return a reference to the class
+               they are in, unless another type has been explicitly
+               provided in the element. -->
+          <xsl:when test="$copy-assign-for and not(type)">
+            <xsl:value-of select="concat($copy-assign-for, '& ')"/>
+          </xsl:when>
+
+          <xsl:otherwise>
+            <xsl:apply-templates select="type" mode="highlight"/>
+            <xsl:text> </xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+
+        <xsl:call-template name="link-or-anchor">
+          <xsl:with-param name="to" select="$link-to"/>
+          <xsl:with-param name="text" select="$function-name"/>
+          <xsl:with-param name="link-type" select="$link-type"/>
+          <xsl:with-param name="highlight" select="true()"/>
+        </xsl:call-template>
+
+        <xsl:text>(</xsl:text>
+        <xsl:call-template name="function-parameters">
+          <xsl:with-param name="include-names" select="$include-names"/>
+          <xsl:with-param name="indentation" 
+            select="$indentation + $template-length + string-length($type)
+                    + string-length($function-name) + 1"/>
+          <xsl:with-param name="final" select="true()"/>
+        </xsl:call-template>                
+        <xsl:text>)</xsl:text>
+
+        <xsl:call-template name="source-highlight">
+          <xsl:with-param name="text" select="$postdeclarator"/>
+        </xsl:call-template>
+        <xsl:text>;</xsl:text>    
+      </xsl:when>
+
+      <!-- This declaration will take multiple lines -->
+      <xsl:otherwise>
+        <!-- Emit specifiers -->
+        <xsl:call-template name="source-highlight">
+          <xsl:with-param name="text" select="$specifiers"/>
+        </xsl:call-template>
+
+        <!-- Emit type, if any -->
+        <xsl:choose>
+          <!-- Conversion operators have an empty type, because the return
+               type is part of the name -->
+          <xsl:when test="$name='conversion-operator'"/>
+
+          <!-- Constructors and destructors have no return type -->
+          <xsl:when test="$constructor-for or $destructor-for"/>
+
+          <!-- Copy assignment operators return a reference to the class
+               they are in, unless another type has been explicitly
+               provided in the element. -->
+          <xsl:when test="$copy-assign-for and not(type)">
+            <xsl:value-of select="concat($copy-assign-for, '& ')"/>
+          </xsl:when>
+
+          <xsl:otherwise>
+            <xsl:apply-templates select="type" mode="highlight"/>
+            <xsl:text> </xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+
+        <xsl:if test="string-length($type) > $boost.short.result.type">
+          <xsl:text>
</xsl:text>
+          <xsl:call-template name="indent">
+            <xsl:with-param name="indentation" select="$indentation"/>
+          </xsl:call-template>
+        </xsl:if>
+
+        <!-- Determine how many columns the type and storage
+             specifiers take on the same line as the function name. -->
+        <xsl:variable name="type-length">
+          <xsl:choose>
+            <xsl:when test="string-length($type) > $boost.short.result.type">
+              0
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="string-length($type)"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+
+        <xsl:call-template name="link-or-anchor">
+          <xsl:with-param name="to" select="$link-to"/>
+          <xsl:with-param name="text" select="$function-name"/>
+          <xsl:with-param name="link-type" select="$link-type"/>
+          <xsl:with-param name="highlight" select="true()"/>
+        </xsl:call-template>
+        <xsl:text>(</xsl:text>
+        <xsl:call-template name="function-parameters">
+          <xsl:with-param name="include-names" select="$include-names"/>
+          <xsl:with-param name="indentation" 
+            select="$indentation + $type-length 
+                    + string-length($function-name) + 1"/>
+          <xsl:with-param name="final" select="true()"/>
+        </xsl:call-template>                
+        <xsl:text>)</xsl:text>
+        <xsl:call-template name="source-highlight">
+          <xsl:with-param name="text" select="$postdeclarator"/>
+        </xsl:call-template>
+        <xsl:text>;</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>    
+
+  <!-- Synopsis of function parameters, e.g., "(const T&, int x = 5)" -->
+  <xsl:template name="function-parameters">
+    <!-- Indentation level of this parameter list -->
+    <xsl:param name="indentation"/>
+
+    <!-- True if we should include parameter names -->
+    <xsl:param name="include-names" select="true()"/>
+
+    <!-- True if we should wrap function parameters to the next line -->
+    <xsl:param name="wrap" select="true()"/>
+
+    <!-- True if we are printing the final output -->
+    <xsl:param name="final" select="false()"/>
+
+    <!-- Internal: The prefix to emit before a parameter -->
+    <xsl:param name="prefix" select="''"/>
+
+    <!-- Internal: The list of parameters -->
+    <xsl:param name="parameters" select="parameter"/>
+
+    <!-- Internal: The column we are on -->
+    <xsl:param name="column" select="$indentation"/>
+
+    <!-- Internal: Whether this is the first parameter on this line or not -->
+    <xsl:param name="first-on-line" select="true()"/>
+
+    <xsl:if test="$parameters">
+      <!-- Information for this parameter -->
+      <xsl:variable name="parameter" select="$parameters[position()=1]"/>
+      <xsl:variable name="name">
+        <xsl:if test="$include-names and $parameter/@name != ''">
+          <xsl:text> </xsl:text><xsl:value-of select="$parameter/@name"/>
+        </xsl:if>
+      </xsl:variable>
+
+      <xsl:variable name="type" select="string($parameter/paramtype)"/>
+
+      <xsl:variable name="default">
+        <xsl:choose>
+          <xsl:when test="$parameter/@default">
+            <xsl:text> = </xsl:text>
+            <xsl:value-of select="$parameter/@default"/>
+          </xsl:when>
+          <xsl:when test="$parameter/default">
+            <xsl:text> = </xsl:text>
+            <xsl:choose>
+              <xsl:when test="$final">
+                <xsl:apply-templates
+                  select="$parameter/default/*|$parameter/default/text()"
+                  mode="annotation"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="string($parameter/default)"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+        </xsl:choose>
+      </xsl:variable>
+
+      <xsl:variable name="text" select="concat($type, $name, $default)"/>
+      
+      <xsl:variable name="end-column" 
+        select="$column + string-length($prefix) + string-length($text)"/>
+
+      <xsl:choose>
+        <!-- Parameter goes on this line -->
+        <xsl:when test="$first-on-line or ($end-column < $max-columns) 
+                        or not($wrap)">
+          <xsl:choose>
+            <xsl:when test="$final">
+              <xsl:value-of select="$prefix"/>
+              <xsl:apply-templates 
+                select="$parameter/paramtype/*|$parameter/paramtype/text()"
+                mode="annotation">
+                <xsl:with-param name="highlight" select="true()"/>
+              </xsl:apply-templates>
+              <xsl:value-of select="$name"/>
+              <xsl:copy-of select="$default"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="concat($prefix, $text)"/>
+            </xsl:otherwise>
+          </xsl:choose>
+
+          <xsl:call-template name="function-parameters">
+            <xsl:with-param name="indentation" select="$indentation"/>
+            <xsl:with-param name="include-names" select="$include-names"/>
+            <xsl:with-param name="wrap" select="$wrap"/>
+            <xsl:with-param name="final" select="$final"/>
+            <xsl:with-param name="parameters" 
+              select="$parameters[position()!=1]"/>
+            <xsl:with-param name="prefix" select="', '"/>
+            <xsl:with-param name="column" select="$end-column"/>
+            <xsl:with-param name="first-on-line" select="false()"/>
+          </xsl:call-template>
+        </xsl:when>
+        <!-- Parameter goes on next line -->
+        <xsl:otherwise>
+          <!-- The comma goes on this line -->
+          <xsl:value-of select="$prefix"/><xsl:text>
</xsl:text>
+
+          <!-- Indent and print the parameter -->
+          <xsl:call-template name="indent">
+            <xsl:with-param name="indentation" select="$indentation"/>
+          </xsl:call-template>
+          <xsl:choose>
+            <xsl:when test="$final">
+              <xsl:apply-templates 
+                select="$parameter/paramtype/*|$parameter/paramtype/text()"
+                mode="annotation">
+                <xsl:with-param name="highlight" select="true()"/>
+              </xsl:apply-templates>
+              <xsl:value-of select="$name"/>
+              <xsl:value-of select="$default"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="concat($prefix, $text)"/>
+            </xsl:otherwise>
+          </xsl:choose>
+
+          <!-- Emit next parameter -->
+          <xsl:call-template name="function-parameters">
+            <xsl:with-param name="indentation" select="$indentation"/>
+            <xsl:with-param name="include-names" select="$include-names"/>
+            <xsl:with-param name="wrap" select="$wrap"/>
+            <xsl:with-param name="final" select="$final"/>
+            <xsl:with-param name="parameters" 
+              select="$parameters[position()!=1]"/>
+            <xsl:with-param name="prefix" select="', '"/>
+            <xsl:with-param name="column" 
+              select="1 + string-length($text) + $indentation"/>
+            <xsl:with-param name="first-on-line" select="false()"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Function synopsis -->
+  <xsl:template match="function|method" mode="synopsis">
+    <xsl:param name="indentation"/>
+
+    <!-- True if we should compact this function -->
+    <xsl:variable name="compact"
+      select="not (para|description|requires|effects|postconditions|returns|
+                   throws|complexity|notes|rationale) and 
+              ($boost.compact.function='1') and
+              not (local-name(.)='method')"/>
+
+    <xsl:choose>
+      <xsl:when test="$compact">
+        <xsl:if test="purpose">
+          <!-- Compact display outputs the purpose as a comment (if
+               there is one) and the entire function declaration. -->
+          <xsl:text>

</xsl:text>
+          <xsl:call-template name="indent">
+            <xsl:with-param name="indentation" select="$indentation"/>
+          </xsl:call-template>
+
+          <xsl:call-template name="highlight-comment">
+            <xsl:with-param name="text">
+              <xsl:text>// </xsl:text>
+              <xsl:apply-templates select="purpose/*|purpose/text()"
+                mode="purpose"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+
+        <xsl:call-template name="function">
+          <xsl:with-param name="indentation" select="$indentation"/>
+          <xsl:with-param name="is-reference" select="true()"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="function">
+          <xsl:with-param name="indentation" select="$indentation"/>
+          <xsl:with-param name="is-reference" select="false()"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="overloaded-function|overloaded-method" mode="synopsis">
+    <xsl:param name="indentation"/>
+
+    <xsl:variable name="name" select="@name"/>
+
+    <!-- True if we should compact this function -->
+    <xsl:variable name="compact"
+      select="not (para|description|requires|effects|postconditions|returns|
+                   throws|complexity|notes|rationale) and 
+              ($boost.compact.function='1') and
+              not (local-name(.)='overloaded-method')"/>
+
+    <xsl:choose>
+      <xsl:when test="$compact">
+        <xsl:if test="purpose">
+          <!-- Compact display outputs the purpose as a comment (if
+               there is one) and the entire function declaration. -->
+          <xsl:text>
</xsl:text>
+          <xsl:call-template name="indent">
+            <xsl:with-param name="indentation" select="$indentation"/>
+          </xsl:call-template>
+          
+          <xsl:call-template name="highlight-comment">
+            <xsl:with-param name="text">
+              <xsl:text>// </xsl:text>
+              <xsl:apply-templates select="purpose" mode="annotation"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+
+        <xsl:for-each select="signature">
+          <xsl:call-template name="function">
+            <xsl:with-param name="indentation" select="$indentation"/>
+            <xsl:with-param name="is-reference" select="true()"/>
+            <xsl:with-param name="name" select="$name"/>
+          </xsl:call-template>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:when test="local-name(..)='namespace'">
+        <xsl:variable name="link-to">
+          <xsl:call-template name="generate.id"/>
+        </xsl:variable>
+
+        <xsl:for-each select="signature">
+          <xsl:call-template name="function">
+            <xsl:with-param name="indentation" select="$indentation"/>
+            <xsl:with-param name="is-reference" select="false()"/>
+            <xsl:with-param name="name" select="$name"/>
+            <xsl:with-param name="link-to" select="$link-to"/>
+          </xsl:call-template>
+        </xsl:for-each>        
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="signature">
+          <xsl:call-template name="function">
+            <xsl:with-param name="indentation" select="$indentation"/>
+            <xsl:with-param name="is-reference" select="false()"/>
+            <xsl:with-param name="name" select="$name"/>
+          </xsl:call-template>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Group free functions together under a category name (header synopsis)-->
+  <xsl:template match="free-function-group" mode="header-synopsis">
+    <xsl:param name="class"/>
+    <xsl:param name="indentation"/>
+    <xsl:apply-templates select="function|overloaded-function" mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <!-- Constructors, destructor, and assignment operators -->
+  <xsl:template name="construct-copy-destruct-synopsis">
+    <xsl:param name="indentation"/>
+    <xsl:if test="constructor|copy-assignment|destructor">
+      <xsl:if test="typedef|static-constant">
+        <xsl:text>
</xsl:text>
+      </xsl:if>
+      <xsl:text>
</xsl:text>
+      <xsl:call-template name="indent">
+        <xsl:with-param name="indentation" select="$indentation"/>      
+      </xsl:call-template>
+      <emphasis>
+        <xsl:text>// </xsl:text>
+        <xsl:call-template name="internal-link">
+          <xsl:with-param name="to">
+            <xsl:call-template name="generate.id"/>
+            <xsl:text>construct-copy-destruct</xsl:text>
+          </xsl:with-param>
+          <xsl:with-param name="text" select="'construct/copy/destruct'"/>
+        </xsl:call-template>
+      </emphasis>
+      <xsl:apply-templates select="constructor" mode="synopsis">
+        <xsl:with-param name="indentation" select="$indentation"/>
+      </xsl:apply-templates>
+      <xsl:apply-templates select="copy-assignment" mode="synopsis">
+        <xsl:with-param name="indentation" select="$indentation"/>
+      </xsl:apply-templates>
+      <xsl:apply-templates select="destructor" mode="synopsis">
+        <xsl:with-param name="indentation" select="$indentation"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="construct-copy-destruct-reference">
+    <xsl:if test="constructor|copy-assignment|destructor">
+      <xsl:call-template name="member-documentation">
+        <xsl:with-param name="name">
+          <xsl:call-template name="anchor">
+            <xsl:with-param name="to">
+              <xsl:call-template name="generate.id"/>
+              <xsl:text>construct-copy-destruct</xsl:text>
+            </xsl:with-param>
+            <xsl:with-param name="text" select="''"/>
+          </xsl:call-template>
+          <xsl:call-template name="monospaced">
+            <xsl:with-param name="text" select="@name"/>
+          </xsl:call-template>
+          <xsl:text> construct/copy/destruct</xsl:text>
+        </xsl:with-param>
+        <xsl:with-param name="text">
+          <orderedlist>
+            <xsl:apply-templates select="constructor" mode="reference"/>
+            <xsl:apply-templates select="copy-assignment" mode="reference"/>
+            <xsl:apply-templates select="destructor" mode="reference"/>
+          </orderedlist>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="constructor" mode="reference">
+    <xsl:call-template name="function.documentation">
+      <xsl:with-param name="text">
+        <para>
+          <xsl:call-template name="preformatted">
+            <xsl:with-param name="text">
+              <xsl:call-template name="function">
+                <xsl:with-param name="indentation" select="0"/>
+                <xsl:with-param name="is-reference" select="true()"/>
+                <xsl:with-param name="constructor-for" select="../@name"/>
+                <xsl:with-param name="standalone" select="true()"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </para>
+        <xsl:call-template name="function-requirements"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  
+  <xsl:template match="copy-assignment" mode="reference">
+    <xsl:call-template name="function.documentation">
+      <xsl:with-param name="text">
+        <para>
+          <xsl:call-template name="preformatted">
+            <xsl:with-param name="text">
+              <xsl:call-template name="function">
+                <xsl:with-param name="indentation" select="0"/>
+                <xsl:with-param name="is-reference" select="true()"/>
+                <xsl:with-param name="copy-assign-for" select="../@name"/>
+                <xsl:with-param name="standalone" select="true()"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </para>
+        <xsl:call-template name="function-requirements"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="destructor" mode="reference">
+    <xsl:call-template name="function.documentation">
+      <xsl:with-param name="text">
+        <para>
+          <xsl:call-template name="preformatted">
+            <xsl:with-param name="text">
+              <xsl:call-template name="function">
+                <xsl:with-param name="indentation" select="0"/>
+                <xsl:with-param name="is-reference" select="true()"/>
+                <xsl:with-param name="destructor-for" select="../@name"/>
+                <xsl:with-param name="standalone" select="true()"/>
+              </xsl:call-template>
+            </xsl:with-param>
+          </xsl:call-template>
+        </para>
+        <xsl:call-template name="function-requirements"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- Templates for functions -->
+  <xsl:template name="function.documentation">
+    <xsl:param name="text"/>
+    <xsl:choose>
+      <xsl:when test="count(ancestor::free-function-group) > 0
+                      or count(ancestor::method-group) > 0
+                      or local-name(.)='constructor'
+                      or local-name(.)='copy-assignment'
+                      or local-name(.)='destructor'">
+        <listitem><xsl:copy-of select="$text"/></listitem>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="$text"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Semantic descriptions of functions -->
+  <xsl:template name="function-requirements">
+    <xsl:param name="namespace-reference" select="false()"/>
+
+    <xsl:if test="$namespace-reference=false()">
+      <xsl:apply-templates select="purpose/*"/>
+    </xsl:if>
+
+    <xsl:apply-templates select="description/*"/>
+
+    <xsl:if test="parameter/description|signature/parameter/description|
+                  requires|effects|postconditions|returns|throws|complexity|
+                  notes|rationale">
+      <variablelist spacing="compact">
+        <xsl:processing-instruction name="dbhtml">
+          list-presentation="table"
+        </xsl:processing-instruction>
+
+        <!-- Document parameters -->
+        <xsl:if test="parameter/description|signature/parameter/description">
+          <varlistentry>
+            <term>Parameters:</term>
+            <listitem>
+              <variablelist spacing="compact">
+                <xsl:processing-instruction name="dbhtml">
+                  list-presentation="table"
+                </xsl:processing-instruction>
+                <xsl:for-each select="parameter|signature/parameter">
+		              <xsl:sort select="attribute::name"/>
+                  <xsl:if test="description">
+                    <varlistentry>
+                      <term>
+                        <xsl:call-template name="monospaced">
+                          <xsl:with-param name="text" select="@name"/>
+                        </xsl:call-template>
+                      </term>
+                      <listitem>
+                        <xsl:apply-templates select="description/*"/>
+                      </listitem>
+                    </varlistentry>
+                  </xsl:if>
+                </xsl:for-each>
+              </variablelist>
+            </listitem>
+          </varlistentry>
+        </xsl:if>
+
+        <!-- Document rest of function's contract -->
+        <xsl:for-each select="requires|effects|postconditions|returns|throws|complexity|
+                      notes|rationale">
+          <varlistentry>
+            <term><xsl:call-template name="function.requirement.name"/>:</term>
+            <listitem>
+              <xsl:apply-templates select="./*|./text()" mode="annotation"/>
+            </listitem>
+          </varlistentry>
+        </xsl:for-each>
+
+      </variablelist>
+    </xsl:if>
+
+    <xsl:if test="para">
+      <xsl:message>
+        <xsl:text>Warning: Use of 'para' elements in a function is deprecated.
</xsl:text>
+        <xsl:text>  Wrap them in a 'description' element.</xsl:text>
+      </xsl:message>
+      <xsl:call-template name="print.warning.context"/>
+      <xsl:apply-templates select="para"/>
+    </xsl:if>
+
+  </xsl:template>
+
+  <xsl:template name="function.requirement.name">
+    <xsl:param name="node" select="."/>
+    <xsl:choose>
+      <xsl:when test="local-name($node)='requires'">Requires</xsl:when>
+      <xsl:when test="local-name($node)='effects'">Effects</xsl:when>
+      <xsl:when test="local-name($node)='postconditions'">
+        <xsl:text>Postconditions</xsl:text>
+      </xsl:when>
+      <xsl:when test="local-name($node)='returns'">Returns</xsl:when>
+      <xsl:when test="local-name($node)='throws'">Throws</xsl:when>
+      <xsl:when test="local-name($node)='complexity'">Complexity</xsl:when>
+      <xsl:when test="local-name($node)='notes'">Notes</xsl:when>
+      <xsl:when test="local-name($node)='rationale'">Rationale</xsl:when>
+      <xsl:otherwise>
+        <xsl:message>
+          <xsl:text>Error: unhandled node type `</xsl:text>
+          <xsl:value-of select="local-name($node)"/>
+          <xsl:text>' in template function.requirement.name.</xsl:text>
+        </xsl:message>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Function reference -->
+  <xsl:template match="function|method" mode="reference">
+    <!-- True if we should compact this function -->
+    <xsl:variable name="compact"
+      select="not (para|description|requires|effects|postconditions|returns|
+                   throws|complexity|notes|rationale) and 
+              ($boost.compact.function='1') and
+              not (local-name(.)='method')"/>
+
+    <xsl:if test="not ($compact)">
+      <xsl:call-template name="function.documentation">
+        <xsl:with-param name="text">
+          <para>
+            <xsl:call-template name="preformatted">
+              <xsl:with-param name="text">
+                <xsl:call-template name="function">
+                  <xsl:with-param name="indentation" select="0"/>
+                  <xsl:with-param name="is-reference" select="true()"/>
+                  <xsl:with-param name="link-type" select="'anchor'"/>
+                  <xsl:with-param name="standalone" select="true()"/>
+                </xsl:call-template>
+              </xsl:with-param>
+            </xsl:call-template>
+          </para>
+          <xsl:call-template name="function-requirements"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Reference for functions at namespace level -->
+  <xsl:template match="function" mode="namespace-reference">
+    <!-- True if we should compact this function -->
+    <xsl:variable name="compact"
+      select="not (para|description|requires|effects|postconditions|returns|
+                   throws|complexity|notes|rationale) and 
+              ($boost.compact.function='1')"/>
+
+    <xsl:if test="not ($compact)">
+      <xsl:call-template name="reference-documentation">
+        <xsl:with-param name="name">
+          <xsl:text>Function </xsl:text>
+          <xsl:if test="template">
+            <xsl:text>template </xsl:text>
+          </xsl:if>
+          <xsl:call-template name="monospaced">
+            <xsl:with-param name="text" select="@name"/>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="refname">
+          <xsl:call-template name="fully-qualified-name">
+            <xsl:with-param name="node" select="."/>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
+        <xsl:with-param name="anchor">
+          <xsl:call-template name="generate.id"/>
+        </xsl:with-param>
+        <xsl:with-param name="synopsis">
+          <xsl:call-template name="function">
+            <xsl:with-param name="indentation" select="0"/>
+            <xsl:with-param name="is-reference" select="true()"/>
+            <xsl:with-param name="link-type" select="'none'"/>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="text">
+          <xsl:call-template name="function-requirements">
+            <xsl:with-param name="namespace-reference" select="true()"/>
+          </xsl:call-template>
+        </xsl:with-param>
+      </xsl:call-template> 
+    </xsl:if>   
+  </xsl:template>
+
+  <xsl:template match="overloaded-function" mode="reference">
+    <xsl:variable name="name" select="@name"/>
+
+    <!-- True if we should compact this function -->
+    <xsl:variable name="compact"
+      select="not (para|description|requires|effects|postconditions|returns|
+                   throws|complexity|notes|rationale) and 
+              ($boost.compact.function='1')"/>
+    
+    <xsl:if test="not ($compact)">
+      <xsl:call-template name="function.documentation">
+        <xsl:with-param name="text">
+          <para>
+            <xsl:attribute name="id">
+              <xsl:call-template name="generate.id"/>
+            </xsl:attribute>
+            
+            <xsl:call-template name="preformatted">
+              <xsl:with-param name="text">
+                <xsl:for-each select="signature">
+                  <xsl:call-template name="function">
+                    <xsl:with-param name="indentation" select="0"/>
+                    <xsl:with-param name="is-reference" select="true()"/>
+                    <xsl:with-param name="name" select="$name"/>
+                    <xsl:with-param name="standalone" select="true()"/>
+                  </xsl:call-template>
+                </xsl:for-each>
+              </xsl:with-param>
+            </xsl:call-template>
+          </para>
+          <xsl:call-template name="function-requirements"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="overloaded-function" mode="namespace-reference">
+    <!-- True if we should compact this function -->
+    <xsl:variable name="compact"
+      select="not (para|description|requires|effects|postconditions|returns|
+                   throws|complexity|notes|rationale) and 
+              ($boost.compact.function='1')"/>
+
+    <xsl:variable name="name" select="@name"/>
+
+    <xsl:if test="not ($compact)">
+      <xsl:call-template name="reference-documentation">
+        <xsl:with-param name="name">
+          <xsl:text>Function </xsl:text>
+          <xsl:if test="template">
+            <xsl:text>template </xsl:text>
+          </xsl:if>
+          <xsl:call-template name="monospaced">
+            <xsl:with-param name="text" select="@name"/>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="refname">
+          <xsl:call-template name="fully-qualified-name">
+            <xsl:with-param name="node" select="."/>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
+        <xsl:with-param name="anchor">
+          <xsl:call-template name="generate.id"/>
+        </xsl:with-param>
+        <xsl:with-param name="synopsis">
+          <xsl:for-each select="signature">
+            <xsl:call-template name="function">
+              <xsl:with-param name="indentation" select="0"/>
+              <xsl:with-param name="is-reference" select="true()"/>
+              <xsl:with-param name="link-type" select="'none'"/>
+              <xsl:with-param name="name" select="$name"/>
+            </xsl:call-template>
+          </xsl:for-each>
+        </xsl:with-param>
+        <xsl:with-param name="text">
+          <xsl:call-template name="function-requirements">
+            <xsl:with-param name="namespace-reference" select="true()"/>
+          </xsl:call-template>
+        </xsl:with-param>
+      </xsl:call-template> 
+    </xsl:if>   
+  </xsl:template>
+
+  <xsl:template match="overloaded-method" mode="reference">
+    <xsl:variable name="name" select="@name"/>
+
+    <xsl:call-template name="function.documentation">
+      <xsl:with-param name="text">
+        <para>
+          <xsl:attribute name="id">
+            <xsl:call-template name="generate.id"/>
+          </xsl:attribute>
+          
+          <xsl:call-template name="preformatted">
+            <xsl:with-param name="text">
+              <xsl:for-each select="signature">
+                <xsl:call-template name="function">
+                  <xsl:with-param name="indentation" select="0"/>
+                  <xsl:with-param name="is-reference" select="true()"/>
+                  <xsl:with-param name="name" select="$name"/>
+                  <xsl:with-param name="standalone" select="true()"/>
+                </xsl:call-template>
+              </xsl:for-each>
+            </xsl:with-param>
+          </xsl:call-template>
+        </para>
+        <xsl:call-template name="function-requirements"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- Group member functions together under a category name (synopsis)-->
+  <xsl:template match="method-group" mode="synopsis">
+    <xsl:param name="indentation"/>
+    <xsl:if test="count(child::*) > 0">
+      <xsl:text>
</xsl:text>
+      <xsl:text>
</xsl:text>
+      <xsl:call-template name="indent">
+        <xsl:with-param name="indentation" select="$indentation"/>
+      </xsl:call-template>
+      <emphasis>
+        <xsl:text>// </xsl:text>
+        <xsl:call-template name="internal-link">
+          <xsl:with-param name="to">
+            <xsl:call-template name="generate.id"/>
+          </xsl:with-param>
+          <xsl:with-param name="text" select="string(@name)"/>
+        </xsl:call-template>
+      </emphasis>
+      <xsl:apply-templates select="method|overloaded-method" 
+        mode="synopsis">
+        <xsl:with-param name="indentation" select="$indentation"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Group member functions together under a category name (reference)-->
+  <xsl:template match="method-group" mode="reference">
+    <xsl:if test="count(child::*) > 0">
+      <xsl:call-template name="member-documentation">
+        <xsl:with-param name="name">
+          <xsl:call-template name="anchor">
+            <xsl:with-param name="to">
+              <xsl:call-template name="generate.id"/>
+            </xsl:with-param>
+            <xsl:with-param name="text" select="''"/>
+          </xsl:call-template>
+          <xsl:call-template name="monospaced">
+            <xsl:with-param name="text" select="../@name"/>
+          </xsl:call-template>
+          <xsl:text> </xsl:text>
+          <xsl:value-of select="@name"/>
+        </xsl:with-param>
+        <xsl:with-param name="text">
+          <orderedlist>
+            <xsl:apply-templates select="method|overloaded-method"
+              mode="reference"/>
+          </orderedlist>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template> 
+
+  <!-- Group free functions together under a category name (synopsis)-->
+  <xsl:template match="free-function-group" mode="synopsis">
+    <xsl:param name="class"/>
+    <xsl:param name="indentation"/>
+    <xsl:text>
</xsl:text>
+    <xsl:text>
</xsl:text>
+    <xsl:call-template name="indent">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:call-template>
+    <emphasis>
+      <xsl:text>// </xsl:text>
+      <xsl:call-template name="internal-link">
+        <xsl:with-param name="to">
+          <xsl:call-template name="generate.id"/>
+        </xsl:with-param>
+        <xsl:with-param name="text" select="string(@name)"/>
+      </xsl:call-template>
+    </emphasis>
+    <xsl:apply-templates select="function|overloaded-function" mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <!-- Group free functions together under a category name (reference)-->
+  <xsl:template match="free-function-group" mode="reference">
+    <xsl:param name="class"/>
+    <xsl:call-template name="member-documentation">
+      <xsl:with-param name="name">
+        <xsl:call-template name="anchor">
+          <xsl:with-param name="to">
+            <xsl:call-template name="generate.id"/>
+          </xsl:with-param>
+          <xsl:with-param name="text" select="''"/>
+        </xsl:call-template>
+        <xsl:call-template name="monospaced">
+          <xsl:with-param name="text" select="$class"/>
+        </xsl:call-template>
+        <xsl:value-of select="concat(' ',@name)"/>
+      </xsl:with-param>
+      <xsl:with-param name="text">
+        <orderedlist>
+          <xsl:apply-templates select="function|overloaded-function"
+            mode="reference"/>
+        </orderedlist>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>  
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/global.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/global.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <xsl:template name="global-synopsis">
+    <xsl:param name="indentation" select="0" />
+    <xsl:if test="not(local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() > 1)">
+      <xsl:text>
</xsl:text>
+    </xsl:if>
+    <xsl:text>
</xsl:text>
+    <xsl:call-template name="indent">
+      <xsl:with-param name="indentation" select="$indentation" />
+    </xsl:call-template>
+    <xsl:call-template name="global-synopsis-impl">
+      <xsl:with-param name="link-type" select="'link'" />
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template name="global-reference">
+    <xsl:call-template name="reference-documentation">
+      <xsl:with-param name="refname">
+        <xsl:call-template name="fully-qualified-name">
+          <xsl:with-param name="node" select="." />
+        </xsl:call-template>
+        <xsl:apply-templates select="specialization" />
+      </xsl:with-param>
+      <xsl:with-param name="purpose" select="purpose/*|purpose/text()" />
+      <xsl:with-param name="anchor">
+        <xsl:call-template name="generate.id" />
+      </xsl:with-param>
+      <xsl:with-param name="name">
+        <xsl:text>Global </xsl:text>
+        <xsl:call-template name="monospaced">
+          <xsl:with-param name="text" select="@name" />
+        </xsl:call-template>
+      </xsl:with-param>
+      <xsl:with-param name="synopsis">
+        <xsl:call-template name="global-synopsis-impl">
+          <xsl:with-param name="link-type" select="'none'" />
+        </xsl:call-template>
+      </xsl:with-param>
+      <xsl:with-param name="text">
+        <xsl:apply-templates select="description" />
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template name="global-synopsis-impl">
+    <xsl:param name="link-type" />
+    <xsl:if test="@specifiers">
+      <xsl:call-template name="highlight-keyword">
+        <xsl:with-param name="keyword" select="@specifiers" />
+      </xsl:call-template>
+      <xsl:text> </xsl:text>
+    </xsl:if>
+    <xsl:apply-templates select="type/*|type/text()" mode="annotation" />
+    <xsl:text> </xsl:text>
+    <xsl:call-template name="link-or-anchor">
+      <xsl:with-param name="to">
+        <xsl:call-template name="generate.id" select="." />
+      </xsl:with-param>
+      <xsl:with-param name="text" select="@name" />
+      <xsl:with-param name="link-type" select="$link-type" />
+    </xsl:call-template>
+    <xsl:text>;</xsl:text>
+  </xsl:template>
+  <xsl:template match="data-member" mode="generate.id">
+    <xsl:call-template name="fully-qualified-name">
+      <xsl:with-param name="node" select="."/>
+      <xsl:with-param name="separator" select="'.'"/>
+    </xsl:call-template>
+  </xsl:template>
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/header.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/header.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2007 Matias Capeletto
+
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+
+<!--
+   Header stylesheet
+  -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+<xsl:import href="relative-href.xsl"/>
+<xsl:import href="javascript.xsl"/>
+<xsl:import href="navbar.xsl"/>
+
+   <!--
+       The style of the html pages
+         *website   - like the beta.boost.org
+          textlinks - old logo and links style
+   -->
+   <xsl:param name = "page.style" select = "'website'"/>
+
+   <!-- Chapters and sections select boxes params -->
+
+   <xsl:param name = "grouped.links.js" select = "'grouped_links.js'"/>
+
+   <xsl:param name = "grouped.links.chapters.show" select = "'false'"/>
+   <xsl:param name = "grouped.links.chapters.xml"  select = "'boost_libs.xml'"/>
+   <xsl:param name = "grouped.links.chapters.url"  select = "''"/>
+
+   <xsl:param name = "grouped.links.sections.show" select = "'false'"/>
+   <xsl:param name = "grouped.links.sections.xml"  select = "'sections.xml'"/>
+   <xsl:param name = "grouped.links.sections.url"  select = "''"/>
+
+   <!-- Google search box params -->
+
+   <xsl:param name = "search.box.show" select = "'false'"/>
+   <xsl:param name = "search.box.cse.definition.src"
+     select = "'http://www.boost.org/cse.definition.xml'"/>
+
+
+
+   <xsl:template name = "boostbook.header">
+      <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:choose>
+      <xsl:when test = "$page.style = 'website'">
+
+      <!-- Include the grouped links java script api -->
+
+      <xsl:if test = "$grouped.links.chapters.show = 'true' or
+                      $grouped.links.sections.show = 'true'">
+         <xsl:call-template name="include.javascript">
+            <xsl:with-param name="url" select="$grouped.links.js"/>
+         </xsl:call-template>
+      </xsl:if>
+
+      <div id="heading">
+
+         <div id="heading-placard"></div>
+
+         <!-- GroupedLinks selection boxes for All Boost Libraries and
+              inner sections -->
+
+         <div class="heading_navigation_box">
+         <xsl:if test = "$grouped.links.chapters.show = 'true'">
+            <xsl:call-template name = "grouped.links.select.box">
+               <xsl:with-param name = "definition.xml"
+                               select="$grouped.links.chapters.xml"/>
+               <xsl:with-param name = "element.id" select = "'chapters_select_box'"/>
+               <xsl:with-param name = "base.url"
+                               select="$grouped.links.chapters.url"/>
+            </xsl:call-template>
+         </xsl:if>
+         <xsl:if test = "$grouped.links.sections.show = 'true'">
+            <xsl:call-template name = "grouped.links.select.box">
+               <xsl:with-param name = "definition.xml"
+                               select="$grouped.links.sections.xml"/>
+               <xsl:with-param name = "element.id" select = "'sections_select_box'"/>
+               <xsl:with-param name = "base.url"
+                               select="$grouped.links.sections.url"/>
+            </xsl:call-template>
+         </xsl:if>
+         </div>
+
+         <!-- Google Custom Search linked CSE allows us to customize google
+              search pages by means of a definition in xml format. By default a
+              general definition is used, but libraries are encouraged to change
+              it in order to add a refinement for the libs docs -->
+
+         <div class="heading_search_box">
+         <xsl:if test = "$search.box.show = 'true'">
+            <xsl:call-template name = "google.searh.box">
+               <xsl:with-param name = "search.box.cse.definition"
+                               select = "cse.definition.src"/>
+            </xsl:call-template>
+         </xsl:if>
+         </div>
+
+      </div>
+
+      <!-- Navigation -->
+
+      <xsl:call-template name="boost.navbar">
+         <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:when>
+      <xsl:when test = "$page.style = 'textlinks'">
+         <xsl:call-template name="header.textlinks">
+            <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:when>
+      </xsl:choose>
+
+   </xsl:template>
+
+
+
+   <!--
+      google.searh.box template
+
+      params:
+         cse.definition - absolute web url of the cse definition xml
+
+      effects:
+         Insert a linked cse google search box
+   -->
+
+   <xsl:template name = "google.searh.box">
+      <xsl:param name = "cse.definition"/>
+
+      <form id="cref" action="http://google.com/cse">
+         <input type="hidden" name="cref" value="{$cse.definition}" />
+         <div> Search Boost </div>
+         <div>
+         <input class="search_box" type="text" name="q" id="q" size="40"
+                maxlength="255" alt="Search Text"/>
+         </div>
+      </form>
+   </xsl:template>
+
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/html-single.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/html-single.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"
+                version="1.0">
+
+  <!-- Import the HTML stylesheet -->
+
+  <xsl:import
+    href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
+  <xsl:import href="admon.xsl"/>
+
+  <xsl:param name="admon.style"/>
+  <xsl:param name="admon.graphics">1</xsl:param>
+  <xsl:param name="chapter.autolabel" select="0"/>
+  <xsl:param name="refentry.generate.name" select="0"/>
+  <xsl:param name="refentry.generate.title" select="1"/>
+  <xsl:param name="make.year.ranges" select="1"/>
+
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/html.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/html.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"
+                version="1.0">
+
+  <!-- Import the HTML chunking stylesheet -->
+  <xsl:import
+    href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
+  <xsl:import
+    href="http://docbook.sourceforge.net/release/xsl/current/html/math.xsl"/>
+
+  <xsl:import href="chunk-common.xsl"/>
+  <xsl:import href="docbook-layout.xsl"/>
+  <xsl:import href="admon.xsl"/>
+  <xsl:import href="xref.xsl"/>
+  <xsl:import href="relative-href.xsl"/>
+  <xsl:import href="callout.xsl"/>
+
+  <xsl:param name="admon.style"/>
+  <xsl:param name="admon.graphics">1</xsl:param>
+  <xsl:param name="html.stylesheet" select="'boostbook.css'"/>
+  <xsl:param name="navig.graphics" select="1"/>
+  <xsl:param name="navig.graphics.extension" select="'.png'"/>
+  <xsl:param name="chapter.autolabel" select="1"/>
+  <xsl:param name="use.id.as.filename" select="1"/>
+  <xsl:param name="refentry.generate.name" select="0"/>
+  <xsl:param name="refentry.generate.title" select="1"/>
+  <xsl:param name="make.year.ranges" select="1"/>
+  <xsl:param name="generate.manifest" select="1"/>
+  <xsl:param name="generate.section.toc.level" select="3"/>
+  <xsl:param name="doc.standalone">false</xsl:param>
+  <xsl:param name="chunker.output.indent">yes</xsl:param>
+  <xsl:param name="toc.max.depth">2</xsl:param>
+  <xsl:param name="callout.graphics.number.limit">15</xsl:param>
+
+<xsl:param name="admon.style">
+    <!-- Remove the style. Let the CSS do the styling -->
+</xsl:param>
+
+<!-- Always have graphics -->
+<xsl:param name="admon.graphics" select="1"/>
+
+  <xsl:param name="generate.toc">
+appendix  toc,title
+article/appendix  nop
+article   toc,title
+book      toc,title
+chapter   toc,title
+part      toc,title
+preface   toc,title
+qandadiv  toc
+qandaset  toc
+reference toc,title
+sect1     toc
+sect2     toc
+sect3     toc
+sect4     toc
+sect5     toc
+section   toc
+set       toc,title
+  </xsl:param>
+
+
+
+
+  <!-- We don't want refentry's to show up in the TOC because they
+       will merely be redundant with the synopsis. -->
+  <xsl:template match="refentry" mode="toc"/>
+
+  <!-- override the behaviour of some DocBook elements for better
+       rendering facilities -->
+
+  <xsl:template match = "programlisting[ancestor::informaltable]">
+     <pre class = "table-{name(.)}"><xsl:apply-templates/></pre>
+  </xsl:template>
+
+  <xsl:template match = "refsynopsisdiv">
+     <h2 class = "{name(.)}-title">Synopsis</h2>
+     <div class = "{name(.)}">
+        <xsl:apply-templates/>
+     </div>
+  </xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template name="output.html.stylesheets">
+    <xsl:param name="stylesheets" select="''"/>
+
+    <xsl:choose>
+        <xsl:when test="contains($stylesheets, ' ')">
+            <link rel="stylesheet">
+                <xsl:attribute name="href">
+                    <xsl:call-template name="href.target.relative">
+                        <xsl:with-param name="target" select="substring-before($stylesheets, ' ')"/>
+                    </xsl:call-template>
+                </xsl:attribute>
+                <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">
+                <xsl:attribute name="href">
+                    <xsl:call-template name="href.target.relative">
+                        <xsl:with-param name="target" select="$stylesheets"/>
+                    </xsl:call-template>
+                </xsl:attribute>
+                <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:stylesheet>
Added: sandbox/doc_test/xsl_test/index.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/index.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+  <xsl:template match="class-index">
+    
+  </xsl:template>
+
+  <xsl:template match="function-index">
+    
+  </xsl:template>
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/javascript.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/javascript.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2007 Matias Capeletto
+
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+
+<!--
+   Templates that allows the use javascript
+   Support for GroupedLinks select boxes
+  -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+<xsl:import href="relative-href.xsl"/>
+
+   <!--
+      include.javascript template
+
+      Params:
+         url - path to the js file (it can be relative)
+
+      Effects:
+         Include a js file in a page
+   -->
+
+   <xsl:template name = "include.javascript">
+      <xsl:param name = "url"/>
+
+      <script type="text/javascript">
+         <xsl:attribute name = "src">
+            <xsl:call-template name = "href.target.relative">
+               <xsl:with-param name = "target" select = "$url"/>
+            </xsl:call-template>
+         </xsl:attribute>
+      </script>
+   </xsl:template>
+
+   <!--
+      grouped.links.select.box template
+
+      Params:
+         definition.xml - path to the xml definition file (it can be relative)
+         form.id - string identifier, it must be unique in the page
+         form.id - string identifier, it must be unique in the page
+
+      Effects:
+         Insert a GropedLinks select box
+
+      Requires:
+         grouped_links.js must be included in the page
+   -->
+
+   <xsl:template name = "grouped.links.select.box">
+      <xsl:param name = "definition.xml"/>
+      <xsl:param name = "element.id"/>
+      <xsl:param name = "base.url"/>
+
+      <div class="grouped_links">
+         <xsl:attribute name = "id">
+            <xsl:value-of select="$element.id"/>
+         </xsl:attribute>
+         <script type="text/javascript">
+            grouped_links_select_box(
+               '<xsl:call-template name="href.target.relative">
+                <xsl:with-param name="target"
+                                select="$definition.xml"/>
+                </xsl:call-template>',
+                '<xsl:value-of select="$element.id"/>',
+                '<xsl:call-template name="href.target.relative">
+                    <xsl:with-param name="target"
+                                    select="$base.url"/>
+                   </xsl:call-template>');
+         </script>
+      </div>
+   </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
Added: sandbox/doc_test/xsl_test/library.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/library.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+  <xsl:key name="library-categories" match="library" 
+    use="libraryinfo/librarycategory/@name"/>
+
+  <xsl:template match="librarylist">
+    <itemizedlist spacing="compact">
+      <xsl:apply-templates select="//library"
+        mode="build-library-list">
+        <xsl:sort select="@name"/>
+      </xsl:apply-templates>
+    </itemizedlist>
+  </xsl:template>
+
+  <xsl:template name="library.link">
+    <xsl:param name="node" select="."/>
+    <xsl:param name="name" select="$node/attribute::name"/>
+
+    <xsl:choose>
+      <xsl:when test="$node/attribute::html-only = 1">
+        <xsl:variable name="url">
+          <xsl:choose>
+            <xsl:when test="$node/attribute::url">
+              <xsl:value-of select="$node/attribute::url"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="concat($boost.root,
+                                           '/libs/', 
+                                           $node/attribute::dirname, 
+                                           '/index.html')"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+        <ulink>
+          <xsl:attribute name="url">
+            <xsl:value-of select="$url"/>
+          </xsl:attribute>
+          <xsl:value-of select="$name"/>
+        </ulink>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="internal-link">
+          <xsl:with-param name="to">
+            <xsl:choose>
+              <xsl:when test="$node/attribute::id">
+                <xsl:value-of select="$node/attribute::id"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:call-template name="generate.id">
+                  <xsl:with-param name="node" select="$node"/>
+                </xsl:call-template>
+              </xsl:otherwise>
+            </xsl:choose>                 
+          </xsl:with-param>
+          <xsl:with-param name="text" select="$name"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>    
+  </xsl:template>
+  
+  <xsl:template match="library" mode="build-library-list">
+    <listitem>
+      <simpara>
+        <xsl:call-template name="library.link"/>
+        <xsl:text> - </xsl:text>
+        <xsl:apply-templates select="libraryinfo/librarypurpose"
+          mode="build-library-list"/>
+      </simpara>
+    </listitem>
+  </xsl:template>
+
+  <xsl:template match="librarypurpose" mode="build-library-list">
+    <xsl:apply-templates/>
+    <xsl:text>, from </xsl:text>
+    <xsl:apply-templates select="../author" mode="display-author-list"/>
+  </xsl:template>
+
+  <xsl:template match="author" mode="display-author-list">
+    <xsl:if test="(position() > 1) and (count(../author) > 2)">
+      <xsl:text>, </xsl:text>
+    </xsl:if>
+    <xsl:if test="(position() = count(../author)) and (position() > 1)">
+      <xsl:if test="position() < 3">
+        <xsl:text> </xsl:text>
+      </xsl:if>
+      <xsl:text>and </xsl:text>
+    </xsl:if>
+    <xsl:apply-templates select="firstname/text()"/>
+    <xsl:text> </xsl:text>
+    <xsl:apply-templates select="surname/text()"/>
+    <xsl:if test="(position() = count(../author))">
+      <xsl:text>.</xsl:text>      
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="librarycategorylist">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="librarycategorydef">
+    <section>
+      <title><xsl:apply-templates/></title>
+      <xsl:variable name="name" select="@name"/>
+      <itemizedlist spacing="compact">
+        <xsl:apply-templates select="key('library-categories', $name)"
+          mode="build-library-list">
+          <xsl:sort select="@name"/>
+        </xsl:apply-templates>
+      </itemizedlist>
+    </section>
+  </xsl:template>
+
+  <xsl:template match="libraryinfo">
+    <chapterinfo>
+      <xsl:apply-templates select="author|copyright|legalnotice"/>
+    </chapterinfo>
+  </xsl:template>
+
+  <xsl:template match="librarypurpose|librarycategory"/>
+
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/lookup.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/lookup.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,449 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+  <xsl:param name="boost.max.id.length">26</xsl:param>
+
+  <!-- Generate an ID for the entity referenced -->
+  <xsl:template name="generate.id">
+    <xsl:param name="node" select="."/>
+    <xsl:choose>
+      <xsl:when test="ancestor::class-specialization|ancestor::struct-specialization|ancestor::union-specialization">
+        <xsl:value-of select="generate-id(.)"/>
+        <xsl:text>-bb</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="$node" mode="generate.id"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="*" mode="generate.id">
+    <xsl:value-of select="generate-id(.)"/>
+    <xsl:text>-bb</xsl:text>
+  </xsl:template>
+
+  <xsl:template name="strip-qualifiers-non-template">
+    <xsl:param name="name"/>
+    <xsl:choose>
+      <xsl:when test="contains($name, '>')">
+        <xsl:call-template name="strip-qualifiers-non-template">
+          <xsl:with-param name="name" select="substring-after($name, '>')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($name, '::')">
+        <xsl:call-template name="strip-qualifiers-non-template">
+          <xsl:with-param name="name" select="substring-after($name, '::')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$name"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="strip-balanced">
+    <xsl:param name="name"/>
+    <xsl:param name="open" select="'<'"/>
+    <xsl:param name="close" select="'>'"/>
+    <xsl:param name="depth" select="0"/>
+    <xsl:choose>
+      <xsl:when test="contains($name, $open)
+                and not(contains(substring-before($name, $open), $close))">
+        <xsl:call-template name="strip-balanced">
+          <xsl:with-param name="name" select="substring-after($name, $open)"/>
+          <xsl:with-param name="open" select="$open"/>
+          <xsl:with-param name="close" select="$close"/>
+          <xsl:with-param name="depth" select="$depth + 1"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($name, $close) and ($depth > 1)">
+        <xsl:call-template name="strip-balanced">
+          <xsl:with-param name="name" select="substring-after($name, $close)"/>
+          <xsl:with-param name="open" select="$open"/>
+          <xsl:with-param name="close" select="$close"/>
+          <xsl:with-param name="depth" select="$depth - 1"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="substring-after($name, $close)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="strip-qualifiers-template">
+    <xsl:param name="name"/>
+    <xsl:choose>
+      <xsl:when test="contains($name, '::')
+                and not(contains(substring-before($name, '::'), '<'))">
+        <xsl:call-template name="strip-qualifiers-template">
+          <xsl:with-param name="name" select="substring-after($name, '::')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="rest">
+          <xsl:call-template name="strip-balanced">
+            <xsl:with-param name="name" select="$name"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:choose>
+          <xsl:when test="$rest != ''">
+            <xsl:call-template name="strip-qualifiers-template">
+              <xsl:with-param name="name" select="$rest"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$name"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Strip the qualifiers off a qualified name and return the unqualified
+       name. For instance, "boost::python::function" would become just
+       "function".
+       Must handle ns::foo                    -> foo 
+       Must handle ns::foo<bar::baz>          -> foo<bar::baz> 
+       Must handle ns::foo<bar::baz>::nested  -> nested  
+       Must handle ns::foo<x>::bar<y>         -> bar<y> -->
+  <xsl:template name="strip-qualifiers">
+    <xsl:param name="name"/>
+    <xsl:choose>
+      <xsl:when test="substring($name, string-length($name)) = '>'">
+        <xsl:call-template name="strip-qualifiers-template">
+          <xsl:with-param name="name" select="$name"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="strip-qualifiers-non-template">
+          <xsl:with-param name="name" select="$name"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Build the fully-qualified name of the given node -->
+  <xsl:template name="fully-qualified-name">
+    <xsl:param name="node"/>
+    <xsl:param name="separator" select="'::'"/>
+    <xsl:apply-templates select="$node" mode="fully-qualified-name">
+      <xsl:with-param name="separator" select="$separator"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <!-- Hack to make the node we are building the current node so that the
+       ancestor:: syntax will work -->
+  <xsl:template match="*" mode="fully-qualified-name">
+    <xsl:param name="separator" select="'::'"/>
+    <xsl:call-template name="build-fully-qualified-name">
+      <xsl:with-param name="separator" select="$separator"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- The real routine that builds a fully-qualified name for the current
+       node. -->
+  <xsl:template name="build-fully-qualified-name">
+    <xsl:param name="separator" select="'::'"/>
+
+    <!-- The depth of qualified name element that we will print now-->
+    <xsl:param name="depth" select="1"/>
+
+    <!-- Determine the set of ancestor namespaces -->
+    <xsl:variable name="ancestors" 
+      select="ancestor::namespace|
+                  ancestor::class|ancestor::struct|ancestor::union|
+                  ancestor::class-specialization|ancestor::struct-specialization|ancestor::union-specialization"/>
+
+    <xsl:choose>
+      <xsl:when test="$depth > count($ancestors)">
+        <xsl:apply-templates select="." mode="print-name"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:if test="name($ancestors[$depth])='namespace' or
+                      count(ancestor::free-function-group)=0">
+          <xsl:apply-templates select="$ancestors[$depth]" mode="print-name"/>
+          <xsl:value-of select="$separator"/>
+        </xsl:if>
+        <xsl:call-template name="build-fully-qualified-name">
+          <xsl:with-param name="separator" select="$separator"/>
+          <xsl:with-param name="depth" select="$depth + 1"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Print the name of the current node -->
+  <xsl:template match="*" mode="print-name">
+    <xsl:value-of select="@name"/>
+  </xsl:template>
+
+  <xsl:template name="print-specialization-name">
+    <xsl:value-of select="@name"/>
+    <xsl:text><</xsl:text>
+    <xsl:value-of select="specialization/template-arg[position() = 1]/text()"/>
+    <xsl:for-each select="specialization/template-arg[position() > 1]">
+      <xsl:text>,</xsl:text>
+      <xsl:value-of select="text()"/>
+    </xsl:for-each>
+    <xsl:text>></xsl:text>
+  </xsl:template>
+
+  <xsl:template match="struct-specialization" mode="print-name">
+    <xsl:call-template name="print-specialization-name"/>
+  </xsl:template>
+
+  <xsl:template match="class-specialization" mode="print-name">
+    <xsl:call-template name="print-specialization-name"/>
+  </xsl:template>
+
+  <xsl:template match="union-specialization" mode="print-name">
+    <xsl:call-template name="print-specialization-name"/>
+  </xsl:template>
+
+  <xsl:template name="name-matches-node">
+    <!-- The name we are looking for -->
+    <xsl:param name="name"/>
+
+    <!-- The name to display -->
+    <xsl:param name="display-name" select="$name"/>
+
+    <!-- The context in which this name occurs -->
+    <xsl:param name="context"/>
+
+    <!-- The node that we are checking against -->
+    <xsl:param name="node"/>
+
+    <!-- The mode we are in. Can be one of:
+           matches: emits the matches as they are found (for debugging)
+           link: link to the node that was found
+         -->
+    <xsl:param name="mode" select="'matches'"/>
+
+    <!-- The index into the list of using directives for the context node -->
+    <xsl:param name="index" select="1"/>
+
+    <!-- The prefix we should append to the name when checking this node -->
+    <xsl:param name="prefix" select="''"/>
+
+    <xsl:choose>
+      <xsl:when test="count($node) > 1">
+        <xsl:variable name="matches">
+          <xsl:call-template name="count-matches">
+            <xsl:with-param name="name" select="$name"/>
+            <xsl:with-param name="context" select="$context"/>
+            <xsl:with-param name="nodes" select="$node[position() = 1]"/>
+          </xsl:call-template>
+        </xsl:variable>
+
+        <xsl:choose>
+          <xsl:when test="$matches = 0">
+            <xsl:call-template name="name-matches-node">
+              <xsl:with-param name="name" select="$name"/>
+              <xsl:with-param name="display-name" select="$display-name"/>
+              <xsl:with-param name="context" select="$context"/>
+              <xsl:with-param name="node" select="$node[position() > 1]"/>
+              <xsl:with-param name="mode" select="$mode"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="name-matches-node">
+              <xsl:with-param name="name" select="$name"/>
+              <xsl:with-param name="display-name" select="$display-name"/>
+              <xsl:with-param name="context" select="$context"/>
+              <xsl:with-param name="node" select="$node[position() = 1]"/>
+              <xsl:with-param name="mode" select="$mode"/>
+            </xsl:call-template>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="count($node) = 1">
+        <!-- The fully-qualified name of the node we are checking against -->
+        <xsl:variable name="fully-qualified-name">
+          <xsl:call-template name="fully-qualified-name">
+            <xsl:with-param name="node" select="$node"/>
+          </xsl:call-template>
+        </xsl:variable>
+
+        <!-- The set of using directives for this context node -->
+        <xsl:variable name="directives"
+          select="$context/ancestor::*/using-namespace |
+                  $context/ancestor::namespace |
+                  $context/ancestor::*/using-class |
+                  $context/ancestor::class |
+                  $context/ancestor::struct"/>
+        
+        <!-- The name of the current directive -->
+        <xsl:variable name="this-context">
+          <xsl:apply-templates select="$directives[$index]" mode="print-name"/>
+        </xsl:variable>
+        
+        <!-- Check if we have a match -->
+        <xsl:variable name="have-match" 
+          select="$fully-qualified-name = concat($prefix, $name)"/>
+        
+        <xsl:if test="$have-match">
+          <xsl:choose>
+            <xsl:when test="$mode='matches'">
+              Match in namespace ::<xsl:value-of select="$prefix"/>
+            </xsl:when>
+            <xsl:when test="$mode='link'">
+              <xsl:call-template name="internal-link">
+                <xsl:with-param name="to">
+                  <xsl:call-template name="generate.id">
+                    <xsl:with-param name="node" select="$node"/>
+                  </xsl:call-template>
+                </xsl:with-param>
+                <xsl:with-param name="text" select="$display-name"/>
+              </xsl:call-template>
+            </xsl:when>
+          </xsl:choose>
+        </xsl:if>
+        
+        <xsl:if test="(not($index > count($directives))) and
+                      (not($have-match) or ($mode = 'matches'))">
+          <xsl:variable name="first-branch">
+            <xsl:if test="not ($prefix = '')">
+              <!-- Recurse and append the current context node to the prefix -->
+              <xsl:call-template name="name-matches-node">
+                <xsl:with-param name="name" select="$name"/>
+                <xsl:with-param name="display-name" select="$display-name"/>
+                <xsl:with-param name="context" select="$context"/>
+                <xsl:with-param name="node" select="$node"/>
+                <xsl:with-param name="mode" select="$mode"/>
+                <xsl:with-param name="index" select="$index + 1"/>
+                <xsl:with-param name="prefix"
+                  select="concat($prefix, $this-context, '::')"/>
+              </xsl:call-template>
+            </xsl:if>
+          </xsl:variable>
+          
+          <xsl:choose>
+            <xsl:when test="string($first-branch) != ''">
+              <xsl:copy-of select="$first-branch"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <!-- Recurse with just the current context node -->
+              <xsl:call-template name="name-matches-node">
+                <xsl:with-param name="name" select="$name"/>
+                <xsl:with-param name="display-name" select="$display-name"/>
+                <xsl:with-param name="context" select="$context"/>
+                <xsl:with-param name="node" select="$node"/>
+                <xsl:with-param name="mode" select="$mode"/>
+                <xsl:with-param name="index" select="$index + 1"/>
+                <xsl:with-param name="prefix" 
+                  select="concat($this-context, '::')"/>
+              </xsl:call-template>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:if>        
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Count the number of nodes in the set that match the given name and
+       lookup context -->
+  <xsl:template name="count-matches">
+    <xsl:param name="name"/>
+    <xsl:param name="context"/>
+    <xsl:param name="nodes"/>
+
+    <xsl:variable name="match-string">
+      <xsl:for-each select="$nodes">
+        <xsl:variable name="does-match">
+          <xsl:call-template name="name-matches-node">
+            <xsl:with-param name="name" select="$name"/>
+            <xsl:with-param name="context" select="$context"/>
+            <xsl:with-param name="node" select="."/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:if test="not($does-match='')">X</xsl:if>
+      </xsl:for-each>
+    </xsl:variable>
+    <xsl:value-of select="string-length($match-string)"/>
+  </xsl:template>
+
+  <xsl:template name="cxx-link-name">
+    <!-- The actual lookup node -->
+    <xsl:param name="lookup"/> 
+
+    <!-- The type of name to lookup (e.g., class) -->
+    <xsl:param name="type"/> 
+
+    <!-- The name we are looking for -->
+    <xsl:param name="name"/> 
+
+    <!-- The name we will display  -->
+    <xsl:param name="display-name"/>
+
+    <!-- The name we are looking for (unqualified)-->
+    <xsl:param name="unqualified-name"/> 
+
+    <!-- The list of nodes that match the lookup node in both name and type -->
+    <xsl:param name="nodes"/>
+
+    <!-- Count the number of nodes that match -->
+    <xsl:variable name="matches">
+      <xsl:call-template name="count-matches">
+        <xsl:with-param name="name" select="$name"/>
+        <xsl:with-param name="context" select="$lookup"/>
+        <xsl:with-param name="nodes" select="$nodes"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="$matches = 0">
+        <xsl:message>
+          <xsl:text>Cannot find </xsl:text>
+          <xsl:value-of select="$type"/>
+          <xsl:text> named '</xsl:text>
+          <xsl:value-of select="$name"/>
+          <xsl:text>'</xsl:text>
+        </xsl:message>
+        <xsl:value-of select="$display-name"/>
+      </xsl:when>
+      <xsl:when test="$matches = 1">
+        <xsl:for-each select="$nodes">
+          <xsl:call-template name="name-matches-node">
+            <xsl:with-param name="name" select="$name"/>
+            <xsl:with-param name="display-name" select="$display-name"/>
+            <xsl:with-param name="context" select="$lookup"/>
+            <xsl:with-param name="node" select="."/>
+            <xsl:with-param name="mode" select="'link'"/>
+          </xsl:call-template>
+        </xsl:for-each>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:message>
+          <xsl:text>Reference to </xsl:text>
+          <xsl:value-of select="$type"/>
+          <xsl:text> '</xsl:text>
+          <xsl:value-of select="$name"/>
+          <xsl:text>' is ambiguous. Found:</xsl:text>
+          <xsl:for-each select="$nodes">
+            <xsl:call-template name="name-matches-node">
+              <xsl:with-param name="name" select="$name"/>
+              <xsl:with-param name="context" select="$lookup"/>
+              <xsl:with-param name="node" select="."/>
+              <xsl:with-param name="mode" select="'matches'"/>
+            </xsl:call-template>
+          </xsl:for-each>
+        </xsl:message>
+        <xsl:call-template name="name-matches-node">
+          <xsl:with-param name="name" select="$name"/>
+          <xsl:with-param name="display-name" select="$display-name"/>
+          <xsl:with-param name="context" select="$lookup"/>
+          <xsl:with-param name="node" select="$nodes"/>
+          <xsl:with-param name="mode" select="'link'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/macro.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/macro.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+  <xsl:template match="macro" mode="synopsis">
+    <xsl:param name="indentation" select="0"/>
+
+    <xsl:text>
</xsl:text>
+    <xsl:if 
+      test="not(local-name(preceding-sibling::*[position()=1])=local-name(.))">
+      <xsl:text>
</xsl:text>
+    </xsl:if>
+    <xsl:call-template name="indent">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:call-template>
+    <xsl:call-template name="macro-synopsis">
+      <xsl:with-param name="link-type" select="'link'"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="macro" mode="reference">
+    <xsl:call-template name="reference-documentation">
+      <xsl:with-param name="refname" select="@name"/>
+      <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
+      <xsl:with-param name="anchor">
+        <xsl:call-template name="generate.id"/>
+      </xsl:with-param>
+      <xsl:with-param name="name">
+        <xsl:text>Macro </xsl:text>
+        <xsl:call-template name="monospaced">
+          <xsl:with-param name="text" select="@name"/>
+        </xsl:call-template>
+      </xsl:with-param>
+      <xsl:with-param name="synopsis">
+        <xsl:call-template name="macro-synopsis">
+          <xsl:with-param name="link-type" select="'none'"/>
+        </xsl:call-template>
+      </xsl:with-param>
+      <xsl:with-param name="text">
+        <xsl:apply-templates select="description"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template name="macro-synopsis">
+    <xsl:param name="link-type"/>
+
+    <xsl:call-template name="link-or-anchor">
+      <xsl:with-param name="to">
+        <xsl:call-template name="generate.id" select="."/>
+      </xsl:with-param>
+      <xsl:with-param name="text" select="@name"/>
+      <xsl:with-param name="link-type" select="$link-type"/>
+    </xsl:call-template>
+
+    <xsl:if test="@kind='functionlike'">
+      <xsl:text>(</xsl:text>
+      <xsl:for-each select="macro-parameter">
+        <xsl:if test="position() > 1">
+          <xsl:text>, </xsl:text>
+        </xsl:if>
+        <xsl:value-of select="@name"/>
+      </xsl:for-each>
+      <xsl:text>)</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="macro" mode="generate.id">
+    <xsl:value-of select="@name"/>
+  </xsl:template>
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/manpages.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/manpages.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+  <!-- Import the man pages stylesheet -->
+  <xsl:import 
+    href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"/>
+
+  <xsl:param name="generate.manifest" select="1"/>
+  <xsl:param name="manifest">man.manifest</xsl:param>
+
+  <xsl:template match="literallayout">
+    <xsl:text>
.nf
</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>
.fi
</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="para|simpara|remark" mode="list">
+    <xsl:variable name="foo">
+      <xsl:apply-templates/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="literallayout">
+        <xsl:copy-of select="$foo"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="normalize-space($foo)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text>
</xsl:text>
+    <xsl:if test="following-sibling::para or following-sibling::simpara or
+                  following-sibling::remark">
+      <!-- Make sure multiple paragraphs within a list item don't -->
+      <!-- merge together.                                        -->
+      <xsl:text>
</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="build.refentry.filename">
+    <xsl:param name="node" select="."/>
+    <xsl:variable name="section" select="$node/refmeta/manvolnum"/>
+    <xsl:variable name="name" select="$node/refnamediv/refname[1]"/>
+    <xsl:value-of select="concat('man', $section, '/', 
+                                 translate(normalize-space($name), 
+				           '<>', '__'), 
+                                 '.', $section)"/>
+				     
+  </xsl:template>
+
+  <xsl:template match="refentry" mode="manifest">
+    <xsl:call-template name="build.refentry.filename"/>
+    <xsl:text>
</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="/">
+    <xsl:choose>
+      <xsl:when test="//refentry">
+        <xsl:apply-templates select="//refentry"/>
+        <xsl:if test="$generate.manifest=1">
+          <xsl:call-template name="write.text.chunk">
+            <xsl:with-param name="filename" select="$manifest"/>
+            <xsl:with-param name="content">
+              <xsl:value-of select="$manifest"/>
+              <xsl:text>
</xsl:text>
+              <xsl:apply-templates select="//refentry" mode="manifest"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:message>No refentry elements!</xsl:message>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+<xsl:template match="refentry">
+  <xsl:variable name="section" select="refmeta/manvolnum"/>
+  <xsl:variable name="name" select="refnamediv/refname[1]"/>
+
+  <!-- standard man page width is 64 chars; 6 chars needed for the two
+       (x) volume numbers, and 2 spaces, leaves 56 -->
+  <xsl:variable name="twidth" select="(56 - string-length(refmeta/refentrytitle)) div 2"/>
+
+  <xsl:variable name="reftitle" 
+		select="substring(refmeta/refentrytitle, 1, $twidth)"/>
+
+  <xsl:variable name="title">
+    <xsl:choose>
+      <xsl:when test="refentryinfo/title">
+        <xsl:value-of select="refentryinfo/title"/>
+      </xsl:when>
+      <xsl:when test="../referenceinfo/title">
+        <xsl:value-of select="../referenceinfo/title"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="date">
+    <xsl:choose>
+      <xsl:when test="refentryinfo/date">
+        <xsl:value-of select="refentryinfo/date"/>
+      </xsl:when>
+      <xsl:when test="../referenceinfo/date">
+        <xsl:value-of select="../referenceinfo/date"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="productname">
+    <xsl:choose>
+      <xsl:when test="refentryinfo/productname">
+        <xsl:value-of select="refentryinfo/productname"/>
+      </xsl:when>
+      <xsl:when test="../referenceinfo/productname">
+        <xsl:value-of select="../referenceinfo/productname"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:call-template name="write.text.chunk">
+    <xsl:with-param name="filename">
+      <xsl:call-template name="build.refentry.filename"/>
+    </xsl:with-param>
+    <xsl:with-param name="content">
+      <xsl:text>.\"Generated by db2man.xsl. Don't modify this, modify the source.
+.de Sh \" Subsection
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Ip \" List item
+.br
+.ie \\n(.$>=3 .ne \\$3
+.el .ne 3
+.IP "\\$1" \\$2
+..
+.TH "</xsl:text>
+      <xsl:value-of select="translate($reftitle,'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+      <xsl:text>" </xsl:text>
+      <xsl:value-of select="refmeta/manvolnum[1]"/>
+      <xsl:text> "</xsl:text>
+      <xsl:value-of select="normalize-space($date)"/>
+      <xsl:text>" "</xsl:text>
+      <xsl:value-of select="normalize-space($productname)"/>
+      <xsl:text>" "</xsl:text>
+      <xsl:value-of select="$title"/>
+      <xsl:text>"
+</xsl:text>
+      <xsl:apply-templates/>
+      <xsl:text>
</xsl:text>
+
+      <!-- Author section -->
+      <xsl:choose>
+        <xsl:when test="refentryinfo//author">
+          <xsl:apply-templates select="refentryinfo" mode="authorsect"/>
+        </xsl:when>
+        <xsl:when test="/book/bookinfo//author">
+          <xsl:apply-templates select="/book/bookinfo" mode="authorsect"/>
+        </xsl:when>
+        <xsl:when test="/article/articleinfo//author">
+          <xsl:apply-templates select="/article/articleinfo" mode="authorsect"/>
+        </xsl:when>
+      </xsl:choose>
+
+    </xsl:with-param>
+  </xsl:call-template>
+  <!-- Now generate stub include pages for every page documented in
+       this refentry (except the page itself) -->
+  <xsl:for-each select="refnamediv/refname">
+    <xsl:if test=". != $name">
+      <xsl:call-template name="write.text.chunk">
+	<xsl:with-param name="filename"
+		        select="concat(normalize-space(.), '.', $section)"/>
+	<xsl:with-param name="content" select="concat('.so man',
+	      $section, '/', $name, '.', $section, '
')"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/navbar.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/navbar.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,373 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+<xsl:import href="relative-href.xsl"/>
+
+   <!--
+      how to render the Home | Libraries | ... | More contents
+         none       - do not display ("standalone" mode)
+        *horizontal - display in old-Boost style format
+         vertical   - like the new Getting Started layout
+   -->
+   <xsl:param name = "nav.layout" select = "'horizontal'"/>
+
+   <!--
+      header border layout
+         Boost - place the old-Boost border around the header
+        *none  - do not place a border around the header
+   -->
+
+   <xsl:param name = "nav.border" select = "'none'" />
+   <!--
+      nav.flow:
+         none    - do not display navigation at the header
+         DocBook - display the navigation after the header
+        *Spirit  - display "mini" navigation on the right
+   -->
+   <xsl:param name = "nav.flow" select = "'Spirit'"/>
+
+   <!-- location of the various Boost elements for the textlinks page style -->
+
+   <xsl:param name = "boost.root"      select = "'../..'"/>
+   <xsl:param name = "boost.image.src" 
+              select = "concat($boost.root, '/boost.png')"/>
+   <xsl:param name = "boost.image.alt" select = "'Boost C++ Libraries'"/>
+   <xsl:param name = "boost.image.w"   select = "277"/>
+   <xsl:param name = "boost.image.h"   select = "86"/>
+   <xsl:param name = "boost.libraries" select = "'libraries.html'"/>
+
+   <!--
+      boost.navbar template
+
+      Effects:
+         Insert the user selected navbar
+   -->
+
+   <xsl:template name = "boost.navbar">
+      <xsl:param name = "prev" select = "/foo"/>
+      <xsl:param name = "next" select = "/foo"/>
+      <xsl:param name = "nav.context"/>
+      <xsl:choose>
+         <xsl:when test = "$nav.flow = 'DocBook'">
+            <table width = "100%" class = "navheader">
+               <xsl:call-template name = "navbar.docbook-homeinfo">
+                  <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 = "navbar.docbook-prevnext">
+                  <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>
+            </table>
+         </xsl:when>
+         <xsl:when test = "$nav.flow = 'Spirit'">
+            <xsl:call-template name = "navbar.spirit">
+               <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:when>
+      </xsl:choose>
+   </xsl:template>
+
+   <!-- navbar -->
+
+   <xsl:template name = "navbar.docbook-homeinfo">
+      <xsl:param name = "prev" select = "/foo"/>
+      <xsl:param name = "next" select = "/foo"/>
+      <xsl:param name = "nav.context"/>
+
+      <xsl:variable name = "home" select = "/*[1]"/>
+      <tr>
+         <td align = "left" width = "40%">
+            <xsl:if test = "$navig.showtitles != 0"> <!-- prev:name -->
+               <xsl:apply-templates select = "$prev" mode = "object.title.markup"/>
+            </xsl:if>
+         </td><td align = "center" width = "20%">
+            <!-- home -->
+            <xsl:if 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>|</xsl:text>
+               </xsl:if>
+            </xsl:if>
+            <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'"><a accesskey = "t">
+               <xsl:attribute name = "href">
+                  <xsl:apply-templates select = "/*[1]" mode = "recursive-chunk-filename"/>
+                  <xsl:text>-toc</xsl:text>
+                  <xsl:value-of select = "$html.ext"/>
+               </xsl:attribute>
+               <xsl:call-template name = "gentext">
+                  <xsl:with-param name = "key" select = "'nav-toc'"/>
+               </xsl:call-template>
+            </a></xsl:if>
+         </td><td align = "right" width = "40%">
+            <xsl:if test = "$navig.showtitles != 0"> <!-- next:name -->
+               <xsl:apply-templates select = "$next" mode = "object.title.markup"/>
+            </xsl:if>
+         </td>
+      </tr>
+   </xsl:template>
+
+   <xsl:template name = "navbar.docbook-prevnext">
+      <xsl:param name = "prev" select = "/foo"/>
+      <xsl:param name = "next" select = "/foo"/>
+      <xsl:param name = "nav.context"/>
+
+      <xsl:variable name = "up" select = "parent::*"/>
+      <tr>
+         <td align = "left" width = "40%">
+            <xsl:if test = "count($prev)>0"><a accesskey = "p"> <!-- prev -->
+               <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>
+         </td><td align = "center" width = "20%">
+            <xsl:if test = "count($up)>0"><a accesskey = "u"> <!-- up -->
+               <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:if>
+         </td><td align = "right" width = "40%">
+            <xsl:if test = "count($next)>0"><a accesskey = "n"> <!-- next -->
+               <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:template>
+
+   <xsl:template name = "navbar.spirit">
+      <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::*"/>
+
+      <div class = "spirit-nav">
+         <!-- prev -->
+         <xsl:if test = "count($prev)>0"><a accesskey = "p">
+            <xsl:attribute name = "href"><xsl:call-template name = "href.target">
+               <xsl:with-param name = "object" select = "$prev"/>
+            </xsl:call-template></xsl:attribute>
+            <xsl:call-template name = "navig.content">
+               <xsl:with-param name = "direction" select = "'prev'"/>
+            </xsl:call-template>
+         </a></xsl:if>
+         <!-- up -->
+         <xsl:if test = "count($up)>0"><a accesskey = "u">
+            <xsl:attribute name = "href"><xsl:call-template name = "href.target">
+               <xsl:with-param name = "object" select = "$up"/>
+            </xsl:call-template></xsl:attribute>
+            <xsl:call-template name = "navig.content">
+               <xsl:with-param name = "direction" select = "'up'"/>
+            </xsl:call-template>
+         </a></xsl:if>
+         <!-- home -->
+         <xsl:if 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>|</xsl:text>
+            </xsl:if>
+         </xsl:if>
+         <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'"><a accesskey = "t">
+            <xsl:attribute name = "href">
+               <xsl:apply-templates select = "/*[1]" mode = "recursive-chunk-filename"/>
+               <xsl:text>-toc</xsl:text>
+               <xsl:value-of select = "$html.ext"/>
+            </xsl:attribute>
+            <xsl:call-template name = "gentext">
+               <xsl:with-param name = "key" select = "'nav-toc'"/>
+            </xsl:call-template>
+         </a></xsl:if>
+         <!-- next -->
+         <xsl:if test = "count($next)>0"><a accesskey = "n">
+            <xsl:attribute name = "href"><xsl:call-template name = "href.target">
+               <xsl:with-param name = "object" select = "$next"/>
+            </xsl:call-template></xsl:attribute>
+            <xsl:call-template name = "navig.content">
+               <xsl:with-param name = "direction" select = "'next'"/>
+            </xsl:call-template>
+         </a></xsl:if>
+      </div>
+   </xsl:template>
+
+   <!-- Old style header navigation -->
+
+   <xsl:template name = "header.textlinks">
+      <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::*"/>
+
+      <table cellpadding = "2" width = "100%">
+         <xsl:if test = "$nav.border = 'Boost'">
+            <xsl:attribute name = "class">boost-head</xsl:attribute>
+         </xsl:if>
+
+         <td valign = "top">
+            <xsl:if test = "$nav.border = 'Boost'">
+               <xsl:attribute name = "style">background-color: white; width: 50%;</xsl:attribute>
+            </xsl:if>
+            <img alt="{$boost.image.alt}" width="{$boost.image.w}" height="{$boost.image.h}">
+                <xsl:attribute name="src">
+                    <xsl:call-template name="href.target.relative">
+                        <xsl:with-param name="target" select="$boost.image.src"/>
+                    </xsl:call-template>
+                </xsl:attribute>
+            </img>
+         </td><xsl:choose>
+            <xsl:when test = "$nav.layout = 'horizontal'">
+               <xsl:call-template name = "header.navdata-horiz"/>
+            </xsl:when><xsl:when test = "$nav.layout = 'vertical'">
+               <xsl:call-template name = "header.navdata-vert"/>
+            </xsl:when>
+         </xsl:choose>
+      </table>
+      <hr/>
+      <xsl:choose>
+         <xsl:when test = "$nav.flow = 'DocBook'">
+            <table width = "100%" class = "navheader">
+               <xsl:call-template name = "navbar.docbook-homeinfo">
+                  <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 = "navbar.docbook-prevnext">
+                  <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>
+            </table>
+         </xsl:when><xsl:when test = "$nav.flow = 'Spirit'">
+            <xsl:call-template name = "navbar.spirit">
+               <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:when>
+      </xsl:choose>
+   </xsl:template>
+
+   <xsl:template name = "header.navdata-horiz">
+      <xsl:variable name="home_link">
+         <xsl:call-template name="href.target.relative">
+            <xsl:with-param name="target" select="concat( $boost.root, '/index.htm' )"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:variable name="libraries_link">
+         <xsl:call-template name="href.target.relative">
+            <xsl:with-param name="target" select="$boost.libraries"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:variable name="people_link">
+         <xsl:call-template name="href.target.relative">
+            <xsl:with-param name="target" select="concat( $boost.root, '/people/people.htm' )"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:variable name="faq_link">
+         <xsl:call-template name="href.target.relative">
+            <xsl:with-param name="target" select="concat( $boost.root, '/more/faq.htm' )"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:variable name="more_link">
+         <xsl:call-template name="href.target.relative">
+            <xsl:with-param name="target" select="concat( $boost.root, '/more/index.htm' )"/>
+         </xsl:call-template>
+      </xsl:variable>
+      
+      <xsl:choose>
+         <xsl:when test = "$nav.border = 'Boost'">
+            <td align = "center" class = "boost-headtd"><a href = "{$home_link}" class = "boost-headelem">Home</a></td>
+            <td align = "center" class = "boost-headtd"><a href = "{$libraries_link}" class = "boost-headelem">Libraries</a></td>
+            <td align = "center" class = "boost-headtd"><a href = "{$people_link}" class = "boost-headelem">People</a></td>
+            <td align = "center" class = "boost-headtd"><a href = "{$faq_link}" class = "boost-headelem">FAQ</a></td>
+            <td align = "center" class = "boost-headtd"><a href = "{$more_link}" class = "boost-headelem">More</a></td>
+         </xsl:when><xsl:otherwise>
+            <td align = "center"><a href = "{$home_link}">Home</a></td>
+            <td align = "center"><a href = "{$libraries_link}">Libraries</a></td>
+            <td align = "center"><a href = "{$people_link}">People</a></td>
+            <td align = "center"><a href = "{$faq_link}">FAQ</a></td>
+            <td align = "center"><a href = "{$more_link}">More</a></td>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
+   <xsl:template name = "header.navdata-vert">
+      <xsl:variable name="home_link">
+         <xsl:call-template name="href.target.relative">
+            <xsl:with-param name="target" select="concat( $boost.root, '/index.htm' )"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:variable name="libraries_link">
+         <xsl:call-template name="href.target.relative">
+            <xsl:with-param name="target" select="$boost.libraries"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:variable name="people_link">
+         <xsl:call-template name="href.target.relative">
+            <xsl:with-param name="target" select="concat( $boost.root, '/people/people.htm' )"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:variable name="faq_link">
+         <xsl:call-template name="href.target.relative">
+            <xsl:with-param name="target" select="concat( $boost.root, '/more/faq.htm' )"/>
+         </xsl:call-template>
+      </xsl:variable>
+      <xsl:variable name="more_link">
+         <xsl:call-template name="href.target.relative">
+            <xsl:with-param name="target" select="concat( $boost.root, '/more/index.htm' )"/>
+         </xsl:call-template>
+      </xsl:variable>
+
+      <td><div>
+         <xsl:if test = "$nav.border != 'Boost'">
+            <xsl:attribute name = "class">boost-toc</xsl:attribute>
+         </xsl:if>
+         <div><a href = "{$home_link}">Home</a></div>
+         <div><a href = "{$libraries_link}">Libraries</a></div>
+         <div><a href = "{$people_link}">People</a></div>
+         <div><a href = "{$faq_link}">FAQ</a></div>
+         <div><a href = "{$more_link}">More</a></div>
+      </div></td>
+   </xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file
Added: sandbox/doc_test/xsl_test/reference.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/reference.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+  <xsl:include href="annotation.xsl"/>
+  <xsl:include href="template.xsl"/>
+  <xsl:include href="function.xsl"/>
+  <xsl:include href="type.xsl"/>
+  <xsl:include href="source-highlight.xsl"/>
+  <xsl:include href="utility.xsl"/>
+  <xsl:include href="lookup.xsl"/>
+  <xsl:include href="library.xsl"/>
+  <xsl:include href="index.xsl"/>
+  <xsl:include href="error.xsl"/>
+  <xsl:include href="macro.xsl"/>
+  <xsl:include href="testing/testsuite.xsl"/>
+  <xsl:include href="caramel/concept2docbook.xsl"/>
+  
+  <xsl:template name="namespace-synopsis">
+    <xsl:param name="indentation" select="0"/>
+    <!-- Open namespace-->
+    <xsl:call-template name="indent">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:call-template>
+    <xsl:call-template name="source-highlight">
+      <xsl:with-param name="text" select="concat('namespace ',@name)"/>
+    </xsl:call-template>
+    <xsl:text> {</xsl:text>
+    
+    <!-- Emit namespace types -->
+    <xsl:apply-templates select="class|class-specialization|
+                                 struct|struct-specialization|
+                                 union|union-specialization|
+                                 typedef|enum|data-member" mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation + 2"/>
+    </xsl:apply-templates>
+    
+    <!-- Emit namespace functions -->
+    <xsl:apply-templates 
+      select="free-function-group|function|overloaded-function" 
+      mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation + 2"/>
+    </xsl:apply-templates>
+    
+    <!-- Emit namespaces -->
+    <xsl:apply-templates select="namespace" mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation + 2"/>
+    </xsl:apply-templates>
+    
+    <!-- Close namespace -->
+    <xsl:text>
</xsl:text>
+    <xsl:call-template name="indent">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:call-template>
+    <xsl:text>}</xsl:text>
+  </xsl:template>
+
+  <!-- Emit namespace synopsis -->
+  <xsl:template match="namespace" mode="synopsis">
+    <xsl:param name="indentation" select="0"/>
+
+    <xsl:choose>
+      <xsl:when test="count(ancestor::namespace)=0">
+        <xsl:call-template name="namespace-synopsis">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>
</xsl:text>
+        <xsl:call-template name="namespace-synopsis">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Emit namespace reference -->
+  <xsl:template match="namespace" mode="reference">
+    <xsl:apply-templates select="namespace|typedef|free-function-group"
+      mode="reference">
+      <xsl:with-param name="indentation" select="0"/>
+    </xsl:apply-templates>
+    <xsl:apply-templates select="class|class-specialization|
+                                 struct|struct-specialization|
+                                 union|union-specialization|enum|function|
+                                 overloaded-function|data-member" 
+      mode="namespace-reference"/>
+  </xsl:template>
+
+  <!-- Eat extra documentation when in the synopsis or reference sections -->
+  <xsl:template match="para|section" mode="synopsis"/>
+  <xsl:template match="para|section" mode="reference"/>
+
+  <!-- Comment mode tries to wipe out any extra spacing in the output -->
+  <xsl:template match="purpose" mode="comment">
+    <xsl:apply-templates mode="comment"/>
+  </xsl:template>
+
+  <xsl:template match="simpara|para" mode="comment">
+    <xsl:apply-templates select="text()|*" mode="comment"/>
+  </xsl:template>
+
+  <xsl:template match="text()" mode="comment">
+    <xsl:value-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="*" mode="comment">
+    <xsl:apply-templates select="." mode="annotation"/>
+  </xsl:template>
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/relative-href.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/relative-href.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,98 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/lib/lib.xsl"/>
+
+<!-- ==================================================================== -->
+
+<!-- Check if path is absolute
+
+    Not attempting to fully parse or validate absolute vs. relative URI.
+    Assumes an absolute url when $target matches the regex '^[a-zA-Z.+-]*:'
+
+    According to RFC1808, however, the colon (':') may also appear in a relative
+    URL. To workaround this limitation for relative links containing colons one
+    may use the alternatives below, instead.
+
+    For the relative URI this:that use ./this:that or this%3Athat, instead.
+-->
+<xsl:template name="is.absolute.uri">
+    <xsl:param name="uri"/>
+
+    <xsl:variable name="scheme1" select="substring-before($uri, ':')"/>
+    <xsl:variable name="scheme2" select="translate($scheme1, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.', '')"/>
+
+    <xsl:choose>
+        <xsl:when test="$scheme1 and not($scheme2)">1</xsl:when>
+        <xsl:otherwise>0</xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="href.target.relative">
+    <xsl:param name="target"/>
+    <xsl:param name="context" select="."/>
+
+    <xsl:variable name="isabsoluteuri">
+        <xsl:call-template name="is.absolute.uri">
+            <xsl:with-param name="uri" select="$target"/>
+        </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:choose>
+        <xsl:when test="$isabsoluteuri='1'">
+            <xsl:value-of select="$target"/>
+        </xsl:when>
+
+        <xsl:otherwise>
+            <xsl:variable name="href.to.uri" select="$target"/>
+            <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: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:value-of select="$href"/>
+        </xsl:otherwise>
+    </xsl:choose>
+
+</xsl:template>
+
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/source-highlight.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/source-highlight.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+  <xsl:param name="boost.syntax.highlight">1</xsl:param>
+
+  <xsl:template name="source-highlight">
+    <xsl:param name="text" select="."/>
+    <xsl:choose>
+      <xsl:when test="$boost.syntax.highlight='1'">
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="$text"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$text"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Perform C++ keyword highlighting on the given text -->
+  <xsl:template name="highlight-text">
+    <xsl:param name="text" select="."/>
+    <xsl:param name="keywords"
+      select="'asm auto bool break case catch char class const const_cast continue default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new operator private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while'"/>
+    <xsl:param name="best-match" select="''"/>
+    
+    <!-- Determine the current keyword -->
+    <xsl:variable name="keyword">
+      <xsl:choose>
+        <xsl:when test="contains($keywords, ' ')">
+          <xsl:value-of select="substring-before($keywords, ' ')"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$keywords"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- Determine the set of keywords that are left -->
+    <xsl:variable name="keywords-left">
+      <xsl:if test="contains($keywords, ' ')">
+        <xsl:value-of select="substring-after($keywords, ' ')"/>
+      </xsl:if>
+    </xsl:variable>
+
+    <!-- The set of characters that can be identifiers -->
+    <xsl:variable name="id-chars" select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'"/>
+
+    <xsl:variable name="X" select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'"/>
+
+    <xsl:choose>
+      <!-- Have we exhausted all keywords without finding any to highlight? -->
+      <xsl:when test="$keyword='' and $best-match=''">
+        <!-- Just copy the text -->
+        <xsl:copy-of select="$text"/>
+      </xsl:when>
+
+      <!-- Have we exhausted all keywords, but have one to highlight? If so,
+           make sure we didn't just find part of an identifier. -->
+      <xsl:when 
+        test="$keyword='' and
+              not (starts-with(translate(substring-after($text, $best-match), 
+                                         $id-chars, $X), 'X')) and
+              not (substring(translate(substring-before($text, $best-match),
+                                       $id-chars, $X),
+                             string-length(substring-before($text, 
+                                                            $best-match)),
+                             1) = 'X')">
+        <!-- Copy text before this keyword -->
+        <xsl:value-of select="substring-before($text, $best-match)"/>
+
+        <!-- Highlight the keyword -->
+        <xsl:call-template name="highlight-keyword">
+          <xsl:with-param name="keyword" select="$best-match"/>
+        </xsl:call-template>
+
+        <!-- Recurse on the rest of the text -->
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" 
+            select="substring-after($text, $best-match)"/>
+        </xsl:call-template>
+      </xsl:when>
+
+      <!-- We thought we had a keyword to highlight, but it was part of an 
+           identifier. So output all of the text up to (but not including!)
+           the last letter of the identifier, and try again to
+           highlight. -->
+      <xsl:when test="$keyword=''">
+        <xsl:value-of select="substring-before($text, $best-match)"/>
+        <xsl:value-of 
+          select="substring($best-match, 1, string-length($best-match)-1)"/>
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text"
+            select="concat(substring($best-match, string-length($best-match), 
+                           1), substring-after($text, $best-match))"/>
+        </xsl:call-template>
+      </xsl:when>
+      
+      <!-- Does the text contain this keyword with a better match than we
+           previously had? -->
+      <xsl:when 
+        test="contains($text, $keyword) and
+              (($best-match = '') or 
+               (string-length(substring-before($text, $keyword)) <
+                string-length(substring-before($text, $best-match))))">
+        <!-- Recurse with the current keyword as the new best match -->
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="$text"/>
+          <xsl:with-param name="keywords" select="$keywords-left"/>
+          <xsl:with-param name="best-match" select="$keyword"/>
+        </xsl:call-template>
+      </xsl:when>
+
+      <!-- Text does not contain this keyword. Just recurse normally -->
+      <xsl:otherwise>
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="$text"/>
+          <xsl:with-param name="keywords" select="$keywords-left"/>
+          <xsl:with-param name="best-match" select="$best-match"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="*" mode="highlight">
+    <xsl:element name="{name(.)}">
+      <xsl:for-each select="./@*">
+        <xsl:choose>
+          <xsl:when test="local-name(.)='last-revision'">
+            <xsl:attribute
+              name="rev:last-revision"
+              namespace="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"
+>
+              <xsl:value-of select="."/>
+            </xsl:attribute>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:attribute name="{name(.)}">
+              <xsl:value-of select="."/>
+            </xsl:attribute>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:for-each>
+      <xsl:apply-templates mode="highlight"/>
+    </xsl:element>
+  </xsl:template>
+
+  <xsl:template match="text()" mode="highlight">
+    <xsl:call-template name="source-highlight">
+      <xsl:with-param name="text" select="."/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="classname|methodname|functionname|libraryname|enumname|
+                       conceptname|macroname" mode="highlight">
+    <xsl:apply-templates select="." mode="annotation"/>
+  </xsl:template>
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/template.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/template.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,443 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+  <!-- Determine the length of a template header synopsis -->
+  <xsl:template name="template.synopsis.length">
+    <xsl:variable name="text">
+      <xsl:apply-templates select="template" mode="synopsis">
+        <xsl:with-param name="indentation" select="0"/>
+        <xsl:with-param name="wrap" select="false()"/>
+        <xsl:with-param name="highlight" select="false()"/>
+      </xsl:apply-templates>
+    </xsl:variable>
+    <xsl:value-of select="string-length($text)"/>
+  </xsl:template>
+
+  <!-- Determine the length of a template header reference -->
+  <xsl:template name="template.reference.length">
+    <xsl:choose>
+      <xsl:when test="not(template)">
+        0
+      </xsl:when>
+      <xsl:when test="template/*/purpose">
+        <!-- TBD: The resulting value need only be greater than the number of
+             columns. We chose to add 17 because it's funny for C++
+             programmers. :) -->
+        <xsl:value-of select="$max-columns + 17"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="template.synopsis.length"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Output a template header in synopsis mode -->
+  <xsl:template match="template" mode="synopsis">
+    <xsl:param name="indentation" select="0"/>
+    <xsl:param name="wrap" select="true()"/>
+    <xsl:param name="highlight" select="true()"/>
+
+    <xsl:call-template name="template.synopsis"> 
+      <xsl:with-param name="indentation" select="$indentation"/>
+      <xsl:with-param name="wrap" select="$wrap"/>
+      <xsl:with-param name="highlight" select="$highlight"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- Output a template header in reference mode -->
+  <xsl:template match="template" mode="reference">
+    <xsl:param name="indentation" select="0"/>
+    <xsl:param name="highlight" select="true()"/>
+    <xsl:call-template name="template.reference">
+      <xsl:with-param name="indentation" select="$indentation"/>
+      <xsl:with-param name="highlight" select="$highlight"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- Emit a template header synopsis -->
+  <xsl:template name="template.synopsis">
+    <xsl:param name="indentation" select="0"/>
+    <xsl:param name="wrap" select="true()"/>
+    <xsl:param name="highlight" select="true()"/>
+
+    <xsl:choose>
+      <xsl:when test="$highlight">
+        <xsl:call-template name="highlight-keyword">
+          <xsl:with-param name="keyword" select="'template'"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>template</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text><</xsl:text>
+    <xsl:call-template name="template.synopsis.parameters">
+      <xsl:with-param name="indentation" select="$indentation + 9"/>
+      <xsl:with-param name="wrap" select="$wrap"/>
+      <xsl:with-param name="highlight" select="$highlight"/>
+    </xsl:call-template>
+    <xsl:text>> </xsl:text>
+  </xsl:template>
+
+  <!-- Display a list of template parameters for a synopsis (no comments) -->
+  <xsl:template name="template.synopsis.parameters">
+    <xsl:param name="indentation"/>
+    <xsl:param name="wrap" select="true()"/>
+    <xsl:param name="highlight" select="true()"/>
+
+    <xsl:param name="column" select="$indentation"/>
+    <xsl:param name="prefix" select="''"/>
+    <xsl:param name="parameters" select="template-type-parameter|template-varargs|template-nontype-parameter"/>
+    <xsl:param name="first-on-line" select="true()"/>
+
+    <xsl:if test="$parameters">
+      <!-- Emit the prefix (either a comma-space, or empty if this is
+           the first parameter) -->
+      <xsl:value-of select="$prefix"/>
+
+      <!-- Get the actual parameter and its attributes -->
+      <xsl:variable name="parameter" select="$parameters[position()=1]"/>
+      <xsl:variable name="rest" select="$parameters[position()!=1]"/>
+
+      <!-- Compute the actual text of this parameter -->
+      <xsl:variable name="text">
+        <xsl:call-template name="template.parameter">
+          <xsl:with-param name="parameter" select="$parameter"/>
+          <xsl:with-param name="is-last" select="not(rest)"/>
+          <xsl:with-param name="highlight" select="false()"/>
+        </xsl:call-template>
+      </xsl:variable>
+
+      <!-- Where will this template parameter finish? -->
+      <xsl:variable name="end-column" 
+        select="$column + string-length($prefix) + string-length($text)"/>
+
+      <!-- Should the text go on this line or on the next? -->
+      <xsl:choose>
+        <xsl:when test="$first-on-line or ($end-column < $max-columns) or
+                        not($wrap)">
+          <!-- Print on this line -->
+          <xsl:call-template name="template.parameter">
+            <xsl:with-param name="parameter" select="$parameter"/>
+            <xsl:with-param name="is-last" select="not($rest)"/>
+            <xsl:with-param name="highlight" select="$highlight"/>
+          </xsl:call-template>
+          
+          <!-- Recurse -->
+          <xsl:call-template name="template.synopsis.parameters">
+            <xsl:with-param name="indentation" select="$indentation"/>
+            <xsl:with-param name="wrap" select="$wrap"/>
+            <xsl:with-param name="highlight" select="$highlight"/>
+            <xsl:with-param name="column" select="$end-column"/>
+            <xsl:with-param name="prefix" select="', '"/>
+            <xsl:with-param name="parameters" select="$rest"/>
+            <xsl:with-param name="first-on-line" select="false()"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <!-- Print on next line -->
+          <xsl:text>
</xsl:text>
+          <xsl:call-template name="indent">
+            <xsl:with-param name="indentation" select="$indentation"/>
+          </xsl:call-template>
+          <xsl:call-template name="template.parameter">
+            <xsl:with-param name="parameter" select="$parameter"/>
+            <xsl:with-param name="is-last" select="not($rest)"/>
+            <xsl:with-param name="highlight" select="$highlight"/>
+          </xsl:call-template>
+
+          <xsl:call-template name="template.synopsis.parameters">
+            <xsl:with-param name="indentation" select="$indentation"/>
+            <xsl:with-param name="wrap" select="$wrap"/>
+            <xsl:with-param name="highlight" select="$highlight"/>
+            <xsl:with-param name="column" 
+              select="$indentation + string-length($text)"/>
+            <xsl:with-param name="prefix" select="', '"/>
+            <xsl:with-param name="parameters" select="$rest"/>
+            <xsl:with-param name="first-on-line" select="false()"/>           
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Emit a template header reference -->
+  <xsl:template name="template.reference">
+    <xsl:param name="indentation" select="0"/>
+    <xsl:param name="highlight" select="true()"/>
+
+    <xsl:if test="template-type-parameter|template-varargs|template-nontype-parameter">
+      <xsl:choose>
+        <xsl:when test="$highlight">
+          <xsl:call-template name="highlight-keyword">
+            <xsl:with-param name="keyword" select="'template'"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>template</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:text><</xsl:text>
+      <xsl:call-template name="template.reference.parameters">
+        <xsl:with-param name="indentation" select="$indentation + 9"/>
+        <xsl:with-param name="highlight" select="$highlight"/>
+      </xsl:call-template>
+      <xsl:text>> </xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Display a set of template parameters for a reference -->
+  <xsl:template name="template.reference.parameters">
+    <xsl:param name="indentation"/>
+    <xsl:param name="highlight" select="true()"/>
+    <xsl:param name="parameters" select="template-type-parameter|template-varargs|template-nontype-parameter"/>
+
+    <xsl:choose>
+      <xsl:when test="$parameters/purpose">
+        <xsl:call-template name="template.reference.parameters.comments">
+          <xsl:with-param name="indentation" select="$indentation"/>
+          <xsl:with-param name="highlight" select="$highlight"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="template.synopsis.parameters">
+          <xsl:with-param name="indentation" select="$indentation"/>
+          <xsl:with-param name="wrap" select="true()"/>
+          <xsl:with-param name="highlight" select="$highlight"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Output template parameters when there are comments with the parameters.
+       For clarity, we output each template parameter on a separate line. -->
+  <xsl:template name="template.reference.parameters.comments">
+    <xsl:param name="indentation"/>
+    <xsl:param name="highlight" select="true()"/>
+    <xsl:param name="parameters" select="template-type-parameter|template-varargs|template-nontype-parameter"/>
+
+    <xsl:if test="$parameters">
+      <!-- Get the actual parameter and its attributes -->
+      <xsl:variable name="parameter" select="$parameters[position()=1]"/>
+      <xsl:variable name="rest" select="$parameters[position()!=1]"/>
+
+      <!-- Display the parameter -->
+      <xsl:call-template name="template.parameter">
+        <xsl:with-param name="parameter" select="$parameter"/>
+        <xsl:with-param name="is-last" select="not($rest)"/>
+        <xsl:with-param name="highlight" select="$highlight"/>
+      </xsl:call-template>
+
+      <xsl:if test="$rest">
+        <xsl:text>, </xsl:text>
+      </xsl:if>
+
+      <!-- Display the comment -->
+      <xsl:if test="$parameter/purpose">
+        <xsl:call-template name="highlight-comment">
+          <xsl:with-param name="text">
+            <xsl:text>  // </xsl:text>
+            <xsl:apply-templates 
+              select="$parameter/purpose/*|$parameter/purpose/text()"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+
+      <!-- Indent the next line -->
+      <xsl:if test="$parameter/purpose or $rest">
+        <xsl:text>
</xsl:text>
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:call-template>
+      </xsl:if>
+
+      <!-- Recurse to print the rest of the parameters -->
+      <xsl:call-template name="template.reference.parameters.comments">
+        <xsl:with-param name="indentation" select="$indentation"/>
+        <xsl:with-param name="highlight" select="$highlight"/>
+        <xsl:with-param name="parameters" select="$rest"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Print a template parameter -->
+  <xsl:template name="template.parameter">
+    <xsl:param name="parameter"/>
+    <xsl:param name="is-last"/>
+    <xsl:param name="highlight" select="true()"/>
+    <xsl:apply-templates select="$parameter"
+      mode="print.parameter">
+      <xsl:with-param name="parameter" select="$parameter"/>
+      <xsl:with-param name="is-last" select="$is-last"/>
+      <xsl:with-param name="highlight" select="$highlight"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:template name="template.parameter.name">
+    <xsl:param name="name" select="@name"/>
+    <xsl:param name="highlight" select="true()"/>
+    
+    <xsl:choose>
+      <xsl:when test="$highlight">
+        <xsl:call-template name="concept.link">
+          <xsl:with-param name="name" 
+            select="translate($name, '0123456789', '')"/>
+          <xsl:with-param name="text" select="$name"/>
+          <xsl:with-param name="warn" select="false"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$name"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="template-type-parameter" mode="print.parameter">
+    <xsl:param name="parameter"/>
+    <xsl:param name="is-last"/>
+    <xsl:param name="highlight"/>
+
+    <xsl:choose>
+      <xsl:when test="$highlight">
+        <xsl:call-template name="highlight-keyword">
+          <xsl:with-param name="keyword" select="'typename'"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>typename</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text> </xsl:text>
+
+    <xsl:call-template name="template.parameter.name">
+      <xsl:with-param name="name" select="$parameter/@name"/>
+      <xsl:with-param name="highlight" select="$highlight"/>
+    </xsl:call-template>
+
+    <xsl:variable name="def">
+      <xsl:choose>
+        <xsl:when test="$parameter/@default">
+          <xsl:message>
+            <xsl:text>Warning: 'default' attribute of template parameter element is deprecated. Use 'default' element.</xsl:text>
+            <xsl:call-template name="print.warning.context"/>
+          </xsl:message>
+          <xsl:choose>
+            <xsl:when test="$highlight and false()">
+              <xsl:call-template name="source-highlight">
+                <xsl:with-param name="text">
+                  <xsl:value-of select="$parameter/@default"/>
+                </xsl:with-param>
+              </xsl:call-template>       
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="$parameter/@default"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:when test="$parameter/default">
+          <xsl:choose>
+            <xsl:when test="$highlight">
+              <xsl:apply-templates 
+                select="$parameter/default/*|$parameter/default/text()" 
+                mode="highlight"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="string($parameter/default)"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:if test="not($def='')">
+      <xsl:text> = </xsl:text>
+
+      <xsl:copy-of select="$def"/>
+
+      <!-- If this is the last parameter, add an extra space to
+           avoid printing >> -->
+      <xsl:if 
+        test="$is-last and (substring($def, string-length($def))='>')">
+        <xsl:text> </xsl:text>
+      </xsl:if>
+    </xsl:if>    
+  </xsl:template>
+
+  <xsl:template match="template-nontype-parameter" mode="print.parameter">
+    <xsl:param name="parameter"/>
+    <xsl:param name="is-last"/>
+    <xsl:param name="highlight"/>
+
+    <xsl:choose>
+      <xsl:when test="$highlight">
+        <xsl:call-template name="source-highlight">
+          <xsl:with-param name="text">
+            <xsl:apply-templates 
+              select="$parameter/type/*|$parameter/type/text()"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$parameter/type/*|$parameter/type/text()"/>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text> </xsl:text>
+
+    <xsl:call-template name="template.parameter.name">
+      <xsl:with-param name="name" select="$parameter/@name"/>
+      <xsl:with-param name="highlight" select="$highlight"/>
+    </xsl:call-template>
+
+    <xsl:variable name="def">
+      <xsl:value-of select="string($parameter/default)"/>
+    </xsl:variable>
+
+    <xsl:if test="not($def='')">
+      <xsl:text> = </xsl:text>
+
+      <xsl:choose>
+        <xsl:when test="$highlight">
+          <xsl:apply-templates select="$parameter/default/*|$parameter/default/text()" mode="highlight"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$def"/>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <!-- If this is the last parameter, add an extra space to
+           avoid printing >> -->
+      <xsl:if 
+        test="$is-last and (substring($def, string-length($def))='>')">
+        <xsl:text> </xsl:text>
+      </xsl:if>
+    </xsl:if>    
+  </xsl:template>
+
+  <xsl:template match="template-varargs" mode="print.parameter">
+    <xsl:text>...</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="specialization">
+    <xsl:param name="highlight" select="true()"/>
+    <xsl:text><</xsl:text>
+    <xsl:apply-templates select="template-arg">
+      <xsl:with-param name="highlight" select="$highlight"/>
+    </xsl:apply-templates>
+    <xsl:text>></xsl:text>
+  </xsl:template>
+
+  <xsl:template match="template-arg">
+    <xsl:if test="position() > 1">
+      <xsl:text>, </xsl:text>
+    </xsl:if>
+    <xsl:apply-templates mode="highlight"/>
+  </xsl:template>
+</xsl:stylesheet>
+
Added: sandbox/doc_test/xsl_test/type.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/type.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,1300 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+  <xsl:include href="global.xsl"/>
+  <xsl:strip-space elements="inherit purpose"/>
+
+  <!-- When true, the stylesheet will emit compact definitions of
+       enumerations when the enumeration does not have any detailed
+       description. A compact definition renders the enum definition along
+       with a comment for the purpose of the enum (if it exists) directly
+       within the synopsis. A non-compact definition will create a
+       separate refentry element for the enum. -->
+  <xsl:param name="boost.compact.enum">1</xsl:param>
+
+  <!-- When true, the stylesheet will emit compact definitions of
+       typedefs when the typedef does not have any detailed
+       description. -->
+  <xsl:param name="boost.compact.typedef">1</xsl:param>
+
+  <xsl:template match="class|struct|union" mode="generate.id">
+    <xsl:call-template name="fully-qualified-name">
+      <xsl:with-param name="node" select="."/>
+      <xsl:with-param name="separator" select="'.'"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="typedef" mode="generate.id">
+    <xsl:call-template name="fully-qualified-name">
+      <xsl:with-param name="node" select="."/>
+      <xsl:with-param name="separator" select="'.'"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="enum" mode="generate.id">
+    <xsl:call-template name="fully-qualified-name">
+      <xsl:with-param name="node" select="."/>
+      <xsl:with-param name="separator" select="'.'"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="enumvalue" mode="generate.id">
+    <xsl:call-template name="fully-qualified-name">
+      <xsl:with-param name="node" select="parent::enum"/>
+      <xsl:with-param name="separator" select="'.'"/>
+    </xsl:call-template>
+    <xsl:text>.</xsl:text>
+    <xsl:value-of select="@name"/>
+  </xsl:template>
+
+  <!-- Display the full name of the current node, e.g., "Class
+       template function". -->
+  <xsl:template name="type.display.name">
+    <xsl:choose>
+      <xsl:when test="contains(local-name(.), 'class')">
+        <xsl:text>Class </xsl:text>        
+      </xsl:when>
+      <xsl:when test="contains(local-name(.), 'struct')">
+        <xsl:text>Struct </xsl:text>
+      </xsl:when>
+      <xsl:when test="contains(local-name(.), 'union')">
+        <xsl:text>Union </xsl:text>
+      </xsl:when>
+      <xsl:when test="local-name(.)='enum'">
+        <xsl:text>Type </xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:message>
+Unknown type element "<xsl:value-of select="local-name(.)"/>" in type.display.name
+        </xsl:message>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:if test="template and count(template/*) > 0">
+      <xsl:text>template </xsl:text>
+    </xsl:if>
+    <xsl:call-template name="monospaced">
+      <xsl:with-param name="text">
+        <xsl:value-of select="@name"/>
+        <xsl:apply-templates select="specialization"/>
+      </xsl:with-param>
+    </xsl:call-template>    
+  </xsl:template>
+
+  <!-- Determine the class key for the given node -->
+  <xsl:template name="type.class.key">
+    <xsl:param name="node" select="."/>
+    <xsl:choose>
+      <xsl:when test="contains(local-name($node), '-specialization')">
+        <xsl:value-of select="substring-before(local-name($node), '-')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="local-name($node)"/>
+      </xsl:otherwise>
+    </xsl:choose>    
+  </xsl:template>
+
+  <!-- Emit class synopsis -->
+  <xsl:template match="class|class-specialization|
+                       struct|struct-specialization|
+                       union|union-specialization" mode="synopsis">
+    <xsl:param name="indentation"/>
+   
+    <!-- The keyword used to declare this class type, e.g., class,
+         struct, or union. -->
+    <xsl:variable name="class-key">
+      <xsl:call-template name="type.class.key"/>
+    </xsl:variable>
+
+    <!-- Spacing -->
+    <xsl:if test="not (local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() > 1)">
+      <xsl:text>
</xsl:text>
+    </xsl:if>
+
+    <xsl:text>
</xsl:text>
+
+    <!-- Calculate how long this declaration would be if we put it all
+         on one line -->
+    <xsl:variable name="full-decl-string">
+      <xsl:apply-templates select="template" mode="synopsis">
+        <xsl:with-param name="indentation" select="$indentation"/>
+        <xsl:with-param name="wrap" select="false()"/>
+      </xsl:apply-templates>
+      <xsl:value-of select="$class-key"/>
+      <xsl:text> </xsl:text>
+      <xsl:value-of select="@name"/>
+      <xsl:apply-templates select="specialization"/>
+      <xsl:text>;</xsl:text>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="(string-length($full-decl-string) + 
+                       string-length($indentation)) < $max-columns">
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:call-template>
+        <xsl:apply-templates select="template" mode="synopsis">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:apply-templates>
+
+        <xsl:call-template name="highlight-keyword">
+          <xsl:with-param name="keyword" select="$class-key"/>
+        </xsl:call-template>
+        <xsl:text> </xsl:text>
+        <xsl:call-template name="internal-link">
+          <xsl:with-param name="to">
+            <xsl:call-template name="generate.id"/>
+          </xsl:with-param>
+          <xsl:with-param name="text">
+            <xsl:value-of select="@name"/>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:apply-templates select="specialization"/>
+        <xsl:text>;</xsl:text>
+      </xsl:when>
+
+      <xsl:otherwise>
+        <!-- Template header -->
+        <xsl:if test="template">
+          <xsl:call-template name="indent">
+            <xsl:with-param name="indentation" select="$indentation"/>
+          </xsl:call-template>
+          <xsl:apply-templates select="template" mode="synopsis">
+            <xsl:with-param name="indentation" select="$indentation"/>
+          </xsl:apply-templates>
+          <xsl:text>
</xsl:text>
+          
+          <!-- Indent class templates' names in the synopsis -->
+          <xsl:text>  </xsl:text>
+        </xsl:if>
+        
+        <!-- Class name -->
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:call-template>
+        <xsl:call-template name="highlight-keyword">
+          <xsl:with-param name="keyword" select="$class-key"/>
+        </xsl:call-template>
+        <xsl:text> </xsl:text>
+        <xsl:call-template name="internal-link">
+          <xsl:with-param name="to">
+            <xsl:call-template name="generate.id">
+              <xsl:with-param name="node" select="."/>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="text" select="string(@name)"/>
+        </xsl:call-template>
+        <xsl:apply-templates select="specialization"/>
+        <xsl:text>;</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <!-- Free functions associated with the class -->
+    <xsl:apply-templates select="free-function-group" mode="header-synopsis">
+      <xsl:with-param name="indentation" select="$indentation"/>
+      <xsl:with-param name="class" select="@name"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <!-- Emit a typedef synopsis -->
+  <xsl:template name="type.typedef.display.aligned">
+    <xsl:param name="compact"/>
+    <xsl:param name="indentation"/>
+    <xsl:param name="is-reference"/>
+    <xsl:param name="max-type-length"/>
+    <xsl:param name="max-name-length"/>
+
+    <!-- What type of link the typedef name should have. This shall
+         be one of 'anchor' (the typedef output will be the target of
+         links), 'link' (the typedef output will link to a definition), or
+         'none' (the typedef output will not be either a link or a link
+         target) -->
+    <xsl:param name="link-type">
+      <xsl:choose>
+        <xsl:when test="$is-reference">
+          <xsl:text>anchor</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>link</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:param>
+
+    <!-- The id we should link to or anchor as -->
+    <xsl:param name="link-to">
+      <xsl:call-template name="generate.id"/>
+    </xsl:param>
+
+    <!-- The id we should link to or anchor as -->
+    <xsl:param name="typedef-name">
+      <xsl:value-of select="@name"/>
+    </xsl:param>
+
+    <!-- Padding for the typedef types -->
+    <xsl:variable name="type-padding">
+      <xsl:call-template name="indent">
+        <xsl:with-param name="indentation" select="$max-type-length"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <!-- Padding for the typedef names -->
+    <xsl:variable name="name-padding">
+      <xsl:call-template name="indent">
+        <xsl:with-param name="indentation" select="$max-name-length"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:text>
</xsl:text>
+    <xsl:choose>
+      <!-- Create a vertical ellipsis -->
+      <xsl:when test="@name = '...'">
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$indentation + 3"/>      
+        </xsl:call-template>        
+        <xsl:text>.
</xsl:text>
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$indentation + 3"/>      
+        </xsl:call-template>
+        <xsl:text>.
</xsl:text>
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$indentation + 3"/>      
+        </xsl:call-template>
+        <xsl:text>.</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$indentation"/>      
+        </xsl:call-template>
+        <xsl:call-template name="highlight-keyword">
+          <xsl:with-param name="keyword" select="'typedef'"/>
+        </xsl:call-template>
+        <xsl:text> </xsl:text>
+
+        <!-- Length of the type -->
+        <xsl:variable name="type-length">
+          <xsl:choose>
+            <xsl:when test="@type">
+              <xsl:message>
+                <xsl:text>Warning: `type' attribute of `typedef' element is deprecated. Use 'type' element instead.</xsl:text>
+              </xsl:message>
+              <xsl:call-template name="print.warning.context"/>
+              <xsl:value-of select="string-length(@type)"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="string-length(type)"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+
+        <!-- Emit the type -->
+        <xsl:choose>
+          <xsl:when test="@type">
+            <xsl:value-of select="@type"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="type/*|type/text()" 
+              mode="highlight"/>
+            <!--
+            <xsl:call-template name="source-highlight">
+              <xsl:with-param name="text">
+                <xsl:apply-templates select="type/*|type/text()"/>
+              </xsl:with-param>
+            </xsl:call-template> 
+            -->
+          </xsl:otherwise>
+        </xsl:choose>
+
+        <xsl:choose>
+          <xsl:when test="$max-type-length > 0">
+            <xsl:value-of select="substring($type-padding, 1, 
+                                            $max-type-length - $type-length)"/>
+            <xsl:text> </xsl:text>
+            <xsl:value-of select="substring(concat(@name, ';', $name-padding), 
+                                            1, $max-name-length)"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text> </xsl:text>
+            <xsl:call-template name="link-or-anchor">
+              <xsl:with-param name="to" select="$link-to"/>
+              <xsl:with-param name="text" select="$typedef-name"/>
+              <xsl:with-param name="link-type" select="$link-type"/>
+              <xsl:with-param name="highlight" select="true()"/>
+            </xsl:call-template>
+            <xsl:text>;</xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+
+        <xsl:if test="$compact and purpose">
+          <xsl:text>  </xsl:text>
+          <xsl:call-template name="highlight-comment">
+            <xsl:with-param name="text">
+              <xsl:text>// </xsl:text>
+              <xsl:apply-templates select="purpose" mode="comment"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="typedef" mode="synopsis">
+    <xsl:param name="indentation"/>
+    <xsl:param name="max-type-length" select="0"/>
+    <xsl:param name="max-name-length" select="0"/>
+    
+    <!-- True if we should compact this typedef -->
+    <xsl:variable name="compact"
+      select="not (para|description) and ($boost.compact.typedef='1')"/>
+
+    <xsl:choose>
+      <xsl:when test="$compact">
+        <!-- Spacing -->
+        <xsl:if test="not (local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() > 1)">
+          <xsl:text>
</xsl:text>
+        </xsl:if>
+
+        <xsl:call-template name="type.typedef.display.aligned">
+          <xsl:with-param name="compact" select="$compact"/>
+          <xsl:with-param name="indentation" select="$indentation"/>
+          <xsl:with-param name="is-reference" select="true()"/>
+          <xsl:with-param name="max-type-length" select="$max-type-length"/>
+          <xsl:with-param name="max-name-length" select="$max-name-length"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="type.typedef.display.aligned">
+          <xsl:with-param name="compact" select="$compact"/>
+          <xsl:with-param name="indentation" select="$indentation"/>
+          <xsl:with-param name="is-reference" select="false()"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Emit a typedef reference entry -->
+  <xsl:template match="typedef" mode="reference">
+    <!-- True if this typedef was compacted -->
+    <xsl:variable name="compact"
+      select="not (para|description) and ($boost.compact.typedef='1')"/>
+
+    <xsl:if test="not ($compact)">
+      <xsl:call-template name="reference-documentation">
+        <xsl:with-param name="refname" select="@name"/>
+        <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
+        <xsl:with-param name="anchor">
+          <xsl:call-template name="generate.id"/>
+        </xsl:with-param>
+        <xsl:with-param name="name">
+          <xsl:text>Type definition </xsl:text>
+          <xsl:call-template name="monospaced">
+            <xsl:with-param name="text" select="@name"/>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="synopsis">
+          <xsl:call-template name="type.typedef.display.aligned">
+            <xsl:with-param name="compact" select="false()"/>
+            <xsl:with-param name="indentation" select="0"/>
+            <xsl:with-param name="is-reference" select="true()"/>
+            <xsl:with-param name="link-type" select="'none'"/>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="text">
+          <xsl:apply-templates select="description"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Emit a list of static constants -->
+  <xsl:template match="static-constant" mode="synopsis">
+    <xsl:param name="indentation"/>
+    <xsl:text>
</xsl:text>
+
+    <xsl:call-template name="indent">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:call-template>
+    <xsl:call-template name="source-highlight">
+      <xsl:with-param name="text" select="'static const '"/>
+    </xsl:call-template>
+
+    <xsl:call-template name="source-highlight">
+      <xsl:with-param name="text">
+        <xsl:apply-templates select="type/*|type/text()"/>    
+      </xsl:with-param>
+    </xsl:call-template>
+    
+    <xsl:if test="not(@name = '')">
+      <xsl:text> </xsl:text>
+      <xsl:value-of select="@name"/>
+    </xsl:if>
+
+    <xsl:text> = </xsl:text>
+
+    <xsl:call-template name="source-highlight">
+      <xsl:with-param name="text">
+        <xsl:apply-templates select="default/*|default/text()"/>
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:text>;</xsl:text>
+
+    <xsl:if test="purpose">
+      <xsl:text>  </xsl:text>
+      <xsl:call-template name="highlight-comment">
+        <xsl:with-param name="text">
+          <xsl:text>// </xsl:text>
+          <xsl:apply-templates select="purpose" mode="comment"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Format base classes on a single line -->
+  <xsl:template name="print.base.classes.single">
+    <xsl:apply-templates select="inherit"/>
+  </xsl:template>
+
+  <xsl:template name="print.base.classes.multi">
+    <xsl:param name="indentation"/>
+    
+    <xsl:variable name="n" select="count(inherit)"/>
+    <xsl:for-each select="inherit">
+      <!-- Indentation -->
+      <xsl:if test="position() > 1">
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:call-template>
+      </xsl:if>
+
+      <!-- Output the access specifier -->
+      <xsl:variable name="access">
+        <xsl:choose>
+          <xsl:when test="@access">
+            <xsl:value-of select="@access"/>
+          </xsl:when>
+          <xsl:when test="parent::class|parent::class-specialization">
+            <xsl:text>private</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>public</xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+      <xsl:call-template name="highlight-keyword">
+        <xsl:with-param name="keyword" select="@access"/>
+      </xsl:call-template>
+      <xsl:text> </xsl:text>
+
+      <!-- Output the type -->
+      <xsl:choose>
+        <xsl:when test="type">
+          <xsl:apply-templates select="type/*|type/text()" mode="annotation"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates mode="annotation"/>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <!-- Output a comma if not at the end -->
+      <xsl:if test="position() < $n">
+        <xsl:text>,</xsl:text>
+      </xsl:if>
+
+      <!-- Output a comment if we have one -->
+      <xsl:if test="purpose">
+        <xsl:choose>
+          <xsl:when test="position() < $n">
+            <xsl:text>  </xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>   </xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:call-template name="highlight-comment">
+          <xsl:with-param name="text">
+            <xsl:text>// </xsl:text>
+            <xsl:apply-templates select="purpose/*|purpose/text()"
+              mode="annotation"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="position() < $n">
+        <xsl:text>
</xsl:text>
+      </xsl:if>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="print.base.classes">
+    <xsl:param name="indentation" select="0"/>
+    <xsl:param name="base-indentation" select="0"/>
+
+    <xsl:variable name="single-line-candidate" select="not(inherit/purpose)"/>
+    <xsl:variable name="single-line">
+      <xsl:if test="$single-line-candidate">
+        <xsl:call-template name="print.base.classes.single"/>
+      </xsl:if>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="$single-line-candidate and 
+                      (string-length($single-line) + $indentation + 3
+                        < $max-columns)">
+        <xsl:call-template name="print.base.classes.single"/>
+        <xsl:text> {</xsl:text>
+      </xsl:when>
+      <xsl:when test="$single-line-candidate and
+                      (string-length($single-line) + $base-indentation + 5
+                        < $max-columns)">
+        <xsl:text>
</xsl:text>
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$base-indentation"/>
+        </xsl:call-template>
+        <xsl:text>  : </xsl:text>
+        <xsl:call-template name="print.base.classes.single"/>
+        <xsl:text>
</xsl:text>
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$base-indentation"/>
+        </xsl:call-template>
+        <xsl:text>{</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text> : </xsl:text>
+        <xsl:call-template name="print.base.classes.multi">
+          <xsl:with-param name="indentation" select="$indentation + 3"/>
+        </xsl:call-template>
+        <xsl:text>
</xsl:text>
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$base-indentation"/>
+        </xsl:call-template>
+        <xsl:text>{</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Emit a list of base classes without comments and on a single line -->
+  <xsl:template match="inherit">
+    <xsl:choose>
+      <xsl:when test="position()=1">
+        <xsl:text> : </xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>, </xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:call-template name="highlight-keyword">
+      <xsl:with-param name="keyword" select="@access"/>
+    </xsl:call-template>
+    <xsl:text> </xsl:text>
+    <xsl:apply-templates mode="annotation">
+      <xsl:with-param name="highlight" select="true()"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <!-- Find the maximum length of the types in typedefs -->
+  <xsl:template name="find-max-type-length">
+    <xsl:param name="typedefs" select="typedef"/>
+    <xsl:param name="max-length" select="0"/>
+    <xsl:param name="want-name" select="false()"/>
+
+    <xsl:choose>
+      <xsl:when test="$typedefs">
+        <xsl:variable name="typedef" select="$typedefs[position()=1]"/>
+        <xsl:variable name="rest" select="$typedefs[position()!=1]"/>
+
+        <!-- Find the length of the type -->
+        <xsl:variable name="length">
+          <xsl:choose>
+            <xsl:when test="$typedef/@name != '...'">
+              <xsl:choose>
+                <xsl:when test="$want-name">
+                  <xsl:value-of select="string-length($typedef/@name) + 1"/>
+                </xsl:when>
+                <xsl:when test="$typedef/@type">
+                  <xsl:value-of select="string-length($typedef/@type)"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="string-length($typedef/type)"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+              0
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+
+        <!-- Pass on the larger length -->
+        <xsl:choose>
+          <xsl:when test="$length > $max-length">
+            <xsl:call-template name="find-max-type-length">
+              <xsl:with-param name="typedefs" select="$rest"/>
+              <xsl:with-param name="max-length" select="$length"/>
+              <xsl:with-param name="want-name" select="$want-name"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="find-max-type-length">
+              <xsl:with-param name="typedefs" select="$rest"/>
+              <xsl:with-param name="max-length" select="$max-length"/>
+              <xsl:with-param name="want-name" select="$want-name"/>
+            </xsl:call-template>            
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$max-length"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>  
+
+  <xsl:template match="constructor" mode="synopsis">
+    <xsl:param name="indentation"/>
+    <xsl:call-template name="function">
+      <xsl:with-param name="indentation" select="$indentation"/>
+      <xsl:with-param name="context" select="../@name"/>
+      <xsl:with-param name="is-reference" select="false()"/>
+      <xsl:with-param name="constructor-for" select="../@name"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="copy-assignment" mode="synopsis">
+    <xsl:param name="indentation"/>
+    <xsl:call-template name="function">
+      <xsl:with-param name="indentation" select="$indentation"/>
+      <xsl:with-param name="context" select="../@name"/>
+      <xsl:with-param name="is-reference" select="false()"/>
+      <xsl:with-param name="copy-assign-for" select="../@name"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="destructor" mode="synopsis">
+    <xsl:param name="indentation"/>
+    <xsl:call-template name="function">
+      <xsl:with-param name="indentation" select="$indentation"/>
+      <xsl:with-param name="context" select="../@name"/>
+      <xsl:with-param name="is-reference" select="false()"/>
+      <xsl:with-param name="destructor-for" select="../@name"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template name="class-type-synopsis">
+    <xsl:param name="indentation" select="0"/>
+
+    <!-- The keyword used to declare this class type, e.g., class,
+         struct, or union. -->
+    <xsl:variable name="class-key">
+      <xsl:call-template name="type.class.key"/>
+    </xsl:variable>
+
+    <xsl:if test="ancestor::class|ancestor::class-specialization|
+                  ancestor::struct|ancestor::struct-specialization|
+                  ancestor::union|ancestor::union-specialization">
+      <xsl:text>

</xsl:text>
+
+      <!-- If this nested class has a "purpose" element, use it as a
+           comment. -->
+      <xsl:if test="purpose">
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:call-template>
+        <xsl:call-template name="highlight-comment">
+          <xsl:with-param name="text">
+            <xsl:text>// </xsl:text>
+            <xsl:apply-templates select="purpose" mode="comment"/>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:text>
</xsl:text>
+      </xsl:if>
+    </xsl:if>
+
+    <!-- Template header -->
+    <xsl:if test="template">
+      <xsl:call-template name="indent">
+        <xsl:with-param name="indentation" select="$indentation"/>
+      </xsl:call-template>
+      <xsl:apply-templates select="template" mode="reference">
+        <xsl:with-param name="indentation" select="$indentation"/>
+      </xsl:apply-templates>
+    </xsl:if>
+    <xsl:text>
</xsl:text>
+    
+    <!-- Class name -->
+    <xsl:call-template name="indent">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:call-template>
+    <xsl:call-template name="highlight-keyword">
+      <xsl:with-param name="keyword" select="$class-key"/>
+    </xsl:call-template>
+    <xsl:text> </xsl:text>
+    <xsl:value-of select="@name"/>
+    <xsl:apply-templates select="specialization"/>
+    
+    <xsl:choose>
+      <xsl:when test="inherit">
+        <!-- Base class list (with opening brace) -->
+        <xsl:call-template name="print.base.classes">
+          <xsl:with-param name="indentation" 
+            select="string-length($class-key) + string-length(@name) 
+                    + $indentation + 1"/>
+          <xsl:with-param name="base-indentation" select="$indentation"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <!-- Opening brace -->
+        <xsl:text> {</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <!-- Public designator -->
+    <xsl:if test="contains(local-name(.), 'class')">
+      <xsl:text>
</xsl:text>
+      <xsl:call-template name="indent">
+        <xsl:with-param name="indentation" select="$indentation"/>
+      </xsl:call-template>
+      <xsl:call-template name="highlight-keyword">
+        <xsl:with-param name="keyword" select="'public'"/>
+      </xsl:call-template>
+      <xsl:text>:</xsl:text>
+    </xsl:if>
+
+    <!-- Typedefs -->
+    <xsl:if test="typedef">
+      <xsl:text>
</xsl:text>
+      <xsl:call-template name="indent">
+        <xsl:with-param name="indentation" select="$indentation + 2"/>
+      </xsl:call-template>
+      <xsl:call-template name="highlight-comment">
+        <xsl:with-param name="text" select="'// types'"/>
+      </xsl:call-template>
+      
+      <xsl:variable name="max-type-length">
+        <xsl:call-template name="find-max-type-length"/>
+      </xsl:variable>
+      <xsl:variable name="max-name-length">
+        <xsl:call-template name="find-max-type-length">
+          <xsl:with-param name="want-name" select="true()"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:apply-templates select="typedef" mode="synopsis">
+        <xsl:with-param name="indentation" select="$indentation + 2"/>
+        <xsl:with-param name="max-type-length" 
+          select="$max-type-length"/>
+        <xsl:with-param name="max-name-length" 
+          select="$max-name-length"/>
+      </xsl:apply-templates>
+    </xsl:if>
+    
+    <!-- Static constants -->
+    <xsl:if test="static-constant">
+      <xsl:text>
</xsl:text>
+      <xsl:if test="typedef">
+        <xsl:text>
</xsl:text>
+      </xsl:if>
+      <xsl:call-template name="indent">
+        <xsl:with-param name="indentation" select="$indentation + 2"/>
+      </xsl:call-template>
+      <xsl:call-template name="highlight-comment">
+        <xsl:with-param name="text" select="'// static constants'"/>
+      </xsl:call-template>
+      <xsl:apply-templates select="static-constant" mode="synopsis">
+        <xsl:with-param name="indentation" select="$indentation + 2"/>
+      </xsl:apply-templates>
+    </xsl:if>
+    
+    <!-- Nested classes/structs/unions -->
+    <xsl:apply-templates select="class|class-specialization|
+                                 struct|struct-specialization|
+                                 union|union-specialization"
+      mode="reference">
+      <xsl:with-param name="indentation" select="$indentation + 2"/>
+    </xsl:apply-templates>
+
+    <!-- Enums -->
+    <xsl:apply-templates select="enum" mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation + 2"/>
+    </xsl:apply-templates>
+
+    <!-- Construct/Copy/Destruct -->
+    <xsl:call-template name="construct-copy-destruct-synopsis">
+      <xsl:with-param name="indentation" select="$indentation + 2"/>
+    </xsl:call-template>
+
+    <!-- Member functions -->
+    <xsl:apply-templates 
+      select="method-group|method|overloaded-method" 
+      mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation + 2"/>
+    </xsl:apply-templates>
+
+    <!-- Data members -->
+    <xsl:apply-templates select="data-member" mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation + 2"/>
+    </xsl:apply-templates>
+
+    <!-- Closing brace -->
+    <xsl:text>
</xsl:text>
+    <xsl:call-template name="indent">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:call-template>
+    <xsl:text>};</xsl:text>
+  </xsl:template>
+
+  <!-- Emit nested class reference documentation -->
+  <xsl:template match="class|class-specialization|
+                       struct|struct-specialization|
+                       union|union-specialization" mode="reference">
+    <xsl:param name="indentation"/>
+
+    <xsl:call-template name="class-type-synopsis">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- Emit namespace-level class reference documentation -->
+  <xsl:template match="class|class-specialization|
+                       struct|struct-specialization|
+                       union|union-specialization" mode="namespace-reference">
+    <xsl:param name="indentation" select="0"/>
+
+    <xsl:call-template name="separator"/>
+    <xsl:call-template name="reference-documentation">
+      <xsl:with-param name="refname">
+        <xsl:call-template name="fully-qualified-name">
+          <xsl:with-param name="node" select="."/>
+        </xsl:call-template>
+      </xsl:with-param>
+      <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
+      <xsl:with-param name="anchor">
+        <xsl:call-template name="generate.id">
+          <xsl:with-param name="node" select="."/>
+        </xsl:call-template>
+      </xsl:with-param>
+      <xsl:with-param name="name">
+        <xsl:call-template name="type.display.name"/>
+      </xsl:with-param>
+      <xsl:with-param name="synopsis">
+        <xsl:call-template name="class-type-synopsis">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:call-template>
+        <!-- Associated free functions -->
+        <xsl:apply-templates select="ancestor-or-self::*/free-function-group"
+          mode="synopsis">
+          <xsl:with-param name="indentation" select="$indentation"/>
+          <xsl:with-param name="class" select="@name"/>
+        </xsl:apply-templates>
+      </xsl:with-param>
+      <xsl:with-param name="text">
+        <!-- Paragraphs go into the top of the "Description" section. -->
+        <xsl:if test="para">
+          <xsl:message>
+            <xsl:text>Warning: Use of 'para' elements in 'class' element is deprecated.
Wrap them in a 'description' element.</xsl:text>
+          </xsl:message>
+          <xsl:call-template name="print.warning.context"/>
+          <xsl:apply-templates select="para" mode="annotation"/>
+        </xsl:if>
+        <xsl:apply-templates select="description"/>
+        
+        <xsl:call-template name="construct-copy-destruct-reference"/>
+        
+        <xsl:apply-templates 
+          select="method-group|method|overloaded-method"
+          mode="reference"/>
+        
+        <!-- Emit reference docs for nested classes -->
+        <xsl:apply-templates 
+          select="class|class-specialization|
+                  struct|struct-specialization|
+                  union|union-specialization"
+          mode="namespace-reference"/>
+        
+        <!-- Emit reference docs for nested enums -->
+        <xsl:apply-templates 
+          select="enum"
+          mode="namespace-reference"/>
+        
+        <xsl:apply-templates select="free-function-group" mode="reference">
+          <xsl:with-param name="class" select="@name"/>
+        </xsl:apply-templates>
+        
+        <!-- Specializations of this class -->
+        <!-- TBD: fix this. We should key off the class name and match
+             fully-qualified names -->
+        <xsl:variable name="name" select="@name"/>
+        <xsl:if test="local-name(.)='class' and 
+                      ../class-specialization[@name=$name]">
+          <refsect2>
+            <title>Specializations</title>
+            <itemizedlist>
+              <xsl:apply-templates 
+                select="../class-specialization[@name=$name]"
+                mode="specialization-list"/>
+            </itemizedlist>
+          </refsect2>
+        </xsl:if>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- Output a link to a specialization -->
+  <xsl:template match="class-specialization|
+                       struct-specialization|
+                       union-specialization" mode="specialization-list">
+    <listitem>
+      <para>
+        <xsl:call-template name="internal-link">
+          <xsl:with-param name="to">
+            <xsl:call-template name="generate.id">
+              <xsl:with-param name="node" select="."/>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="text">
+            <xsl:call-template name="type.display.name"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </para>
+    </listitem>
+  </xsl:template>
+
+  <!-- Data member synopsis -->
+  <xsl:template match="data-member" mode="synopsis">
+    <xsl:param name="indentation"/>
+
+    <xsl:choose>
+      <xsl:when test="ancestor::class|ancestor::class-specialization|
+                      ancestor::struct|ancestor::struct-specialization|
+                      ancestor::union|ancestor::union-specialization">
+
+    <!-- Spacing -->
+    <xsl:if 
+      test="not(local-name(preceding-sibling::*[position()=1])=local-name(.))">
+      <xsl:text>
</xsl:text>
+    </xsl:if>
+
+    <!-- Indent -->
+    <xsl:text>
</xsl:text>
+    <xsl:call-template name="indent">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:call-template>
+
+    <xsl:if test="@specifiers">
+      <xsl:call-template name="highlight-keyword">
+        <xsl:with-param name="keyword" select="@specifiers"/>
+      </xsl:call-template>
+      <xsl:text> </xsl:text>
+    </xsl:if>
+
+    <xsl:apply-templates select="type/*|type/text()" mode="annotation"/>
+    <xsl:text> </xsl:text>
+    <xsl:value-of select="@name"/>
+    <xsl:text>;</xsl:text>
+
+      </xsl:when>
+      <xsl:otherwise>
+       <xsl:call-template name="global-synopsis">
+         <xsl:with-param name="indentation" select="$indentation"/>
+       </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Data member reference -->
+  <xsl:template match="data-member" mode="reference">
+    <xsl:choose>
+      <xsl:when test="ancestor::class|ancestor::class-specialization|
+                      ancestor::struct|ancestor::struct-specialization|
+                      ancestor::union|ancestor::union-specialization"/>
+      <xsl:otherwise>
+        <xsl:call-template name="global-reference"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Enumeration synopsis -->
+  <xsl:template match="enum" mode="synopsis">
+    <xsl:param name="indentation"/>
+
+    <!-- Spacing -->
+    <xsl:if 
+      test="(not (local-name(preceding-sibling::*[position()=1])=local-name(.))
+             and (position() > 1)) or 
+            not (para or description or not ($boost.compact.enum=1))">
+      <xsl:text>
</xsl:text>
+    </xsl:if>
+
+    <!-- Indent -->
+    <xsl:text>
</xsl:text>
+    <xsl:call-template name="indent">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:call-template>
+
+    <xsl:choose>
+      <!-- When there is a detailed description, we only put the
+           declaration in the synopsis and will put detailed documentation
+           in either a <refentry/> or in class documentation. -->
+      <xsl:when test="para or description or not ($boost.compact.enum=1)">
+        <xsl:call-template name="highlight-keyword">
+          <xsl:with-param name="keyword" select="'enum'"/>
+        </xsl:call-template>
+
+        <xsl:text> </xsl:text>
+
+        <xsl:call-template name="internal-link">
+          <xsl:with-param name="to">
+            <xsl:call-template name="generate.id">
+              <xsl:with-param name="node" select="."/>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="text" select="string(@name)"/>
+          <xsl:with-param name="higlhight" select="false()"/>
+        </xsl:call-template>
+      </xsl:when>
+      <!-- When there is no detailed description, we put the enum
+           definition within the synopsis. The purpose of the enum (if
+           available) is formatted as a comment prior to the
+           definition. This way, we do not create a separate block of text
+           for what is generally a very small amount of information. -->
+      <xsl:otherwise>
+        <xsl:if test="purpose">
+          <xsl:call-template name="highlight-comment">
+            <xsl:with-param name="text">
+              <xsl:text>// </xsl:text>
+              <xsl:apply-templates select="purpose/*|purpose/text()" mode="annotation"/>
+            </xsl:with-param>
+          </xsl:call-template>
+
+          <xsl:text>
</xsl:text>
+          <xsl:call-template name="indent">
+            <xsl:with-param name="indentation" select="$indentation"/>
+          </xsl:call-template>
+        </xsl:if>
+
+        <xsl:call-template name="highlight-keyword">
+          <xsl:with-param name="keyword" select="'enum'"/>
+        </xsl:call-template>
+
+        <xsl:text> </xsl:text>
+        
+        <xsl:call-template name="anchor">
+          <xsl:with-param name="to">
+            <xsl:call-template name="generate.id">
+              <xsl:with-param name="node" select="."/>
+            </xsl:call-template>
+          </xsl:with-param>
+          <xsl:with-param name="text" select="@name"/>
+          <xsl:with-param name="higlhight" select="false()"/>
+        </xsl:call-template>
+
+        <xsl:text> { </xsl:text>
+        <xsl:call-template name="type.enum.list.compact">
+          <xsl:with-param name="indentation"
+            select="$indentation + string-length(@name) + 8"/>
+          <xsl:with-param name="compact" select="true()"/>
+        </xsl:call-template>
+        <xsl:text> }</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text>;</xsl:text>
+  </xsl:template>
+
+  <!-- Enumeration reference at namespace level -->
+  <xsl:template match="enum" mode="namespace-reference">
+    <xsl:if test="para or description or not ($boost.compact.enum=1)">
+      <xsl:call-template name="reference-documentation">
+        <xsl:with-param name="name">
+          <xsl:call-template name="type.display.name"/>
+        </xsl:with-param>
+        <xsl:with-param name="refname">
+          <xsl:call-template name="fully-qualified-name">
+            <xsl:with-param name="node" select="."/>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
+        <xsl:with-param name="anchor">
+          <xsl:call-template name="generate.id">
+            <xsl:with-param name="node" select="."/>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="synopsis">
+          <xsl:call-template name="type.enum.display"/>
+        </xsl:with-param>
+
+        <xsl:with-param name="text">
+          <!-- Paragraphs go into the top of the "Description" section. -->
+          <xsl:if test="para">
+            <xsl:message>
+              <xsl:text>Warning: Use of 'para' elements in 'enum' element is deprecated.
Wrap them in a 'description' element.</xsl:text>
+            </xsl:message>
+            <xsl:call-template name="print.warning.context"/>
+            <xsl:apply-templates select="para" mode="annotation"/>
+          </xsl:if>
+          <xsl:apply-templates select="description"/>
+          <variablelist spacing="compact">
+            <xsl:apply-templates select="enumvalue" mode="reference"/>
+          </variablelist>
+        </xsl:with-param>
+
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Output an enumeration along with its values -->
+  <xsl:template name="type.enum.display">
+    <!-- Spacing -->
+    <xsl:if test="position() > 1">
+      <xsl:text>
</xsl:text>
+    </xsl:if>
+
+    <xsl:text>
</xsl:text>    
+
+    <xsl:call-template name="highlight-keyword">
+      <xsl:with-param name="keyword" select="'enum'"/>
+    </xsl:call-template>
+
+    <!-- Header -->
+    <xsl:variable name="header" select="concat(' ', @name, ' { ')"/>
+    <xsl:value-of select="$header"/>
+
+    <!-- Print the enumeration values -->
+    <xsl:call-template name="type.enum.list.compact">
+      <xsl:with-param name="indentation" select="4 + string-length($header)"/>
+    </xsl:call-template>
+
+    <xsl:text> };</xsl:text>    
+  </xsl:template>
+
+  <!-- List enumeration values in a compact form e.g.,
+       enum Name { value1 = foo, value2 = bar, ... }; 
+       This routine prints only the enumeration values; the caller is 
+       responsible for printing everything outside the braces
+       (inclusive). -->
+  <xsl:template name="type.enum.list.compact">
+    <xsl:param name="indentation"/>
+    <xsl:param name="compact" select="false()"/>
+
+    <!-- Internal: The column we are on -->
+    <xsl:param name="column" select="$indentation"/>
+
+    <!-- Internal: The index of the current enumvalue
+         we're processing -->
+    <xsl:param name="pos" select="1"/>
+
+    <!-- Internal: a prefix that we need to print prior to printing
+         this value. -->
+    <xsl:param name="prefix" select="''"/>
+
+    <xsl:if test="not($pos > count(enumvalue))">
+      <xsl:variable name="value" select="enumvalue[position()=$pos]"/>
+      
+      <!-- Compute the string to be printed for this value -->
+      <xsl:variable name="result">
+        <xsl:value-of select="$prefix"/>
+        <xsl:value-of select="$value/attribute::name"/>
+
+        <xsl:if test="$value/default">
+          <xsl:text> = </xsl:text>
+          <xsl:value-of select="$value/default/*|$value/default/text()"/>
+        </xsl:if>
+      </xsl:variable>
+
+      <!-- The column we will end on, assuming that this value fits on
+           this line -->
+      <xsl:variable name="end" select="$column + string-length($result)"/>
+
+      <!-- The column we will actually end on -->
+      <xsl:variable name="end2">
+        <xsl:choose>
+          <!-- If the enumeration value fits on this line, put it there -->
+          <xsl:when test="$end < $max-columns">
+            <xsl:value-of select="$end"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$indentation 
+                                + string-length($result) 
+                                - string-length($prefix)"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
+      <xsl:value-of select="$prefix"/>
+
+      <!-- If the enumeration value doesn't fit on this line,
+           put it on a new line -->
+      <xsl:if test="not($end < $max-columns)">
+        <xsl:text>
</xsl:text>
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:call-template>
+      </xsl:if>
+
+      <!-- If the enumeration value has a description, link it
+           to its description. -->
+      <xsl:choose>
+        <xsl:when test="($value/purpose or $value/description) and not($compact)">
+          <xsl:call-template name="internal-link">
+            <xsl:with-param name="to">
+              <xsl:call-template name="generate.id">
+                <xsl:with-param name="node" select="$value"/>
+              </xsl:call-template>
+            </xsl:with-param>
+            <xsl:with-param name="text" select="$value/attribute::name"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$value/attribute::name"/>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <!-- If the enumeration value has a default,
+           print it. -->
+      <xsl:if test="$value/default">
+        <xsl:text> = </xsl:text>
+        <xsl:apply-templates 
+          select="$value/default/*|$value/default/text()"/>
+      </xsl:if>
+
+      <!-- Recursively generate the rest of the enumeration list -->
+      <xsl:call-template name="type.enum.list.compact">
+        <xsl:with-param name="indentation" select="$indentation"/>
+        <xsl:with-param name="compact" select="$compact"/>
+        <xsl:with-param name="column" select="$end2"/>
+        <xsl:with-param name="pos" select="$pos + 1"/>
+        <xsl:with-param name="prefix" select="', '"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Enumeration reference at namespace level -->
+  <xsl:template match="enumvalue" mode="reference">
+    <xsl:if test="purpose or description">
+      <varlistentry>
+        <term>
+          <xsl:call-template name="monospaced">
+            <xsl:with-param name="text" select="@name"/>
+          </xsl:call-template>
+          <!-- Note: the anchor must come after the text here, and not
+               before it; otherwise, FOP goes into an infinite loop. -->
+          <xsl:call-template name="anchor">
+            <xsl:with-param name="to">
+              <xsl:call-template name="generate.id"/>
+            </xsl:with-param>
+            <xsl:with-param name="text" select="''"/>
+          </xsl:call-template>
+        </term>
+        <listitem>
+          <xsl:apply-templates
+            select="purpose/*|purpose/text()|
+                    description/*|description/text()"
+            mode="annotation"/>
+        </listitem>
+      </varlistentry>
+    </xsl:if>
+  </xsl:template>
+
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/utility.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/utility.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+  <!-- Indent the current line-->
+  <xsl:template name="indent">
+    <xsl:param name="indentation"/>
+    <xsl:if test="$indentation > 0">
+      <xsl:text> </xsl:text>
+      <xsl:call-template name="indent">
+        <xsl:with-param name="indentation" select="$indentation - 1"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+</xsl:stylesheet>
Added: sandbox/doc_test/xsl_test/xhtml.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/xhtml.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"
+                version="1.0">
+
+  <!-- Import the HTML chunking stylesheet -->
+  <xsl:import
+    href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
+  <xsl:import
+    href="http://docbook.sourceforge.net/release/xsl/current/xhtml/math.xsl"/>
+
+  <xsl:import href="chunk-common.xsl"/>
+  <xsl:import href="docbook-layout.xsl"/>
+  <xsl:import href="admon.xsl"/>
+  <xsl:import href="xref.xsl"/>
+  <xsl:import href="relative-href.xsl"/>
+  <xsl:import href="callout.xsl"/>
+
+  <xsl:param name="admon.style"/>
+  <xsl:param name="admon.graphics">1</xsl:param>
+  <xsl:param name="html.stylesheet" select="'boostbook.css'"/>
+  <xsl:param name="navig.graphics" select="1"/>
+  <xsl:param name="navig.graphics.extension" select="'.png'"/>
+  <xsl:param name="chapter.autolabel" select="1"/>
+  <xsl:param name="use.id.as.filename" select="1"/>
+  <xsl:param name="refentry.generate.name" select="0"/>
+  <xsl:param name="refentry.generate.title" select="1"/>
+  <xsl:param name="make.year.ranges" select="1"/>
+  <xsl:param name="generate.manifest" select="1"/>
+  <xsl:param name="generate.section.toc.level" select="3"/>
+  <xsl:param name="doc.standalone">false</xsl:param>
+  <xsl:param name="chunker.output.indent">yes</xsl:param>
+  <xsl:param name="toc.max.depth">2</xsl:param>
+  <xsl:param name="callout.graphics.number.limit">15</xsl:param>
+  <xsl:param name = "admon.graphics.path"
+            select = "concat($boost.root, '/doc/html/images/')"/>
+  <xsl:param name = "navig.graphics.path"
+            select = "concat($boost.root, '/doc/html/images/')"/>
+
+
+   <xsl:param name="admon.style">
+    <!-- Remove the style. Let the CSS do the styling -->
+</xsl:param>
+
+<!-- Always have graphics -->
+<xsl:param name="admon.graphics" select="1"/>
+
+  <xsl:param name="generate.toc">
+appendix  toc,title
+article/appendix  nop
+article   toc,title
+book      toc,title
+chapter   toc,title
+part      toc,title
+preface   toc,title
+qandadiv  toc
+qandaset  toc
+reference toc,title
+sect1     toc
+sect2     toc
+sect3     toc
+sect4     toc
+sect5     toc
+section   toc
+set       toc,title
+  </xsl:param>
+
+
+
+  <!-- We don't want refentry's to show up in the TOC because they
+       will merely be redundant with the synopsis. -->
+  <xsl:template match="refentry" mode="toc"/>
+
+  <!-- override the behaviour of some DocBook elements for better
+       rendering facilities -->
+
+  <xsl:template match = "programlisting[ancestor::informaltable]">
+     <pre class = "table-{name(.)}"><xsl:apply-templates/></pre>
+  </xsl:template>
+
+  <xsl:template match = "refsynopsisdiv">
+     <h2 class = "{name(.)}-title">Synopsis</h2>
+     <div class = "{name(.)}">
+        <xsl:apply-templates/>
+     </div>
+  </xsl:template>
+
+<!-- ============================================================ -->
+
+<xsl:template name="output.html.stylesheets">
+    <xsl:param name="stylesheets" select="''"/>
+
+    <xsl:choose>
+        <xsl:when test="contains($stylesheets, ' ')">
+            <link rel="stylesheet">
+                <xsl:attribute name="href">
+                    <xsl:call-template name="href.target.relative">
+                        <xsl:with-param name="target" select="substring-before($stylesheets, ' ')"/>
+                    </xsl:call-template>
+                </xsl:attribute>
+                <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">
+                <xsl:attribute name="href">
+                    <xsl:call-template name="href.target.relative">
+                        <xsl:with-param name="target" select="$stylesheets"/>
+                    </xsl:call-template>
+                </xsl:attribute>
+                <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:stylesheet>
+
Added: sandbox/doc_test/xsl_test/xref.xsl
==============================================================================
--- (empty file)
+++ sandbox/doc_test/xsl_test/xref.xsl	2007-06-14 20:53:50 EDT (Thu, 14 Jun 2007)
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+  
+   Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+   http://www.boost.org/LICENSE_1_0.txt)
+  -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:suwl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks"
+                exclude-result-prefixes="suwl"
+                version="1.0">
+
+<!-- Import the HTML chunking stylesheet -->
+<!-- needed? 
+<xsl:import
+    href="http://docbook.sourceforge.net/release/xsl/current/html/xref.xsl"/>
+-->
+
+<xsl:template name="adjust-url">
+    <xsl:param name="target"/>
+    <xsl:param name="context" select="."/>
+
+    <xsl:choose>
+        <xsl:when test="contains($target, ':')">
+          <xsl:value-of select="$target"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="href.target.relative">
+            <xsl:with-param name="target" select="$target"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+    </xsl:choose>
+
+</xsl:template>
+
+
+<xsl:template match="ulink" name="ulink">
+  <xsl:variable name="link">
+    <a>
+      <xsl:if test="@id">
+        <xsl:attribute name="name">
+          <xsl:value-of select="@id"/>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:attribute name="href">
+        <xsl:call-template name="adjust-url">
+          <xsl:with-param name="target" select="@url"/>
+        </xsl:call-template>
+      </xsl:attribute>
+      <xsl:if test="$ulink.target != ''">
+        <xsl:attribute name="target">
+          <xsl:value-of select="$ulink.target"/>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:choose>
+        <xsl:when test="count(child::node())=0">
+          <xsl:value-of select="@url"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </a>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="function-available('suwl:unwrapLinks')">
+      <xsl:copy-of select="suwl:unwrapLinks($link)"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy-of select="$link"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+
+</xsl:stylesheet>