]> granicus.if.org Git - docbook-dsssl/commitdiff
Stylesheets converted through xmlns-build tool and adjusted to add namespace prefix...
authorrankoo <rankoo>
Mon, 16 Aug 2010 17:54:54 +0000 (17:54 +0000)
committerrankoo <rankoo>
Mon, 16 Aug 2010 17:54:54 +0000 (17:54 +0000)
25 files changed:
docbook/relaxng/api/src/api.rnc
xsl/api/annotation.xsl [new file with mode: 0644]
xsl/api/chunk-common.xsl
xsl/api/docbook.xsl [new file with mode: 0644]
xsl/api/dtd/dtd2boostbook.xsl [new file with mode: 0644]
xsl/api/error.xsl [new file with mode: 0644]
xsl/api/fo.xsl [new file with mode: 0644]
xsl/api/function.xsl [new file with mode: 0644]
xsl/api/global.xsl [new file with mode: 0644]
xsl/api/html-help.xsl [new file with mode: 0644]
xsl/api/html-single.xsl [new file with mode: 0644]
xsl/api/index.xsl [new file with mode: 0644]
xsl/api/library.xsl [new file with mode: 0644]
xsl/api/lookup.xsl [new file with mode: 0644]
xsl/api/macro.xsl [new file with mode: 0644]
xsl/api/manpages.xsl [new file with mode: 0644]
xsl/api/reference.xsl [new file with mode: 0644]
xsl/api/source-highlight.xsl [new file with mode: 0644]
xsl/api/template.xsl [new file with mode: 0644]
xsl/api/testing/Jamfile.xsl [new file with mode: 0644]
xsl/api/testing/testsuite.xsl [new file with mode: 0644]
xsl/api/type.xsl [new file with mode: 0644]
xsl/api/utility.xsl [new file with mode: 0644]
xsl/api/xhtml.xsl [new file with mode: 0644]
xsl/api/xref.xsl

index 2851e35e4bacf0241d0edafb7de2101a93085685..bf03f5771701c432320132c23f7a79bad3aede82 100644 (file)
@@ -1,6 +1,6 @@
 default namespace = "http://docbook.org/ns/docbook"
 # ========== Import DocBook Grammar ==========
-include "../../../../../../../../docbook.rnc"
+include "http://docbook.org/xml/5.0/rng/docbook.rnc"
 start |= header | library | api | precondition
 local.common.attrib = attribute last-revision { text }?
 # ========== Define the API extensions ==========
diff --git a/xsl/api/annotation.xsl b/xsl/api/annotation.xsl
new file mode 100644 (file)
index 0000000..eed72f1
--- /dev/null
@@ -0,0 +1,439 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+version="1.0">
+  <xsl:variable name="uppercase-letters" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
+  <xsl:variable name="lowercase-letters" select="'abcdefghijklmnopqrstuvwxyz'"/>
+
+  <xsl:key name="classes" match="d:class|d:struct|d:union|d:typedef" use="@name"/>
+  <xsl:key name="methods" match="d:method|d:overloaded-method" use="@name"/>
+  <xsl:key name="functions" match="d:function|d:overloaded-function" use="@name"/>
+  <xsl:key name="enums" match="d:enum" use="@name"/>
+  <xsl:key name="concepts" match="d:concept" use="@name"/>
+  <xsl:key name="libraries" match="d:library" use="@name"/>
+  <xsl:key name="macros" match="d:macro" use="@name"/>
+  <xsl:key name="headers" match="d:header" use="@name"/>
+  <xsl:key name="globals" match="d:namespace/d:data-member|d:header/d:data-member" use="@name"/>
+  <xsl:key name="named-entities" match="d:class|d:struct|d:union|d:concept|d:function|d:overloaded-function|d:macro|d:library|d:namespace/d:data-member|d:header/d:data-member|*[attribute::xml:id]" use="translate(@name|@id, $uppercase-letters, $lowercase-letters)"/>
+
+  <xsl:template match="d:function|d:overloaded-function" mode="generate.id">
+    <xsl:call-template name="fully-qualified-id">
+      <xsl:with-param name="node" select="."/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="d: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, '&lt;')">
+          <xsl:value-of select="substring-before($fullname, '&lt;')"/>
+        </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="d:globalname" mode="annotation">
+    <!-- Determine the (possibly qualified) global name we are looking for -->
+    <xsl:variable name="name">
+      <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>
+
+    <!-- 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="'data-member'"/>
+      <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('globals', $unqualified-name)"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="d: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="d: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="d: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="d: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="d: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="d:macroname" mode="annotation">
+    <xsl:param name="name">
+      <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:param>
+
+    <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="string(.)"/>
+        </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="d:headername" 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="string(.)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <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="string(.)"/>
+        </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="d:programlisting" mode="annotation">
+    <programlisting>
+      <xsl:apply-templates mode="annotation">
+        <xsl:with-param name="highlight" select="true()"/>
+      </xsl:apply-templates>
+    </programlisting>
+  </xsl:template>
+  
+  <xsl:template match="d:code" mode="annotation">
+    <computeroutput>
+      <xsl:apply-templates mode="annotation"/>
+    </computeroutput>
+  </xsl:template>
+
+  <xsl:template match="d:bold" mode="annotation">
+    <emphasis role="bold">
+      <xsl:apply-templates mode="annotation"/>
+    </emphasis>
+  </xsl:template>
+
+  <xsl:template match="d:description" mode="annotation">
+    <xsl:apply-templates mode="annotation"/>
+  </xsl:template>
+
+  <xsl:template match="d:type" mode="annotation">
+    <xsl:apply-templates mode="annotation"/>
+  </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="d:para|d: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>
index cad8cbc331d8102f77cf5a5d7b7aae75d3436e33..93b81f91710e26501467fc63a1c068100f6a005d 100644 (file)
@@ -111,7 +111,7 @@ version="1.0">
 </xsl:template>
 
 
-<xsl:template match="@url">
+<xsl:template match="@href">
     <xsl:choose>
         <xsl:when test="contains(., ':')">
             <xsl:value-of select="."/>
diff --git a/xsl/api/docbook.xsl b/xsl/api/docbook.xsl
new file mode 100644 (file)
index 0000000..3a7f715
--- /dev/null
@@ -0,0 +1,524 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+xmlns:xi="http://www.w3.org/2001/XInclude"
+                version="1.0">
+  <xsl:include href="reference.xsl"/>
+
+  <xsl:output method="xml"/>
+
+  <!-- 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="'../..'"/>
+
+  <!-- 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="''"/>
+
+  <!-- Whether to rewrite relative URL's to point to the website -->
+  <xsl:param name="boost.url.prefix"/>
+
+  <!-- A space-separated list of xml elements in the input file for which
+       whitespace should be preserved -->
+  <xsl:preserve-space elements="*"/>
+
+  <!-- The root for boost headers -->
+  <xsl:param name="boost.header.root">
+    <xsl:if test="$boost.url.prefix">
+      <xsl:value-of select="$boost.url.prefix"/>
+      <xsl:text>/</xsl:text>
+    </xsl:if>
+    <xsl:value-of select="$boost.root"/>
+  </xsl:param>
+
+  <!-- The prefix for 'boost:' links. -->
+  <xsl:variable name="boost.protocol.text">
+    <xsl:if test="($boost.url.prefix != '') and (contains($boost.root, '://') = 0)">
+      <xsl:value-of select="concat($boost.url.prefix, '/', $boost.root)"/>
+    </xsl:if>
+    <xsl:if test="($boost.url.prefix = '') or contains($boost.root, '://')">
+      <xsl:value-of select="$boost.root"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:template match="d:library-reference">
+    <xsl:choose>
+      <xsl:when test="ancestor::d: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::d:library/attribute::xml:id">
+              <xsl:attribute name="id">
+                <xsl:value-of select="ancestor::d:library/attribute::xml:id"/>
+                <xsl:text>.reference</xsl:text>
+              </xsl:attribute>
+            </xsl:when>
+          </xsl:choose>
+          <xsl:if test="not(d:title)">
+            <title>
+              <xsl:text>Reference</xsl:text>
+            </title>
+          </xsl:if>
+
+          <xsl:if test="d: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::d:library/attribute::xml:id">
+                  <xsl:attribute name="id">
+                    <xsl:value-of select="ancestor::d:library/attribute::xml:id"/>
+                    <xsl:text>.concepts</xsl:text>
+                  </xsl:attribute>
+                </xsl:when>
+              </xsl:choose>
+
+              <title>Concepts</title>
+
+              <itemizedlist>
+                <xsl:for-each select="d:concept">
+                  <listitem><simpara>
+                    <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>
+                  </simpara></listitem>
+                </xsl:for-each>
+              </itemizedlist>
+            </section>
+          </xsl:if>
+
+          <xsl:apply-templates/>
+        </section>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="d:header">
+    <xsl:if test="*">
+      <section>
+        <xsl:attribute name="id">
+          <xsl:call-template name="generate.id"/>
+        </xsl:attribute>
+
+        <title>
+          <xsl:text>Header &lt;</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>&gt;</xsl:text>
+        </title>
+
+        <xsl:apply-templates select="d:para|d:section" mode="annotation"/>
+
+        <xsl:if test="d:macro">
+          <xsl:call-template name="synopsis">
+            <xsl:with-param name="text">
+              <xsl:apply-templates mode="synopsis" select="d:macro">
+                <xsl:with-param name="indentation" select="0"/>
+              </xsl:apply-templates>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+
+        <xsl:if test="descendant::d:class|descendant::d:struct|descendant::d:union
+                     |descendant::d:function|descendant::d:free-function-group
+                     |descendant::d:overloaded-function|descendant::d:enum
+                     |descendant::d:typedef">
+          <xsl:call-template name="synopsis">
+            <xsl:with-param name="text">
+              <xsl:apply-templates mode="synopsis"
+                select="d:namespace|d:class|d:struct|d:union
+                       |d:function|d:free-function-group
+                       |d:overloaded-function|d:enum
+                       |d: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="d: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>
+
+  <xsl:template name="monospaced">
+    <xsl:param name="text"/>
+    <computeroutput><xsl:value-of select="$text"/></computeroutput>
+  </xsl:template>
+
+  <!-- Linking -->
+  <xsl:template match="d:link">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:attribute name="href">
+        <xsl:choose>
+          <xsl:when test="starts-with(@href, 'boost:/')">
+            <xsl:value-of select="concat($boost.protocol.text, substring-after(@href, 'boost:'))"/>
+          </xsl:when>
+          <xsl:when test="starts-with(@href, 'boost:')">
+            <xsl:value-of select="concat($boost.protocol.text, '/', substring-after(@href, 'boost:'))"/>
+          </xsl:when>
+          <xsl:when test="$boost.url.prefix != '' and not(contains(@href, ':') or starts-with(@href, '//'))">
+            <xsl:value-of select="concat($boost.url.prefix, '/', @href)"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="@href"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+      <xsl:apply-templates/>
+    </xsl:copy>
+  </xsl:template>
+  <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="purpose" 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="d:code">
+    <computeroutput>
+      <xsl:apply-templates mode="annotation"/>
+    </computeroutput>
+  </xsl:template>
+
+  <xsl:template match="d:bold">
+    <emphasis role="bold">
+      <xsl:apply-templates mode="annotation"/>
+    </emphasis>
+  </xsl:template>
+
+  <xsl:template match="d:library">
+    <xsl:if test="not(@html-only = 1) and
+                  ($boost.include.libraries='' or
+                   contains($boost.include.libraries, @id))">
+      <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="d: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="d:api">
+    <book><xsl:apply-templates/></book>
+  </xsl:template>
+
+  <xsl:template match="d:programlisting">
+    <programlisting><xsl:apply-templates/></programlisting>
+  </xsl:template>
+
+  <!-- These DocBook elements have special meaning. Use the annotation mode -->
+  <xsl:template match="d:classname|d:methodname|d:functionname|d:enumname|
+                       d:macroname|d:headername|d:globalname">
+    <computeroutput>
+      <xsl:apply-templates select="." mode="annotation"/>
+    </computeroutput>
+  </xsl:template>
+
+  <xsl:template match="d:libraryname|d:conceptname">
+    <xsl:apply-templates select="." mode="annotation"/>
+  </xsl:template>
+
+  <xsl:template match="d:description">
+    <xsl:apply-templates mode="annotation"/>
+  </xsl:template>
+
+  <!-- Swallow using-namespace and using-class directives along with
+       last-revised elements -->
+  <xsl:template match="d:using-namespace|d:using-class|d: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="d:part/d:part|d:part/d: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="d:part/d:part/d:partinfo|d:part/d:article/d:articleinfo">
+    <chapterinfo><xsl:apply-templates/></chapterinfo>
+  </xsl:template>
+  <xsl:template match="d:part/d:part/d:chapter|d:part/d:part/d:appendix">
+    <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="d:part/d:part/d:chapter/d:chapterinfo|d:part/d:part/d:appendix/d:appendixinfo">
+    <sectioninfo><xsl:apply-templates/></sectioninfo>
+  </xsl:template>
+
+  <!-- Header link comment to be inserted at the start of a reference page's
+       synopsis -->
+  <xsl:template name="header-link">
+    <xsl:if test="ancestor::d:header">
+      <xsl:call-template name="highlight-comment">
+        <xsl:with-param name="text">
+          <xsl:text>// In header: &lt;</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="ancestor::d:header[1]"/>
+              </xsl:call-template>
+            </xsl:with-param>
+            <xsl:with-param name="text" select="ancestor::d:header[1]/@name" />
+          </xsl:call-template>
+          <xsl:text>&gt;&#10;&#10;</xsl:text>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+</xsl:stylesheet>
+
diff --git a/xsl/api/dtd/dtd2boostbook.xsl b/xsl/api/dtd/dtd2boostbook.xsl
new file mode 100644 (file)
index 0000000..fd2cfd1
--- /dev/null
@@ -0,0 +1,219 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+version="1.0">
+
+  <xsl:output method="xml" indent="yes" standalone="yes"/>
+
+  <xsl:strip-space elements="sequence-group or-group d:element element-name"/>
+
+  <xsl:key name="elements" match="d:element" use="@name"/>
+  <xsl:key name="attributes" match="d:attlist" use="@name"/>
+  <xsl:key name="attribute-purposes" match="d:attpurpose" use="@name"/>
+
+  <xsl:template match="d:dtd">
+    <section id="reference">
+      <title>Reference</title>
+      <para>
+        <xsl:text>Elements:</xsl:text>
+        <itemizedlist spacing="compact">
+          <xsl:apply-templates select="d:element" mode="synopsis">
+            <xsl:sort select="@name"/>
+          </xsl:apply-templates>
+        </itemizedlist>
+      </para>
+      <xsl:apply-templates select="d:element"/>
+    </section>
+  </xsl:template>
+
+  <!-- Element synopsis -->
+  <xsl:template match="d:element" mode="synopsis">
+    <listitem>
+      <simpara>
+        <link>
+          <xsl:attribute name="linkend">
+            <xsl:value-of select="concat('boostbook.dtd.',@name)"/>
+          </xsl:attribute>
+          <xsl:text>Element </xsl:text>
+          <sgmltag><xsl:value-of select="@name"/></sgmltag>
+          <xsl:text> - </xsl:text>
+          <xsl:apply-templates select="d:purpose"/>
+        </link>
+      </simpara>
+    </listitem>
+  </xsl:template>
+
+  <!-- Elements are transformed into DocBook refentry elements -->
+  <xsl:template match="d:element">
+    <refentry>
+      <xsl:attribute name="id">
+        <xsl:value-of select="concat('boostbook.dtd.',@name)"/>
+      </xsl:attribute>
+
+      <refmeta>
+        <refentrytitle>
+          BoostBook element <sgmltag><xsl:value-of select="@name"/></sgmltag>
+        </refentrytitle>
+        <manvolnum>9</manvolnum>
+      </refmeta>
+      <refnamediv>
+        <refname><xsl:value-of select="@name"/></refname>
+        <refpurpose><xsl:apply-templates select="d:purpose"/></refpurpose>
+      </refnamediv>
+      <refsynopsisdiv>
+        <xsl:value-of select="@name"/><xsl:text> ::= </xsl:text>
+        <xsl:apply-templates select="content-model-expanded"/>
+      </refsynopsisdiv>
+      <xsl:apply-templates select="d:description"/>
+      <xsl:apply-templates select="key('attributes', @name)"/>
+    </refentry>
+  </xsl:template>
+
+  <xsl:template match="content-model-expanded">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <!-- Sequences -->
+  <xsl:template match="sequence-group">
+    <xsl:param name="separator" select="''"/>
+
+    <xsl:if test="preceding-sibling::*">
+      <xsl:value-of select="$separator"/>
+    </xsl:if>
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates>
+      <xsl:with-param name="separator" select="', '"/>
+    </xsl:apply-templates>
+    <xsl:text>)</xsl:text>
+    <xsl:value-of select="@occurrence"/>
+  </xsl:template>
+
+  <!-- Alternatives -->
+  <xsl:template match="or-group">
+    <xsl:param name="separator" select="''"/>
+
+    <xsl:if test="preceding-sibling::*">
+      <xsl:value-of select="$separator"/>
+    </xsl:if>
+    <xsl:text>(</xsl:text>
+    <xsl:apply-templates>
+      <xsl:with-param name="separator" select="'| '"/>
+    </xsl:apply-templates>
+    <xsl:text>)</xsl:text>
+    <xsl:value-of select="@occurrence"/>
+  </xsl:template>
+
+  <!-- Element references -->
+  <xsl:template match="element-name">
+    <xsl:param name="separator" select="''"/>
+
+    <xsl:if test="preceding-sibling::*">
+      <xsl:value-of select="$separator"/>
+    </xsl:if>
+
+    <xsl:variable name="element-node" select="key('elements', @name)"/>
+
+    <xsl:choose>
+      <xsl:when test="$element-node">
+        <link>
+          <xsl:attribute name="linkend">
+            <xsl:value-of select="concat('boostbook.dtd.',@name)"/>
+          </xsl:attribute>
+          <xsl:value-of select="@name"/>
+        </link>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="@name"/>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:value-of select="@occurrence"/>
+  </xsl:template>
+
+  <!-- #PCDATA -->
+  <xsl:template match="d:pcdata">
+    <xsl:param name="separator" select="''"/>
+
+    <xsl:if test="preceding-sibling::*">
+      <xsl:value-of select="$separator"/>
+    </xsl:if>
+
+    <xsl:text>#PCDATA</xsl:text>
+  </xsl:template>
+
+  <!-- ANY -->
+  <xsl:template match="d:any">
+    <xsl:text>ANY</xsl:text>
+  </xsl:template>
+
+  <!-- EMPTY -->
+  <xsl:template match="d:empty">
+    <xsl:text>EMPTY</xsl:text>
+  </xsl:template>
+
+  <!-- Just copy anything in a purpose element -->
+  <xsl:template match="d:purpose">
+    <xsl:copy-of select="text()|*"/>
+  </xsl:template>
+
+  <!-- Just copy anything in a description element, but place it in a
+       section. -->
+  <xsl:template match="d:description">
+    <refsection>
+      <title>Description</title>
+      <xsl:copy-of select="text()|*"/>
+    </refsection>
+  </xsl:template>
+
+  <!-- Attributes -->
+  <xsl:template match="d:attlist">
+    <refsection>
+      <title>Attributes</title>
+      
+      <informaltable>
+        <tgroup cols="4">
+          <thead>
+            <row>
+              <entry>Name</entry>
+              <entry>Type</entry>
+              <entry>Value</entry>
+              <entry>Purpose</entry>
+            </row>
+          </thead>
+          <tbody>
+            <xsl:apply-templates/>
+          </tbody>
+        </tgroup>
+      </informaltable>
+    </refsection>
+  </xsl:template>
+
+  <!-- Attribute -->
+  <xsl:template match="d:attribute">
+    <row>
+      <entry><xsl:value-of select="@name"/></entry>
+      <entry><xsl:value-of select="@type"/></entry>
+      <entry><xsl:value-of select="@value"/></entry>
+      <entry>
+        <xsl:choose>
+          <xsl:when test="d:purpose">
+            <xsl:apply-templates select="d:purpose"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="key('attribute-purposes', @name)"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </entry>
+    </row>
+  </xsl:template>
+
+  <!-- Eat attribute declarations -->
+  <xsl:template match="d:attdecl"/>
+</xsl:stylesheet>
diff --git a/xsl/api/error.xsl b/xsl/api/error.xsl
new file mode 100644 (file)
index 0000000..d9cfda8
--- /dev/null
@@ -0,0 +1,21 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+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>
diff --git a/xsl/api/fo.xsl b/xsl/api/fo.xsl
new file mode 100644 (file)
index 0000000..93a37f2
--- /dev/null
@@ -0,0 +1,307 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+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="fop1.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="d: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="d: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="//d:phrase[@role='keyword' and
+                     (ancestor::d:programlisting or
+                      ancestor::d:synopsis or
+                      ancestor::d:literallayout)]">
+  <fo:inline color="#0000AA"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="//d:phrase[@role='special' and
+                     (ancestor::d:programlisting or
+                      ancestor::d:synopsis or
+                      ancestor::d:literallayout)]">
+  <fo:inline color="#707070"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="//d:phrase[@role='preprocessor' and
+                     (ancestor::d:programlisting or
+                      ancestor::d:synopsis or
+                      ancestor::d:literallayout)]">
+  <fo:inline color="#402080"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="//d:phrase[@role='char' and
+                     (ancestor::d:programlisting or
+                      ancestor::d:synopsis or
+                      ancestor::d:literallayout)]">
+  <fo:inline color="teal"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="//d:phrase[@role='comment' and
+                     (ancestor::d:programlisting or
+                      ancestor::d:synopsis or
+                      ancestor::d:literallayout)]">
+  <fo:inline color="#800000"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="//d:phrase[@role='string' and
+                     (ancestor::d:programlisting or
+                      ancestor::d:synopsis or
+                      ancestor::d:literallayout)]">
+  <fo:inline color="teal"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="//d:phrase[@role='number' and
+                     (ancestor::d:programlisting or
+                      ancestor::d:synopsis or
+                      ancestor::d:literallayout)]">
+  <fo:inline color="teal"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="//d:phrase[@role='white_bkd' and
+                     (ancestor::d:programlisting or
+                      ancestor::d:synopsis or
+                      ancestor::d:literallayout)]">
+  <fo:inline color="#FFFFFF"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+<xsl:template match="//d:phrase[@role='dk_grey_bkd' and
+                     (ancestor::d:programlisting or
+                      ancestor::d:synopsis or
+                      ancestor::d:literallayout)]">
+  <fo:inline color="#999999"><xsl:apply-templates/></fo:inline>
+</xsl:template>
+
+<!--
+Make all hyperlinks blue colored:
+-->
+<xsl:attribute-set name="xref.properties">
+  <xsl:attribute name="color">blue</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">#FF8080</xsl:attribute>
+  <xsl:attribute name="border-width">1px</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.within-page">1</xsl:attribute>
+  <xsl:attribute name="margin-left">0pt</xsl:attribute>
+  <xsl:attribute name="margin-right">0pt</xsl:attribute>
+</xsl:attribute-set>
+
+<!--
+Put a box around code blocks, also set the font size
+and keep the block together if we can using the widows 
+and orphans controls.  Hyphenation and line wrapping
+is also turned on, so that long lines of code don't
+bleed off the edge of the page, a carriage return
+symbol is used as the hyphenation character:
+-->
+<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-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="widows">6</xsl:attribute>
+  <xsl:attribute name="orphans">40</xsl:attribute>
+  <xsl:attribute name="font-size">9pt</xsl:attribute>
+  <xsl:attribute name="hyphenate">true</xsl:attribute>
+  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
+  <xsl:attribute name="hyphenation-character">&#x21B5;</xsl:attribute>
+  <xsl:attribute name="margin-left">0pt</xsl:attribute>
+  <xsl:attribute name="margin-right">0pt</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:param name="hyphenate.verbatim" select="1"></xsl:param>
+<xsl:param name="monospace.font.family">monospace,Symbol</xsl:param>
+
+  <!--Regular monospace text should have the same font size as code blocks etc-->
+<xsl:attribute-set name="monospace.properties">
+  <xsl:attribute name="font-size">9pt</xsl:attribute>
+</xsl:attribute-set>
+  
+<!-- 
+Put some small amount of padding around table cells, and keep tables
+together on one page if possible:
+-->
+<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>
+
+  <!--Formal and informal tables have the same properties
+      Using widow-and-orphan control here gives much better
+      results for very large tables than a simple "keep-together"
+      instruction-->
+<xsl:attribute-set name="table.properties">
+  <xsl:attribute name="keep-together.within-page">1</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="informaltable.properties">
+  <xsl:attribute name="keep-together.within-page">1</xsl:attribute>
+</xsl:attribute-set>
+
+<!--
+General default options go here:
+* Borders are mid-grey.
+* Body text is not indented compared to the titles.
+* Page margins are a rather small 0.5in, but we need
+  all the space we can get for code blocks.
+* Paper size is A4: an ISO standard, and just slightly smaller than US Letter.
+* Use SVG graphics for admonishments: the bitmaps look awful in PDF's.
+* Disable draft mode so we're not constantly trying to download the necessary graphic.
+* Set default image paths to pull down direct from SVN: individual Jamfiles can override this
+  and pass an absolute path to local versions of the images, but we can't get that here, so
+  we'll use SVN instead so that most things "just work".
+-->
+<xsl:param name="table.frame.border.color">#DCDCDC</xsl:param>
+<xsl:param name="table.cell.border.color">#DCDCDC</xsl:param>
+<xsl:param name="body.start.indent">0pt</xsl:param>
+<xsl:param name="page.margin.inner">0.5in</xsl:param>
+<xsl:param name="page.margin.outer">0.5in</xsl:param>
+<xsl:param name="paper.type">A4</xsl:param>
+<xsl:param name="admon.graphics">1</xsl:param>
+<xsl:param name="admon.graphics.extension">.svg</xsl:param>
+<xsl:param name="draft.mode">no</xsl:param>
+<xsl:param name="admon.graphics.path">http://svn.boost.org/svn/boost/trunk/doc/src/images/</xsl:param>
+<xsl:param name="callout.graphics.path">http://svn.boost.org/svn/boost/trunk/doc/src/images/callouts/</xsl:param>
+<xsl:param name="img.src.path">http://svn.boost.org/svn/boost/trunk/doc/html/</xsl:param>
+
+<!-- Ideally we would use this to force top level sections
+     to start on a new page, unfortunately this causes rather
+     unfortunate page breaks in some Doxygen-generated
+     documentation which uses <refentry> and <synopsis>
+     sections :-(
+
+<xsl:attribute-set name="section.level1.properties">
+  <xsl:attribute name="break-before">page</xsl:attribute>
+</xsl:attribute-set>
+
+-->
+  
+</xsl:stylesheet>
+
diff --git a/xsl/api/function.xsl b/xsl/api/function.xsl
new file mode 100644 (file)
index 0000000..b2374d3
--- /dev/null
@@ -0,0 +1,1186 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+version="1.0">
+
+  <xsl:strip-space elements="d:requires d:effects d:postconditions d:returns d:throws
+                             d:complexity d:notes d:rationale d: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(d:type)">
+          <xsl:value-of select="concat($copy-assign-for, '&amp; ')"/>
+        </xsl:when>
+
+        <xsl:otherwise>
+          <xsl:apply-templates select="d: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="d: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() &gt; 1))
+                  or $suppress-template">
+      <xsl:text>&#10;</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 and @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 &gt; 0) and
+                      ($end-column &gt; $max-columns)">
+        <!-- Emit template header on its own line -->
+        <xsl:apply-templates select="d: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 &gt; $max-columns)">
+        <!-- Emit template header, if not suppressed -->
+        <xsl:if test="not($suppress-template)">
+          <xsl:apply-templates select="d: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(d:type)">
+            <xsl:value-of select="concat($copy-assign-for, '&amp; ')"/>
+          </xsl:when>
+
+          <xsl:otherwise>
+            <xsl:apply-templates select="d: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:call-template name="highlight-text">
+          <xsl:with-param name="text" select="'('"/>
+        </xsl:call-template>
+        <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:call-template name="highlight-text">
+          <xsl:with-param name="text" select="')'"/>
+        </xsl:call-template>
+
+        <xsl:call-template name="source-highlight">
+          <xsl:with-param name="text" select="$postdeclarator"/>
+        </xsl:call-template>
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="';'"/>
+        </xsl:call-template>
+      </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(d:type)">
+            <xsl:value-of select="concat($copy-assign-for, '&amp; ')"/>
+          </xsl:when>
+
+          <xsl:otherwise>
+            <xsl:apply-templates select="d:type" mode="highlight"/>
+            <xsl:text> </xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+
+        <xsl:if test="string-length($type) &gt; $boost.short.result.type">
+          <xsl:text>&#10;</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) &gt; $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:call-template name="highlight-text">
+          <xsl:with-param name="text" select="'('"/>
+        </xsl:call-template>
+        <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:call-template name="highlight-text">
+          <xsl:with-param name="text" select="')'"/>
+        </xsl:call-template>
+        <xsl:call-template name="source-highlight">
+          <xsl:with-param name="text" select="$postdeclarator"/>
+        </xsl:call-template>
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="';'"/>
+        </xsl:call-template>
+      </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="d: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="pack">
+        <xsl:if test="$parameter/@pack=1">
+          <xsl:choose>
+            <xsl:when test="$final">
+              <xsl:call-template name="highlight-text">
+                <xsl:with-param name="text" select="'...'"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>...</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:if>
+      </xsl:variable>
+      <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/d:paramtype)"/>
+
+      <xsl:variable name="default">
+        <xsl:choose>
+          <xsl:when test="$parameter/@default">
+            <xsl:choose>
+              <xsl:when test="$final">
+                <xsl:call-template name="highlight-text">
+                  <xsl:with-param name="text" select="concat(' = ', $parameter/@default)"/>
+                </xsl:call-template>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:text> = </xsl:text>
+                <xsl:value-of select="$parameter/@default"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+          <xsl:when test="$parameter/d:default">
+            <xsl:choose>
+              <xsl:when test="$final">
+                <xsl:call-template name="highlight-text">
+                  <xsl:with-param name="text" select="' = '"/>
+                </xsl:call-template>
+                <xsl:apply-templates
+                  select="$parameter/d:default/*|$parameter/d:default/text()"
+                  mode="annotation">
+                  <xsl:with-param name="highlight" select="true()"/>
+                </xsl:apply-templates>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:text> = </xsl:text>
+                <xsl:value-of select="string($parameter/d:default)"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+        </xsl:choose>
+      </xsl:variable>
+
+      <xsl:variable name="text" select="concat($type, $pack, $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 &lt; $max-columns)
+                        or not($wrap)">
+          <xsl:choose>
+            <xsl:when test="$final">
+              <xsl:call-template name="highlight-text">
+                <xsl:with-param name="text" select="$prefix"/>
+              </xsl:call-template>
+              <xsl:apply-templates
+                select="$parameter/d:paramtype/*|$parameter/d:paramtype/text()"
+                mode="annotation">
+                <xsl:with-param name="highlight" select="true()"/>
+              </xsl:apply-templates>
+              <xsl:copy-of select="$pack"/>
+              <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:choose>
+            <xsl:when test="$final">
+              <xsl:call-template name="highlight-text">
+                <xsl:with-param name="text" select="$prefix"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="$prefix"/>
+            </xsl:otherwise>
+          </xsl:choose>
+          <xsl:text>&#10;</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/d:paramtype/*|$parameter/d:paramtype/text()"
+                mode="annotation">
+                <xsl:with-param name="highlight" select="true()"/>
+              </xsl:apply-templates>
+              <xsl:copy-of select="$pack"/>
+              <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>
+
+          <!-- 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="d:function|d:method" mode="synopsis">
+    <xsl:param name="indentation"/>
+
+    <!-- True if we should compact this function -->
+    <xsl:variable name="compact"
+      select="not (d:para|d:description|d:requires|d:effects|d:postconditions|d:returns|
+                   d:throws|d:complexity|d:notes|d:rationale) and
+              ($boost.compact.function='1') and
+              not (local-name(.)='method')"/>
+
+    <xsl:choose>
+      <xsl:when test="$compact">
+        <xsl:if test="d:purpose">
+          <!-- Compact display outputs the purpose as a comment (if
+               there is one) and the entire function declaration. -->
+          <xsl:text>&#10;&#10;</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="d:purpose/*|d: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="d:overloaded-function|d: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 (d:para|d:description|d:requires|d:effects|d:postconditions|d:returns|
+                   d:throws|d:complexity|d:notes|d:rationale) and
+              ($boost.compact.function='1') and
+              not (local-name(.)='overloaded-method')"/>
+
+    <xsl:choose>
+      <xsl:when test="$compact">
+        <xsl:if test="d:purpose">
+          <!-- Compact display outputs the purpose as a comment (if
+               there is one) and the entire function declaration. -->
+          <xsl:text>&#10;</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="d:purpose" mode="annotation"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+
+        <xsl:for-each select="d: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="d: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="d: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="d:free-function-group" mode="header-synopsis">
+    <xsl:param name="class"/>
+    <xsl:param name="indentation"/>
+    <xsl:apply-templates select="d:function|d: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="d:constructor|copy-assignment|d:destructor">
+      <xsl:if test="d:typedef|static-constant">
+        <xsl:text>&#10;</xsl:text>
+      </xsl:if>
+      <xsl:text>&#10;</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: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>
+        </xsl:with-param>
+      </xsl:call-template>
+      <xsl:apply-templates select="d:constructor" mode="synopsis">
+        <xsl:with-param name="indentation" select="$indentation"/>
+      </xsl:apply-templates>
+      <xsl:apply-templates select="d:copy-assignment" mode="synopsis">
+        <xsl:with-param name="indentation" select="$indentation"/>
+      </xsl:apply-templates>
+      <xsl:apply-templates select="d: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="d:constructor|d:copy-assignment|d: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">
+              <xsl:call-template name="object-name"/>
+            </xsl:with-param>
+          </xsl:call-template>
+          <xsl:text> </xsl:text>
+          <xsl:call-template name="access-name"/>
+          <xsl:text> construct/copy/destruct</xsl:text>
+        </xsl:with-param>
+        <xsl:with-param name="text">
+          <orderedlist>
+            <xsl:apply-templates select="d:constructor" mode="reference"/>
+            <xsl:apply-templates select="d:copy-assignment" mode="reference"/>
+            <xsl:apply-templates select="d:destructor" mode="reference"/>
+          </orderedlist>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="d: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">
+                  <xsl:call-template name="object-name"/>
+                </xsl:with-param>
+                <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="d: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">
+                  <xsl:call-template name="object-name"/>
+                </xsl:with-param>
+                <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="d: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">
+                  <xsl:call-template name="object-name"/>
+                </xsl:with-param>
+                <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) &gt; 0
+                      or count(ancestor::method-group) &gt; 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="d:purpose/*|d:purpose/text()"/>
+    </xsl:if>
+
+    <xsl:apply-templates select="d:description/*"/>
+
+    <xsl:if test="d:parameter/d:description|d:signature/d:parameter/d:description|
+                  d:requires|d:effects|d:postconditions|d:returns|d:throws|d:complexity|
+                  d:notes|d:rationale">
+      <variablelist spacing="compact">
+        <xsl:processing-instruction name="dbhtml">
+          list-presentation="table"
+        </xsl:processing-instruction>
+
+        <!-- Document parameters -->
+        <xsl:if test="d:parameter/d:description|d:signature/d:parameter/d:description">
+          <varlistentry>
+            <term>Parameters:</term>
+            <listitem>
+              <variablelist spacing="compact">
+                <xsl:processing-instruction name="dbhtml">
+                  list-presentation="table"
+                </xsl:processing-instruction>
+                <xsl:for-each select="d:parameter|d:signature/d:parameter">
+                             <xsl:sort select="attribute::d:name"/>
+                  <xsl:if test="d:description">
+                    <varlistentry>
+                      <term>
+                        <xsl:call-template name="monospaced">
+                          <xsl:with-param name="text" select="@name"/>
+                        </xsl:call-template>
+                      </term>
+                      <listitem>
+                        <xsl:apply-templates select="d:description/*"/>
+                      </listitem>
+                    </varlistentry>
+                  </xsl:if>
+                </xsl:for-each>
+              </variablelist>
+            </listitem>
+          </varlistentry>
+        </xsl:if>
+
+        <!-- Document rest of function's contract -->
+        <xsl:for-each select="d:requires|d:effects|d:postconditions|d:returns|d:throws|d:complexity|
+                      d:notes|d: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="d:para">
+      <xsl:message>
+        <xsl:text>Warning: Use of 'para' elements in a function is deprecated.&#10;</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="d: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="d:function|d:method" mode="reference">
+    <!-- True if we should compact this function -->
+    <xsl:variable name="compact"
+      select="not (d:para|d:description|d:requires|d:effects|d:postconditions|d:returns|
+                   d:throws|d:complexity|d:notes|d: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="d:function" mode="namespace-reference">
+    <!-- True if we should compact this function -->
+    <xsl:variable name="compact"
+      select="not (d:para|d:description|d:requires|d:effects|d:postconditions|d:returns|
+                   d:throws|d:complexity|d:notes|d: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="d: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="d:purpose/*|d: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="header-link"/>
+          <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="d:overloaded-function" mode="reference">
+    <xsl:variable name="name" select="@name"/>
+
+    <!-- True if we should compact this function -->
+    <xsl:variable name="compact"
+      select="not (d:para|d:description|d:requires|d:effects|d:postconditions|d:returns|
+                   d:throws|d:complexity|d:notes|d: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="d: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="d:overloaded-function" mode="namespace-reference">
+    <!-- True if we should compact this function -->
+    <xsl:variable name="compact"
+      select="not (d:para|d:description|d:requires|d:effects|d:postconditions|d:returns|
+                   d:throws|d:complexity|d:notes|d: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="d: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="d:purpose/*|d: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="header-link"/>
+          <xsl:for-each select="d: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="d:overloaded-method" mode="reference">
+    <xsl:variable name="name" select="@name"/>
+
+    <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="anchor">
+                <xsl:with-param name="to">
+                  <xsl:call-template name="generate.id"/>
+                </xsl:with-param>
+              </xsl:call-template>
+              <xsl:for-each select="d: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="d:method-group" mode="synopsis">
+    <xsl:param name="indentation"/>
+    <xsl:if test="count(child::*) &gt; 0">
+      <xsl:text>&#10;</xsl:text>
+      <xsl:text>&#10;</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: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>
+        </xsl:with-param>
+      </xsl:call-template>
+      <xsl:apply-templates select="d:method|d: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="d:method-group" mode="reference">
+    <xsl:if test="count(child::*) &gt; 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">
+              <xsl:call-template name="object-name"/>
+            </xsl:with-param>
+          </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="d:method|d: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="d:free-function-group" mode="synopsis">
+    <xsl:param name="class"/>
+    <xsl:param name="indentation"/>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:text>&#10;</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: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>
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:apply-templates select="d:function|d: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="d: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="d:function|d:overloaded-function"
+            mode="reference"/>
+        </orderedlist>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/xsl/api/global.xsl b/xsl/api/global.xsl
new file mode 100644 (file)
index 0000000..7a4faff
--- /dev/null
@@ -0,0 +1,82 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook"
+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() &gt; 1)">
+      <xsl:text>&#10;</xsl:text>
+    </xsl:if>
+    <xsl:text>&#10;</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="d:specialization" />
+      </xsl:with-param>
+      <xsl:with-param name="purpose" select="d:purpose/*|d: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="header-link"/>
+        <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="d: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="d:type/*|d:type/text()" mode="annotation">
+      <xsl:with-param name="highlight" select="true()"/>
+    </xsl:apply-templates>
+    <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:call-template name="highlight-text">
+      <xsl:with-param name="text" select="';'"/>
+    </xsl:call-template>
+  </xsl:template>
+  <xsl:template match="d:data-member" mode="generate.id">
+    <xsl:call-template name="fully-qualified-id">
+      <xsl:with-param name="node" select="."/>
+    </xsl:call-template>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/xsl/api/html-help.xsl b/xsl/api/html-help.xsl
new file mode 100644 (file)
index 0000000..d6b6930
--- /dev/null
@@ -0,0 +1,149 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+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/htmlhelp/htmlhelp.xsl"/>
+
+  <xsl:param name="admon.style"/>
+  <xsl:param name="admon.graphics">1</xsl:param>
+  <xsl:param name="boostbook.verbose" select="0"/>
+  <xsl:param name="html.stylesheet" select="'boostbook.css'"/>
+  <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="callout.graphics.number.limit">15</xsl:param>
+  <xsl:param name="draft.mode">no</xsl:param>
+  <xsl:param name="admon.graphics" select="1"/>
+
+  <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: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: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: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:variable>
+
+    <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
+                                 $time, ' ', $timezone)"/>
+  </xsl:template>
+
+  <!-- We don't want refentry's to show up in the TOC because they
+       will merely be redundant with the synopsis. -->
+  <xsl:template match="d:refentry" mode="toc"/>
+
+  <!-- override the behaviour of some DocBook elements for better
+       rendering facilities -->
+
+  <xsl:template match = "d:programlisting[ancestor::d:informaltable]">
+     <pre class = "table-{name(.)}"><xsl:apply-templates/></pre>
+  </xsl:template>
+
+  <xsl:template match = "d:refsynopsisdiv">
+     <h2 class = "{name(.)}-title">Synopsis</h2>
+     <div class = "{name(.)}">
+        <xsl:apply-templates/>
+     </div>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/api/html-single.xsl b/xsl/api/html-single.xsl
new file mode 100644 (file)
index 0000000..8c61368
--- /dev/null
@@ -0,0 +1,28 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+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:import href="relative-href.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>
diff --git a/xsl/api/index.xsl b/xsl/api/index.xsl
new file mode 100644 (file)
index 0000000..1d781de
--- /dev/null
@@ -0,0 +1,20 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+version="1.0">
+  <xsl:template match="class-index">
+    
+  </xsl:template>
+
+  <xsl:template match="function-index">
+    
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/xsl/api/library.xsl b/xsl/api/library.xsl
new file mode 100644 (file)
index 0000000..bffbb4f
--- /dev/null
@@ -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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+version="1.0">
+  <xsl:key name="library-categories" match="d:library" 
+    use="d:libraryinfo/d:librarycategory/@name"/>
+
+  <xsl:template match="d:librarylist">
+    <itemizedlist spacing="compact">
+      <xsl:apply-templates select="//d: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::d:name"/>
+
+    <xsl:choose>
+      <xsl:when test="$node/attribute::html-only = 1">
+        <xsl:variable name="url">
+          <xsl:choose>
+            <xsl:when test="$node/attribute::xlink:href">
+              <xsl:value-of select="$node/attribute::xlink:href"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="concat($boost.root,
+                                           '/libs/', 
+                                           $node/attribute::d: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::xml:id">
+                <xsl:value-of select="$node/attribute::xml: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="d:library" mode="build-library-list">
+    <listitem>
+      <simpara>
+        <xsl:call-template name="library.link"/>
+        <xsl:text> - </xsl:text>
+        <xsl:apply-templates select="d:libraryinfo/d:librarypurpose"
+          mode="build-library-list"/>
+      </simpara>
+    </listitem>
+  </xsl:template>
+
+  <xsl:template match="d:librarypurpose" mode="build-library-list">
+    <xsl:apply-templates/>
+    <xsl:text>, from </xsl:text>
+    <xsl:apply-templates select="../d:author" mode="display-author-list"/>
+  </xsl:template>
+
+  <xsl:template match="d:author" mode="display-author-list">
+    <xsl:if test="(position() &gt; 1) and (count(../d:author) &gt; 2)">
+      <xsl:text>, </xsl:text>
+    </xsl:if>
+    <xsl:if test="(position() = count(../d:author)) and (position() &gt; 1)">
+      <xsl:if test="position() &lt; 3">
+        <xsl:text> </xsl:text>
+      </xsl:if>
+      <xsl:text>and </xsl:text>
+    </xsl:if>
+    <xsl:apply-templates select="d:firstname/text()"/>
+    <xsl:text> </xsl:text>
+    <xsl:apply-templates select="d:surname/text()"/>
+    <xsl:if test="(position() = count(../d:author))">
+      <xsl:text>.</xsl:text>      
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="d:librarycategorylist">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="d: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="d:libraryinfo">
+    <chapterinfo>
+      <xsl:apply-templates select="d:author|d:authorgroup/d:author|d:copyright|d:legalnotice"/>
+    </chapterinfo>
+  </xsl:template>
+
+  <xsl:template match="d:librarypurpose|d:librarycategory"/>
+
+</xsl:stylesheet>
diff --git a/xsl/api/lookup.xsl b/xsl/api/lookup.xsl
new file mode 100644 (file)
index 0000000..1cd0439
--- /dev/null
@@ -0,0 +1,426 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+xmlns:exsl="http://exslt.org/common"
+                version="1.0">
+
+  <!-- Maximum length of directory and file names is 31 characters.
+       '.html' uses 5 characters.
+       31 - 5 = 26 -->
+  <xsl:param name="boost.max.id.part.length">26</xsl:param>
+
+  <!-- Generate an ID for the entity referenced -->
+  <xsl:template name="generate.id">
+    <xsl:param name="node" select="."/>
+    <xsl:apply-templates select="$node" mode="generate.id"/>
+  </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, '&gt;')">
+        <xsl:call-template name="strip-qualifiers-non-template">
+          <xsl:with-param name="name" select="substring-after($name, '&gt;')"/>
+        </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="'&lt;'"/>
+    <xsl:param name="close" select="'&gt;'"/>
+    <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 &gt; 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, '::'), '&lt;'))">
+        <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)) = '&gt;'">
+        <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 id of the given node -->
+  <xsl:template name="fully-qualified-id">
+    <xsl:param name="node"/>
+
+    <xsl:apply-templates select="$node" mode="fully-qualified-name">
+      <xsl:with-param name="is.id" select="true()"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <!-- Build the fully-qualified name of the given node -->
+  <xsl:template name="fully-qualified-name">
+    <xsl:param name="node"/>
+    <xsl:apply-templates select="$node" mode="fully-qualified-name"/>
+  </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="is.id" select="false()" />
+    <xsl:call-template name="build-fully-qualified-name">
+      <xsl:with-param name="is.id" select="$is.id"/>
+    </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="is.id" select="false()" />
+
+    <!-- Determine the set of ancestor namespaces -->
+    <xsl:variable name="ancestors"
+      select="ancestor::d:namespace|
+                  ancestor::d:class|ancestor::d:struct|ancestor::d:union|
+                  ancestor::d:class-specialization|ancestor::d:struct-specialization|ancestor::d:union-specialization"/>
+
+    <xsl:for-each select="$ancestors">
+      <xsl:apply-templates select="." mode="fast-print-id-part">
+        <xsl:with-param name="is.id" select="$is.id"/>
+      </xsl:apply-templates>
+      <xsl:choose>
+        <xsl:when test="$is.id"><xsl:text>.</xsl:text></xsl:when>
+        <xsl:otherwise><xsl:text>::</xsl:text></xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+    <xsl:apply-templates select="." mode="fast-print-id-part">
+      <xsl:with-param name="is.id" select="$is.id"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:variable name="elements-with-ids">
+    <xsl:apply-templates select="d:namespace|d:class|d:struct|d:union|d:class-specialization|d:struct-specialization|d:union-specialization"
+                         mode="preprocess-ids"/>
+  </xsl:variable>
+  
+  <xsl:variable name="fast-elements" select="exsl:node-set($elements-with-ids)"/>
+  
+  <xsl:template match="*" mode="preprocess-ids">
+    <element>
+      <xsl:attribute name="id">
+        <xsl:value-of select="generate-id()"/>
+      </xsl:attribute>
+      <xsl:attribute name="part-id">
+        <xsl:call-template name="print-id-part"/>
+      </xsl:attribute>
+    </element>
+  </xsl:template>
+  
+  <xsl:template name="print-id-part">
+    <xsl:apply-templates select="." mode="print-id-part"/>
+  </xsl:template>
+  
+  <xsl:template match="*" mode="fast-print-id-part">
+    <xsl:param name="is.id"/>
+    <xsl:choose>
+      <xsl:when test="not($is.id)">
+        <xsl:apply-templates select="." mode="print-name"/>
+      </xsl:when>
+      <xsl:when test="$fast-elements[@id=generate-id()]">
+        <xsl:value-of select="$fast-elements[@id=generate-id()]/@part-id"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="." mode="print-id-part">
+          <xsl:with-param name="is.id" select="$is.id"/>
+        </xsl:apply-templates>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <!-- Print the part of a fully qualified name for a single element -->
+  <xsl:template match="*" mode="print-id-part">
+    <xsl:param name="is.id"/>
+
+    <xsl:variable name="part">
+      <xsl:apply-templates select="." mode="print-name"/>
+    </xsl:variable>
+
+    <xsl:variable name="unique-name">
+      <xsl:apply-templates select="." mode="unique.name"/>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test=
+        "$is.id and (
+          string-length($part) &gt; $boost.max.id.part.length or
+          $unique-name = 0 or
+          translate($part, '.&lt;&gt;;\:*?&quot;| ', '') != $part
+        )">
+        <xsl:variable name="normalized" select="translate(normalize-space(translate($part, '.&lt;&gt;;\:*?&quot;|_', '            ')), ' ', '_')"/>
+        <xsl:value-of select =
+          "concat(
+            substring($normalized, 1, $boost.max.id.part.length - string-length(generate-id(.) - 1)),
+            concat('_', generate-id(.)))"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$part"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Override this if an id might not be unique -->
+  <xsl:template match="*" mode="unique.name">
+    <xsl:value-of select="1"/>
+  </xsl:template>
+
+  <xsl:template match="d:function|d:overloaded-function" mode="unique.name">
+    <xsl:value-of select="number(count(key('named-entities',
+        translate(@name, $uppercase-letters, $lowercase-letters))) = 1)"/>
+  </xsl:template>
+
+  <!-- Print the name of the current node -->
+  <xsl:template match="*" mode="print-name">
+    <xsl:value-of select="@name"/>
+  </xsl:template>
+
+  <xsl:template match="template-arg" mode="print-name">
+    <xsl:if test="position() &gt; 1">
+      <xsl:text>, </xsl:text>
+    </xsl:if>
+    <xsl:value-of select="text()"/>
+    <xsl:if test="@pack=1">
+      <xsl:text>...</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template
+      match="d:struct-specialization|d:class-specialization|d:union-specialization"
+      mode="print-name">
+    <xsl:value-of select="@name"/>
+    <xsl:text>&lt;</xsl:text>
+    <xsl:apply-templates select="d:specialization/d:template-arg" mode="print-name"/>
+    <xsl:text>&gt;</xsl:text>
+  </xsl:template>
+  
+  <xsl:template name="concat-directives">
+    <xsl:param name="directives"/>
+    <xsl:for-each select="$directives">
+      <xsl:apply-templates select="." mode="print-name"/>
+      <xsl:text>::</xsl:text>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="find-nodes-matching-name">
+    <!-- The name we are looking for -->
+    <xsl:param name="name"/>
+
+    <!-- The context in which this name occurs -->
+    <xsl:param name="context"/>
+
+    <!-- The node that we are checking against -->
+    <xsl:param name="nodes"/>
+
+    <!-- The set of using directives for this context node -->
+    <xsl:variable name="directives"
+      select="$context/ancestor::*/d:using-namespace |
+                  $context/ancestor::d:namespace |
+                  $context/ancestor::*/d:using-class |
+                  $context/ancestor::d:class |
+                  $context/ancestor::d:struct"/>
+
+    <xsl:variable name="directives-str">
+      <xsl:call-template name="concat-directives">
+        <xsl:with-param name="directives" select="$directives"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:apply-templates select="$nodes" mode="generate-cxx-links">
+      <xsl:with-param name="name" select="$name"/>
+      <xsl:with-param name="directives-str" select="$directives-str"/>
+    </xsl:apply-templates>
+  </xsl:template>
+  
+  <xsl:template match="*" mode="generate-cxx-links">
+    <xsl:param name="name"/>
+    <xsl:param name="directives-str"/>
+
+    <xsl:variable name="node-name">
+      <xsl:call-template name="fully-qualified-name">
+        <xsl:with-param name="node" select="."/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:variable name="leading-chars"
+                  select="string-length($node-name) - string-length($name)"/>
+
+    <!-- Check if this node matches any visible namespace -->
+    <xsl:if test="string-length($node-name) &gt;= string-length($name) and
+                  substring($node-name, $leading-chars + 1,
+                                        string-length($name)) = $name">
+      <xsl:variable name="qualifiers"
+                    select="substring($node-name, 1, $leading-chars)"/>
+      <xsl:if test="contains($directives-str, $qualifiers)">
+        <xsl:variable name="myid">
+          <xsl:call-template name="generate.id">
+            <xsl:with-param name="node" select="."/>
+          </xsl:call-template>
+        </xsl:variable>
+        <cxx-link-helper>
+          <xsl:attribute name="id">
+            <xsl:value-of select="$myid"/>
+          </xsl:attribute>
+          <xsl:attribute name="namespace">
+            <xsl:value-of select="$qualifiers"/>
+          </xsl:attribute>
+          <xsl:text>random text</xsl:text>
+        </cxx-link-helper>
+      </xsl:if>
+    </xsl:if>
+  </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"/>
+    
+    <!-- Filter the nodes to leave only the ones that are in scope. -->
+    <xsl:variable name="matches1">
+      <xsl:call-template name="find-nodes-matching-name">
+        <xsl:with-param name="name" select="$name"/>
+        <xsl:with-param name="nodes" select="$nodes"/>
+        <xsl:with-param name="context" select="$lookup"/>
+      </xsl:call-template>
+    </xsl:variable>
+    
+    <xsl:variable name="matches" select="exsl:node-set($matches1)//cxx-link-helper"/>
+
+    <xsl:choose>
+      <xsl:when test="count($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:otherwise>
+        <!-- If we found more than one, print a message and take the first -->
+        <xsl:if test="count($matches) &gt; 1">
+          <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="$matches">
+              <xsl:text>
+              Match in namespace ::</xsl:text>
+              <xsl:value-of select="@namespace"/>
+            </xsl:for-each>
+          </xsl:message>
+        </xsl:if>
+        <xsl:call-template name="internal-link">
+          <xsl:with-param name="to">
+            <xsl:value-of select="$matches[position() = 1]/@id"/>
+          </xsl:with-param>
+          <xsl:with-param name="text" select="$display-name"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/xsl/api/macro.xsl b/xsl/api/macro.xsl
new file mode 100644 (file)
index 0000000..893fb03
--- /dev/null
@@ -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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+version="1.0">
+  <xsl:template match="d:macro" mode="synopsis">
+    <xsl:param name="indentation" select="0"/>
+
+    <xsl:text>&#10;</xsl:text>
+    <xsl:if 
+      test="not(local-name(preceding-sibling::*[position()=1])=local-name(.))">
+      <xsl:text>&#10;</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="d:macro" mode="reference">
+    <xsl:call-template name="reference-documentation">
+      <xsl:with-param name="refname" select="@name"/>
+      <xsl:with-param name="purpose" select="d:purpose/*|d: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="header-link"/>
+        <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="d: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() &gt; 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="d:macro" mode="generate.id">
+    <xsl:value-of select="@name"/>
+    <xsl:if test="count(key('named-entities',
+        translate(@name, $uppercase-letters, $lowercase-letters)))!=1">
+      <xsl:text>_</xsl:text>
+      <xsl:value-of select="generate-id(.)"/>
+    </xsl:if>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/xsl/api/manpages.xsl b/xsl/api/manpages.xsl
new file mode 100644 (file)
index 0000000..917c84a
--- /dev/null
@@ -0,0 +1,197 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+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="d:literallayout">
+    <xsl:text>&#10;.nf&#10;</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>&#10;.fi&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="d:para|d:simpara|d:remark" mode="list">
+    <xsl:variable name="foo">
+      <xsl:apply-templates/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="d:literallayout">
+        <xsl:copy-of select="$foo"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="normalize-space($foo)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:if test="following-sibling::d:para or following-sibling::d:simpara or
+                  following-sibling::d:remark">
+      <!-- Make sure multiple paragraphs within a list item don't -->
+      <!-- merge together.                                        -->
+      <xsl:text>&#10;</xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="build.refentry.filename">
+    <xsl:param name="node" select="."/>
+    <xsl:variable name="section" select="$node/d:refmeta/d:manvolnum"/>
+    <xsl:variable name="name" select="$node/d:refnamediv/d:refname[1]"/>
+    <xsl:value-of select="concat('man', $section, '/', 
+                                 translate(normalize-space($name), 
+                                          '&lt;&gt;', '__'), 
+                                 '.', $section)"/>
+                                    
+  </xsl:template>
+
+  <xsl:template match="d:refentry" mode="manifest">
+    <xsl:call-template name="build.refentry.filename"/>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="/">
+    <xsl:choose>
+      <xsl:when test="//d:refentry">
+        <xsl:apply-templates select="//d: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>&#10;</xsl:text>
+              <xsl:apply-templates select="//d: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="d:refentry">
+  <xsl:variable name="section" select="d:refmeta/d:manvolnum"/>
+  <xsl:variable name="name" select="d:refnamediv/d: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(d:refmeta/d:refentrytitle)) div 2"/>
+
+  <xsl:variable name="reftitle" 
+               select="substring(d:refmeta/d:refentrytitle, 1, $twidth)"/>
+
+  <xsl:variable name="title">
+    <xsl:choose>
+      <xsl:when test="d:refentryinfo/d:title">
+        <xsl:value-of select="d:refentryinfo/d:title"/>
+      </xsl:when>
+      <xsl:when test="../d:referenceinfo/d:title">
+        <xsl:value-of select="../d:referenceinfo/d:title"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="date">
+    <xsl:choose>
+      <xsl:when test="d:refentryinfo/d:date">
+        <xsl:value-of select="d:refentryinfo/d:date"/>
+      </xsl:when>
+      <xsl:when test="../d:referenceinfo/d:date">
+        <xsl:value-of select="../d:referenceinfo/d:date"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="productname">
+    <xsl:choose>
+      <xsl:when test="d:refentryinfo/d:productname">
+        <xsl:value-of select="d:refentryinfo/d:productname"/>
+      </xsl:when>
+      <xsl:when test="../d:referenceinfo/d:productname">
+        <xsl:value-of select="../d:referenceinfo/d: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="d:refmeta/d: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>&#10;</xsl:text>
+
+      <!-- Author section -->
+      <xsl:choose>
+        <xsl:when test="d:refentryinfo//d:author">
+          <xsl:apply-templates select="d:refentryinfo" mode="authorsect"/>
+        </xsl:when>
+        <xsl:when test="/d:book/d:bookinfo//d:author">
+          <xsl:apply-templates select="/d:book/d:bookinfo" mode="authorsect"/>
+        </xsl:when>
+        <xsl:when test="/d:article/d:articleinfo//d:author">
+          <xsl:apply-templates select="/d:article/d: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="d:refnamediv/d: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, '&#10;')"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/api/reference.xsl b/xsl/api/reference.xsl
new file mode 100644 (file)
index 0000000..d9a1227
--- /dev/null
@@ -0,0 +1,194 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+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>
+
+    <!-- Emit namespace types -->
+    <xsl:apply-templates select="d:class|d:class-specialization|
+                                 d:struct|d:struct-specialization|
+                                 d:union|d:union-specialization|
+                                 d:typedef|d:enum|d:data-member" mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation + 2"/>
+    </xsl:apply-templates>
+
+    <!-- Emit namespace functions -->
+    <xsl:apply-templates
+      select="d:free-function-group|d:function|d:overloaded-function"
+      mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation + 2"/>
+    </xsl:apply-templates>
+
+    <!-- Emit namespaces -->
+    <xsl:apply-templates select="d:namespace" mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation + 2"/>
+    </xsl:apply-templates>
+
+    <!-- Close namespace -->
+    <xsl:text>&#10;</xsl:text>
+    <xsl:call-template name="indent">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:call-template>
+    <xsl:call-template name="highlight-text">
+      <xsl:with-param name="text" select="'}'"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- Emit namespace synopsis -->
+  <xsl:template match="d:namespace" mode="synopsis">
+    <xsl:param name="indentation" select="0"/>
+
+    <xsl:choose>
+      <xsl:when test="count(ancestor::d:namespace)=0">
+        <xsl:call-template name="namespace-synopsis">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>&#10;</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="d:namespace" mode="reference">
+    <xsl:apply-templates select="d:namespace|d:free-function-group"
+      mode="reference">
+      <xsl:with-param name="indentation" select="0"/>
+    </xsl:apply-templates>
+    <xsl:apply-templates select="d:class|d:class-specialization|
+                                 d:struct|d:struct-specialization|
+                                 d:union|d:union-specialization|d:enum|d:function|
+                                 d:overloaded-function|d:data-member|d:typedef"
+      mode="namespace-reference"/>
+  </xsl:template>
+
+  <!-- Eat extra documentation when in the synopsis or reference sections -->
+  <xsl:template match="d:para|d:section" mode="synopsis"/>
+  <xsl:template match="d:para|d:section" mode="reference"/>
+
+  <xsl:template name="find-wrap-point">
+    <xsl:param name="text"/>
+    <xsl:param name="prefix"/>
+    <xsl:param name="result" select="0"/>
+    <xsl:param name="default" select="$max-columns - string-length($prefix)"/>
+    <xsl:variable name="s" select="substring($text, 2)"/>
+    <xsl:variable name="candidate">
+      <xsl:choose>
+        <xsl:when test="contains($s, ' ')">
+          <xsl:value-of select="string-length(substring-before($s, ' ')) + 1"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="string-length($text)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="string-length($prefix) + $result + $candidate &lt;= $max-columns">
+        <xsl:call-template name="find-wrap-point">
+          <xsl:with-param name="text" select="substring($text, $candidate + 1)"/>
+          <xsl:with-param name="prefix" select="$prefix"/>
+          <xsl:with-param name="result" select="$result + $candidate"/>
+          <xsl:with-param name="default" select="$result + $candidate"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$default"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template name="wrap-comment">
+    <xsl:param name="prefix"/>
+    <xsl:param name="text"/>
+    <xsl:choose>
+      <xsl:when test="string-length($prefix) + string-length($text) &lt;= $max-columns">
+        <xsl:value-of select="$text"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="size">
+          <xsl:call-template name="find-wrap-point">
+            <xsl:with-param name="prefix" select="$prefix"/>
+            <xsl:with-param name="text" select="$text"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:value-of select="substring($text, 1, $size)"/>
+        <xsl:text>&#10;</xsl:text>
+        <xsl:value-of select="$prefix"/>
+        <xsl:call-template name="wrap-comment">
+          <xsl:with-param name="prefix" select="$prefix"/>
+          <xsl:with-param name="text" select="normalize-space(substring($text, $size + 1))"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Comment mode tries to wipe out any extra spacing in the output -->
+  <xsl:template match="d:purpose" mode="comment">
+    <xsl:param name="wrap" select="false()"/>
+    <xsl:param name="prefix"/>
+    <xsl:apply-templates mode="comment">
+      <xsl:with-param name="wrap"
+                      select="$wrap and count(*) = 0 and count(text()) = 1"/>
+      <xsl:with-param name="prefix" select="$prefix"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:template match="d:simpara|d:para" mode="comment">
+    <xsl:apply-templates select="text()|*" mode="comment"/>
+  </xsl:template>
+
+  <xsl:template match="text()" mode="comment">
+    <xsl:param name="wrap" select="false()"/>
+    <xsl:param name="prefix"/>
+    <xsl:variable name="stripped" select="normalize-space(.)"/>
+    <xsl:choose>
+      <xsl:when test="$wrap">
+        <xsl:call-template name="wrap-comment">
+          <xsl:with-param name="prefix" select="$prefix"/>
+          <xsl:with-param name="text" select="$stripped"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="*" mode="comment">
+    <xsl:apply-templates select="." mode="annotation"/>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/xsl/api/source-highlight.xsl b/xsl/api/source-highlight.xsl
new file mode 100644 (file)
index 0000000..304bc53
--- /dev/null
@@ -0,0 +1,467 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+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>
+
+  <xsl:variable name="id-start-chars" select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_'"/>
+  <xsl:variable name="id-chars" select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_'"/>
+  <xsl:variable name="digits" select="'1234567890'"/>
+  <xsl:variable name="number-chars" select="'1234567890abcdefABCDEFxX.'"/>
+  <xsl:variable 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:variable name="operators4" select="'%:%:'"/>
+  <xsl:variable name="operators3" select="'&gt;&gt;= &lt;&lt;= -&gt;* ...'"/>
+  <xsl:variable name="operators2" select="'.* :: ## &lt;: :&gt; &lt;% %&gt; %: += -= *= /= %= ^= &amp;= |= &lt;&lt; &gt;&gt; == != &lt;= &gt;= &amp;&amp; || ++ -- -&gt;'"/>
+  <xsl:variable name="operators1" select="'. ? { } [ ] # ( ) ; : + - * / % ^ &amp; | ~ ! = &lt; &gt; ,'"/>
+  <xsl:variable name="single-quote">'</xsl:variable>
+  
+  <!-- Syntax highlighting -->
+  <xsl:template name="highlight-keyword">
+    <xsl:param name="keyword"/>
+    <xsl:choose>
+      <xsl:when test="$boost.syntax.highlight='1'">
+        <phrase role="keyword">
+          <xsl:value-of select="$keyword"/>
+        </phrase>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$keyword"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template name="highlight-identifier">
+    <xsl:param name="identifier"/>
+    <xsl:choose>
+      <xsl:when test="contains($keywords, concat(' ', $identifier, ' '))">
+        <xsl:call-template name="highlight-keyword">
+          <xsl:with-param name="keyword" select="$identifier"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="$boost.syntax.highlight='1'">
+        <phrase role="identifier">
+          <xsl:value-of select="$identifier"/>
+        </phrase>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$identifier"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="highlight-comment">
+    <xsl:param name="text"/>
+    <xsl:choose>
+      <xsl:when test="$boost.syntax.highlight='1'">
+        <phrase role="comment">
+          <xsl:copy-of select="$text"/>
+        </phrase>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="$text"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="highlight-special">
+    <xsl:param name="text"/>
+    <xsl:choose>
+      <xsl:when test="$boost.syntax.highlight='1'">
+        <phrase role="special">
+          <xsl:value-of select="$text"/>
+        </phrase>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$text"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="highlight-number">
+    <xsl:param name="text"/>
+    <xsl:choose>
+      <xsl:when test="$boost.syntax.highlight='1'">
+        <phrase role="number">
+          <xsl:value-of select="$text"/>
+        </phrase>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$text"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="highlight-string">
+    <xsl:param name="text"/>
+    <xsl:choose>
+      <xsl:when test="$boost.syntax.highlight='1'">
+        <phrase role="string">
+          <xsl:value-of select="$text"/>
+        </phrase>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$text"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="highlight-char">
+    <xsl:param name="text"/>
+    <xsl:choose>
+      <xsl:when test="$boost.syntax.highlight='1'">
+        <phrase role="char">
+          <xsl:value-of select="$text"/>
+        </phrase>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$text"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template name="highlight-pp-directive">
+    <xsl:param name="text"/>
+    <xsl:choose>
+      <xsl:when test="$boost.syntax.highlight='1'">
+        <phrase role="preprocessor">
+          <xsl:value-of select="$text"/>
+        </phrase>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$text"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template name="highlight-text-ident-length">
+    <xsl:param name="text"/>
+    <xsl:param name="pos" select="1"/>
+    <xsl:choose>
+      <xsl:when test="string-length($text) + 1 = $pos">
+        <xsl:value-of select="$pos - 1"/>
+      </xsl:when>
+      <xsl:when test="contains($id-chars, substring($text, $pos, 1))">
+        <xsl:call-template name ="highlight-text-ident-length">
+          <xsl:with-param name="text" select="$text"/>
+          <xsl:with-param name="pos" select="$pos + 1"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$pos - 1"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template name="highlight-text-number-length">
+    <xsl:param name="text"/>
+    <xsl:param name="pos" select="1"/>
+    <xsl:choose>
+      <xsl:when test="string-length($text) + 1 = $pos">
+        <xsl:value-of select="$pos - 1"/>
+      </xsl:when>
+      <xsl:when test="contains($number-chars, substring($text, $pos, 1))">
+        <xsl:call-template name ="highlight-text-ident-length">
+          <xsl:with-param name="text" select="$text"/>
+          <xsl:with-param name="pos" select="$pos + 1"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$pos - 1"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="highlight-text-string-length">
+    <xsl:param name="text"/>
+    <xsl:param name="terminator"/>
+    <xsl:param name="pos" select="2"/>
+    <xsl:choose>
+      <xsl:when test="string-length($text) + 1 = $pos">
+        <xsl:value-of select="$pos - 1"/>
+      </xsl:when>
+      <xsl:when test="substring($text, $pos, 1) = $terminator">
+        <xsl:value-of select="$pos"/>
+      </xsl:when>
+      <xsl:when test="substring($text, $pos, 1) = '\' and
+                      string-length($text) != $pos">
+        <xsl:call-template name="highlight-text-string-length">
+          <xsl:with-param name="text" select="$text"/>
+          <xsl:with-param name="terminator" select="$terminator"/>
+          <xsl:with-param name="pos" select="$pos + 2"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="highlight-text-string-length">
+          <xsl:with-param name="text" select="$text"/>
+          <xsl:with-param name="terminator" select="$terminator"/>
+          <xsl:with-param name="pos" select="$pos + 1"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="highlight-text-operator-length">
+    <xsl:param name="text"/>
+    <xsl:choose>
+      <xsl:when test="string-length($text) &gt;= 4 and
+                      not(contains(substring($text, 1, 4), ' ')) and
+                      contains($operators4, substring($text, 1, 4))">
+        <xsl:value-of select="4"/>
+      </xsl:when>
+      <xsl:when test="string-length($text) &gt;= 3 and
+                      not(contains(substring($text, 1, 3), ' ')) and
+                      contains($operators3, substring($text, 1, 3))">
+        <xsl:value-of select="3"/>
+      </xsl:when>
+      <xsl:when test="string-length($text) &gt;= 2 and
+                      not(contains(substring($text, 1, 2), ' ')) and
+                      contains($operators2, substring($text, 1, 2))">
+        <xsl:value-of select="2"/>
+      </xsl:when>
+      <xsl:when test="string-length($text) &gt;= 1 and
+                      not(contains(substring($text, 1, 1), ' ')) and
+                      contains($operators1, substring($text, 1, 1))">
+        <xsl:value-of select="1"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="0"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="highlight-text-pp-directive-length">
+    <xsl:param name="text"/>
+    <!-- Assume that the first character is a # -->
+    <xsl:param name="pos" select="2"/>
+    <xsl:choose>
+      <xsl:when test="contains($id-chars, substring($text, $pos, 1))">
+        <xsl:call-template name="highlight-text-ident-length">
+          <xsl:with-param name="text" select="$text"/>
+          <xsl:with-param name="pos" select="$pos + 1"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains(' &#x9;', substring($text, $pos, 1))">
+        <xsl:call-template name="highlight-text-pp-directive-length">
+          <xsl:with-param name="text" select="$text"/>
+          <xsl:with-param name="pos" select="$pos + 1"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$pos - 1"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="highlight-text-impl-leading-whitespace">
+    <xsl:param name="text"/>
+    <xsl:choose>
+      <xsl:when test="string-length($text) = 0"/>
+      <xsl:when test="contains(' &#xA;&#xD;&#x9;', substring($text, 1, 1))">
+        <xsl:value-of select="substring($text, 1, 1)"/>
+        <xsl:call-template name="highlight-text-impl-leading-whitespace">
+          <xsl:with-param name="text" select="substring($text, 2)"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="'#' = substring($text, 1, 1)">
+        <xsl:variable name="pp-length">
+          <xsl:call-template name="highlight-text-pp-directive-length">
+            <xsl:with-param name="text" select="$text"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:call-template name="highlight-pp-directive">
+          <xsl:with-param name="text" select="substring($text, 1, $pp-length)"/>
+        </xsl:call-template>
+        <xsl:call-template name="highlight-text-impl-root">
+          <xsl:with-param name="text" select="substring($text, $pp-length + 1)"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="highlight-text-impl-root">
+          <xsl:with-param name="text" select="$text"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template name="highlight-text-impl-root">
+    <xsl:param name="text"/>
+    <xsl:choose>
+      <xsl:when test="string-length($text) = 0"/>
+      <xsl:when test="contains($id-start-chars, substring($text, 1, 1))">
+        <xsl:variable name="ident-length">
+          <xsl:call-template name="highlight-text-ident-length">
+            <xsl:with-param name="text" select="$text"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:call-template name="highlight-identifier">
+          <xsl:with-param name="identifier" select="substring($text, 1, $ident-length)"/>
+        </xsl:call-template>
+        <xsl:call-template name="highlight-text-impl-root">
+          <xsl:with-param name="text" select="substring($text, $ident-length + 1)"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains($digits, substring($text, 1, 1))">
+        <xsl:variable name="number-length">
+          <xsl:call-template name="highlight-text-number-length">
+            <xsl:with-param name="text" select="$text"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:call-template name="highlight-number">
+          <xsl:with-param name="text" select="substring($text, 1, $number-length)"/>
+        </xsl:call-template>
+        <xsl:call-template name="highlight-text-impl-root">
+          <xsl:with-param name="text" select="substring($text, $number-length + 1)"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="substring($text, 1, 1) = '&#x22;'">
+        <xsl:variable name="string-length">
+          <xsl:call-template name="highlight-text-string-length">
+            <xsl:with-param name="text" select="$text"/>
+            <xsl:with-param name="terminator" select="'&#x22;'"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:call-template name="highlight-string">
+          <xsl:with-param name="text" select="substring($text, 1, $string-length)"/>
+        </xsl:call-template>
+        <xsl:call-template name="highlight-text-impl-root">
+          <xsl:with-param name="text" select="substring($text, $string-length + 1)"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="substring($text, 1, 1) = $single-quote">
+        <xsl:variable name="char-length">
+          <xsl:call-template name="highlight-text-string-length">
+            <xsl:with-param name="text" select="$text"/>
+            <xsl:with-param name="terminator" select="$single-quote"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:call-template name="highlight-char">
+          <xsl:with-param name="text" select="substring($text, 1, $char-length)"/>
+        </xsl:call-template>
+        <xsl:call-template name="highlight-text-impl-root">
+          <xsl:with-param name="text" select="substring($text, $char-length + 1)"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="substring($text, 1, 2) = '//'">
+        <xsl:call-template name="highlight-comment">
+          <xsl:with-param name="text" select="substring-before($text, '&#xA;')"/>
+        </xsl:call-template>
+        <xsl:call-template name="highlight-text-impl-root">
+          <xsl:with-param name="text" select="concat('&#xA;', substring-after($text, '&#xA;'))"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="substring($text, 1, 2) = '/*'">
+        <xsl:call-template name="highlight-comment">
+          <xsl:with-param name="text" select="concat(substring-before($text, '*/'), '*/')"/>
+        </xsl:call-template>
+        <xsl:call-template name="highlight-text-impl-root">
+          <xsl:with-param name="text" select="substring-after($text, '*/')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains('&#xA;&#xD;', substring($text, 1, 1))">
+        <xsl:value-of select="substring($text, 1, 1)"/>
+        <xsl:call-template name="highlight-text-impl-leading-whitespace">
+          <xsl:with-param name="text" select="substring($text, 2)"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="contains(' &#x9;', substring($text, 1, 1))">
+        <xsl:value-of select="substring($text, 1, 1)"/>
+        <xsl:call-template name="highlight-text-impl-root">
+          <xsl:with-param name="text" select="substring($text, 2)"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="operator-length">
+          <xsl:call-template name="highlight-text-operator-length">
+            <xsl:with-param name="text" select="$text"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:choose>
+          <xsl:when test="$operator-length = 0">
+            <xsl:value-of select="substring($text, 1, 1)"/>
+            <xsl:call-template name="highlight-text-impl-root">
+              <xsl:with-param name="text" select="substring($text, 2)"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="highlight-special">
+              <xsl:with-param name="text" select="substring($text, 1, $operator-length)"/>
+            </xsl:call-template>
+            <xsl:call-template name="highlight-text-impl-root">
+              <xsl:with-param name="text" select="substring($text, $operator-length + 1)"/>
+            </xsl:call-template>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Perform C++ syntax highlighting on the given text -->
+  <xsl:template name="highlight-text">
+    <xsl:param name="text" select="."/>
+    <xsl:call-template name="highlight-text-impl-leading-whitespace">
+      <xsl:with-param name="text" select="$text"/>
+    </xsl:call-template>
+  </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="d:classname|d:methodname|d:functionname|d:libraryname|d:enumname|
+                       d:conceptname|d:macroname|d:globalname" mode="highlight">
+    <xsl:apply-templates select="." mode="annotation"/>
+  </xsl:template>
+
+  <xsl:template match="d:type" mode="highlight">
+    <xsl:apply-templates mode="highlight"/>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/api/template.xsl b/xsl/api/template.xsl
new file mode 100644 (file)
index 0000000..862ff06
--- /dev/null
@@ -0,0 +1,581 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+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="d: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(d:template)">
+        0
+      </xsl:when>
+      <xsl:when test="d:template/*/d: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="d: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="d: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:call-template name="highlight-special">
+          <xsl:with-param name="text" select="'&lt;'"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>template</xsl:text>
+        <xsl:text>&lt;</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+    <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:choose>
+      <xsl:when test="$highlight">
+        <xsl:call-template name="highlight-special">
+          <xsl:with-param name="text" select="'&gt;'"/>
+        </xsl:call-template>
+        <xsl:text> </xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>&gt; </xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </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="d:template-type-parameter|d:template-varargs|d: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:choose>
+        <xsl:when test="$highlight">
+          <xsl:call-template name="highlight-text">
+            <xsl:with-param name="text" select="$prefix"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$prefix"/>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <!-- 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(d: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 &lt; $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>&#10;</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="d:template-type-parameter|d:template-varargs|d: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:call-template name="highlight-special">
+            <xsl:with-param name="text" select="'&lt;'"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>template</xsl:text>
+          <xsl:text>&lt;</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+      <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:choose>
+        <xsl:when test="$highlight">
+          <xsl:call-template name="highlight-special">
+            <xsl:with-param name="text" select="'&gt;'"/>
+          </xsl:call-template>
+          <xsl:text> </xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>&gt; </xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </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="d:template-type-parameter|d:template-varargs|d:template-nontype-parameter"/>
+
+    <xsl:choose>
+      <xsl:when test="$parameters/d: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="d:template-type-parameter|d:template-varargs|d: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:choose>
+          <xsl:when test="$highlight">
+            <xsl:call-template name="highlight-text">
+              <xsl:with-param name="text" select="', '"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>, </xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:if>
+
+      <!-- Display the comment -->
+      <xsl:if test="$parameter/d:purpose">
+        <xsl:call-template name="highlight-comment">
+          <xsl:with-param name="text">
+            <xsl:text>  // </xsl:text>
+            <xsl:apply-templates 
+              select="$parameter/d:purpose/*|$parameter/d:purpose/text()"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+
+      <!-- Indent the next line -->
+      <xsl:if test="$parameter/d:purpose or $rest">
+        <xsl:text>&#10;</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="d: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:if test="$parameter/@pack=1">
+      <xsl:choose>
+        <xsl:when test="$highlight">
+          <xsl:call-template name="highlight-text">
+            <xsl:with-param name="text" select="'...'"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>...</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+    <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/d:default">
+          <xsl:choose>
+            <xsl:when test="$highlight">
+              <xsl:apply-templates 
+                select="$parameter/d:default/*|$parameter/d:default/text()" 
+                mode="highlight"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="string($parameter/d:default)"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:if test="not($def='')">
+      <xsl:choose>
+        <xsl:when test="$highlight">
+          <xsl:call-template name="highlight-text">
+            <xsl:with-param name="text" select="' = '"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text> = </xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <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))='&gt;')">
+        <xsl:text> </xsl:text>
+      </xsl:if>
+    </xsl:if>    
+  </xsl:template>
+
+  <xsl:template match="d: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/d:type/*|$parameter/d:type/text()"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$parameter/d:type/*|$parameter/d:type/text()"/>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:if test="$parameter/@pack=1">
+      <xsl:choose>
+        <xsl:when test="$highlight">
+          <xsl:call-template name="highlight-text">
+            <xsl:with-param name="text" select="'...'"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>...</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+    <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/d:default)"/>
+    </xsl:variable>
+
+    <xsl:if test="not($def='')">
+      <xsl:choose>
+        <xsl:when test="$highlight">
+          <xsl:call-template name="highlight-text">
+            <xsl:with-param name="text" select="' = '"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text> = </xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <xsl:choose>
+        <xsl:when test="$highlight">
+          <xsl:apply-templates select="$parameter/d:default/*|$parameter/d: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))='&gt;')">
+        <xsl:text> </xsl:text>
+      </xsl:if>
+    </xsl:if>    
+  </xsl:template>
+
+  <xsl:template match="d:template-varargs" mode="print.parameter">
+    <xsl:param name="highlight" select="true()"/>
+    <xsl:choose>
+      <xsl:when test="$highlight">
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="'...'"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>...</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="d:specialization">
+    <xsl:param name="highlight" select="true()"/>
+    <xsl:choose>
+      <xsl:when test="$highlight">
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="'&lt;'"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>&lt;</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:apply-templates select="d:template-arg">
+      <xsl:with-param name="highlight" select="$highlight"/>
+    </xsl:apply-templates>
+    <xsl:choose>
+      <xsl:when test="$highlight">
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="'&gt;'"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>&gt;</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="d:template-arg">
+    <xsl:param name="highlight" select="true()"/>
+    <xsl:if test="position() &gt; 1">
+      <xsl:choose>
+        <xsl:when test="$highlight">
+          <xsl:call-template name="highlight-text">
+            <xsl:with-param name="text" select="', '"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>, </xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+    <xsl:apply-templates mode="highlight"/>
+    <xsl:if test="@pack=1">
+      <xsl:choose>
+        <xsl:when test="$highlight">
+          <xsl:call-template name="highlight-text">
+            <xsl:with-param name="text" select="'...'"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text>...</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:template>
+</xsl:stylesheet>
+
diff --git a/xsl/api/testing/Jamfile.xsl b/xsl/api/testing/Jamfile.xsl
new file mode 100644 (file)
index 0000000..013919b
--- /dev/null
@@ -0,0 +1,245 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+version="1.0">
+  <xsl:include href="http://docbook.sourceforge.net/release/xsl/current/html/chunker.xsl"/>
+  <xsl:include href="http://docbook.sourceforge.net/release/xsl/current/common/common.xsl"/>
+
+  <!-- The root of the Boost directory -->
+  <xsl:param name="boost.root"/>
+
+  <!-- The number of columns in a source file line -->
+  <xsl:param name="boost.source.columns" select="78"/>
+
+  <xsl:output method="text"/>
+  <xsl:template match="/">
+    <xsl:if test="$boost.root">
+      <!-- Output testsuite Jamfiles -->
+      <xsl:apply-templates select="//d:testsuite" mode="Jamfile"/>
+
+      <!-- Output any source files that are written in XML -->
+      <xsl:apply-templates select="//d:source" mode="testsuite.generate"/>
+    </xsl:if>
+
+    <xsl:if test="not($boost.root)">
+      <xsl:message>
+        Please set the XSL stylesheet parameter "boost.root" to the top-level
+        Boost directory (i.e., BOOST_ROOT)
+      </xsl:message>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="d:testsuite" mode="Jamfile">
+    <xsl:variable name="subproject"
+      select="concat('libs/',ancestor::d:library/attribute::d:dirname,'/test')"/>
+    <xsl:variable name="filename" 
+      select="concat($boost.root,'/libs/',ancestor::d:library/attribute::d:dirname,
+                     '/test/Jamfile')"/>
+    <xsl:call-template name="write.text.chunk">
+      <xsl:with-param name="filename" select="$filename"/>
+      <xsl:with-param name="content">
+        <xsl:call-template name="source.print.header">
+          <xsl:with-param name="prefix" select="'#'"/>
+        </xsl:call-template>
+
+# Testing Jamfile autogenerated from XML source
+subproject <xsl:value-of select="$subproject"/> ;
+
+# bring in rules for testing
+SEARCH on testing.jam = $(BOOST_BUILD_PATH) ;
+include testing.jam ;
+
+# Make tests run by default.
+DEPENDS all : test ;
+
+{
+  # look in BOOST_ROOT for sources first, just in this Jamfile
+  local SEARCH_SOURCE = $(BOOST_ROOT) $(SEARCH_SOURCE) ;
+
+  test-suite <xsl:value-of select="ancestor::d:library/attribute::d:dirname"/>
+    : <xsl:apply-templates mode="Jamfile"/> ;
+}
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="d:compile-test|d:link-test|d:run-test|d:compile-fail-test|d:link-fail-test|d:run-fail-test"
+    mode="Jamfile">
+    <xsl:variable name="fullname"
+      select="concat(substring-before(local-name(.), '-test'), ' libs/', 
+                     ancestor::d:library/attribute::d:dirname, '/test/', 
+                     @filename)"/>
+    <xsl:text>[ </xsl:text>
+    <xsl:value-of select="$fullname"/>
+    <xsl:apply-templates select="d:lib" mode="Jamfile"/>
+    <xsl:text> : </xsl:text>
+    <!-- ... -->
+    <xsl:text> : </xsl:text>
+    <!-- ... -->
+    <xsl:text> : </xsl:text>
+    <xsl:apply-templates select="d:requirement" mode="Jamfile"/>
+    <!-- ... -->
+    <xsl:text> : </xsl:text>
+    <xsl:if test="@name">
+      <xsl:value-of select="@name"/>
+    </xsl:if>
+    <xsl:text> ]</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="d:lib" mode="Jamfile">
+    <xsl:text> &lt;lib&gt;</xsl:text><xsl:value-of select="text()"/>
+  </xsl:template>
+
+  <xsl:template match="d:requirement" mode="Jamfile">
+    <xsl:if test="count(preceding-sibling::d:requirement) &gt; 0">
+      <xsl:text> </xsl:text>
+    </xsl:if>
+    <xsl:value-of select="concat('&lt;', @name, '&gt;')"/>
+    <xsl:value-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="d:source" mode="testsuite.generate">
+    <xsl:variable name="filename" 
+      select="concat($boost.root,'/libs/',ancestor::d:library/attribute::d:dirname,
+                     '/test/',../@filename)"/>
+
+    <xsl:variable name="prefix" select="'//'"/>
+
+    <xsl:call-template name="write.text.chunk">
+      <xsl:with-param name="filename" select="$filename"/>
+      <xsl:with-param name="content">
+        <xsl:call-template name="source.print.header">
+          <xsl:with-param name="prefix" select="'//'"/>
+        </xsl:call-template>
+        <!-- Source code -->
+        <xsl:apply-templates mode="testsuite.generate"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="d:snippet" mode="testsuite.generate">
+    <xsl:variable name="snippet-name" select="@name"/>
+    <xsl:value-of select="//d:programlisting[@name=$snippet-name]"/>
+  </xsl:template>
+
+  <!-- Prints a header to a source file containing the library name,
+       copyright information, license information, and a link to the Boost
+       web site. The text is output using the "prefix" parameter at the
+       beginning of each line (it should denote a single-line comment) and
+       will only print up to boost.source.columns characters per line
+       (including the prefix). -->
+  <xsl:template name="source.print.header">
+    <xsl:param name="prefix"/>
+
+    <!-- Library name -->
+    <xsl:value-of select="concat($prefix, ' ', 
+                                 ancestor::d:library/attribute::d:name, 
+                                 ' library')"/>
+    <xsl:text>&#10;</xsl:text>
+    
+    <!-- Copyrights -->
+    <xsl:apply-templates select="ancestor::d:library/d:libraryinfo/d:copyright"
+      mode="testsuite.generate">
+      <xsl:with-param name="prefix" select="$prefix"/>
+    </xsl:apply-templates>
+        
+    <!-- Legal notice -->
+    <xsl:apply-templates select="ancestor::d:library/d:libraryinfo/d:legalnotice"
+      mode="testsuite.generate">
+      <xsl:with-param name="prefix" select="$prefix"/>
+    </xsl:apply-templates>
+    
+    <xsl:text>&#10;&#10;</xsl:text>
+    
+    <!-- For more information... -->
+    <xsl:value-of 
+      select="concat($prefix,
+              ' For more information, see http://www.boost.org/')"/>
+    <xsl:text>&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="d:copyright" mode="testsuite.generate">
+    <xsl:param name="prefix"/>
+
+    <xsl:text>&#10;</xsl:text>
+
+    <xsl:value-of select="concat($prefix, ' Copyright (C) ')"/>
+    <xsl:call-template name="copyright.years">
+      <xsl:with-param name="years" select="d:year"/>
+      <xsl:with-param name="print.ranges" select="1"/>
+      <xsl:with-param name="single.year.ranges" select="1"/>
+    </xsl:call-template>
+
+    <xsl:text> </xsl:text>
+
+    <xsl:apply-templates select="d:holder" mode="titlepage.mode"/>
+  </xsl:template>
+
+  <xsl:template match="d:legalnotice" mode="testsuite.generate">
+    <xsl:param name="prefix"/>
+
+    <xsl:variable name="text" select="normalize-space(.)"/>
+
+    <xsl:text>&#10;&#10;</xsl:text>
+    <xsl:value-of select="concat($prefix, ' ')"/>
+
+    <xsl:call-template name="source.print.legalnotice">
+      <xsl:with-param name="prefix" select="$prefix"/>
+      <xsl:with-param name="text" select="$text"/>
+      <xsl:with-param name="column" select="string-length($prefix) + 1"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template name="source.print.legalnotice">
+    <xsl:param name="prefix"/>
+    <xsl:param name="text"/>
+    <xsl:param name="column"/>
+
+    <xsl:if test="contains($text, ' ') or string-length($text) &gt; 0">
+      <xsl:variable name="word">
+        <xsl:choose>
+          <xsl:when test="contains($text, ' ')">
+            <xsl:value-of select="substring-before($text, ' ')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$text"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
+      <xsl:variable name="rest" select="substring-after($text, ' ')"/>
+
+      <xsl:choose>
+        <xsl:when 
+          test="$column + string-length($word) &gt; $boost.source.columns">
+          <xsl:text>&#10;</xsl:text>
+          <xsl:value-of select="concat($prefix, ' ')"/>
+          <xsl:call-template name="source.print.legalnotice">
+            <xsl:with-param name="prefix" select="$prefix"/>
+            <xsl:with-param name="text" select="$text"/>
+            <xsl:with-param name="column" select="string-length($prefix) + 1"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="concat($word, ' ')"/>
+          <xsl:call-template name="source.print.legalnotice">
+            <xsl:with-param name="prefix" select="$prefix"/>
+            <xsl:with-param name="text" select="$rest"/>
+            <xsl:with-param name="column" 
+              select="$column + string-length($word) + 1"/>
+          </xsl:call-template>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="*" mode="testsuite.generate"/>
+</xsl:stylesheet>
diff --git a/xsl/api/testing/testsuite.xsl b/xsl/api/testing/testsuite.xsl
new file mode 100644 (file)
index 0000000..1655493
--- /dev/null
@@ -0,0 +1,120 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+version="1.0">
+  <xsl:template match="d:testsuite">
+    <section>
+      <xsl:choose>
+        <xsl:when test="@id">
+          <xsl:attribute name="id">
+            <xsl:value-of select="@id"/>
+          </xsl:attribute>
+        </xsl:when>
+        <xsl:when test="../@id">
+          <xsl:attribute name="id">
+            <xsl:value-of select="concat(../@id, '.tests')"/>
+          </xsl:attribute>
+        </xsl:when>
+      </xsl:choose>
+
+      <title>Testsuite</title>
+
+      <xsl:if test="d:compile-test|d:link-test|d:run-test">
+        <section>
+          <xsl:if test="@id">
+            <xsl:attribute name="id">
+              <xsl:value-of select="@id"/>
+              <xsl:text>.acceptance</xsl:text>
+            </xsl:attribute>
+          </xsl:if>
+
+          <title>Acceptance tests</title>
+          <informaltable>
+            <tgroup cols="3">
+              <colspec colnum="2" colwidth="1in"/>
+              <thead>
+                <row>
+                  <entry>Test</entry>
+                  <entry>Type</entry>
+                  <entry>Description</entry>
+                  <entry>If failing...</entry>
+                </row>
+              </thead>
+              <tbody>
+                <xsl:apply-templates select="d:compile-test|d:link-test|d:run-test"/>
+              </tbody>
+            </tgroup>
+          </informaltable>
+        </section>          
+      </xsl:if>
+      
+      <xsl:if test="d:compile-fail-test|d:link-fail-test|d:run-fail-test">
+        <section>
+          <xsl:if test="@id">
+            <xsl:attribute name="id">
+              <xsl:value-of select="@id"/>
+              <xsl:text>.negative</xsl:text>
+            </xsl:attribute>
+          </xsl:if>
+          <title>Negative tests</title>
+          <informaltable>
+            <tgroup cols="3">
+              <colspec colnum="2" colwidth="1in"/>
+              <thead>
+                <row>
+                  <entry>Test</entry>
+                  <entry>Type</entry>
+                  <entry>Description</entry>
+                  <entry>If failing...</entry>
+                </row>
+              </thead>
+              <tbody>
+                <xsl:apply-templates 
+                  select="d:compile-fail-test|d:link-fail-test|d:run-fail-test"/>
+              </tbody>
+            </tgroup>
+          </informaltable>
+        </section>
+      </xsl:if> 
+    </section>
+  </xsl:template>
+
+  <xsl:template match="d:compile-test|d:link-test|d:run-test|
+                       d:compile-fail-test|d:link-fail-test|d:run-fail-test">
+    <row>
+      <entry>
+        <simpara>
+          <ulink>
+            <xsl:attribute name="url">
+              <xsl:value-of 
+                select="concat('../../libs/',
+                               ancestor::d:library/attribute::d:dirname, '/test/',
+                               @filename)"/>
+            </xsl:attribute>
+            <xsl:value-of select="@filename"/>
+          </ulink>
+        </simpara>
+      </entry>
+      <entry>
+        <simpara>
+          <xsl:value-of select="substring-before(local-name(.), '-test')"/>
+        </simpara>
+      </entry>
+      <entry><xsl:apply-templates select="d:purpose/*"/></entry>
+      <entry><xsl:apply-templates select="if-fails/*"/></entry>
+    </row>
+  </xsl:template>
+
+  <xsl:template match="d:snippet">
+    <xsl:variable name="snippet-name" select="@name"/>
+    <xsl:apply-templates select="//d:programlisting[@name=$snippet-name]"/>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/xsl/api/type.xsl b/xsl/api/type.xsl
new file mode 100644 (file)
index 0000000..a94b7f6
--- /dev/null
@@ -0,0 +1,1549 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
+   Copyright (c) 2007 Frank Mori Hess <fmhess@users.sourceforge.net>
+
+   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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+version="1.0">
+
+  <xsl:include href="global.xsl"/>
+  <xsl:strip-space elements="d:inherit d: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="d:class|d:struct|d:union" mode="generate.id">
+    <xsl:call-template name="fully-qualified-id">
+      <xsl:with-param name="node" select="."/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="d:class-specialization|d:struct-specialization|d:union-specialization" mode="generate.id">
+    <xsl:call-template name="fully-qualified-id">
+      <xsl:with-param name="node" select="."/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="d:typedef" mode="generate.id">
+    <xsl:call-template name="fully-qualified-id">
+      <xsl:with-param name="node" select="."/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="d:enum" mode="generate.id">
+    <xsl:call-template name="fully-qualified-id">
+      <xsl:with-param name="node" select="."/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="d:enumvalue" mode="generate.id">
+    <xsl:call-template name="fully-qualified-id">
+      <xsl:with-param name="node" select="parent::d:enum"/>
+    </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="d:template and count(d:template/*) &gt; 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="d: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="d:class|d:class-specialization|
+                       d:struct|d:struct-specialization|
+                       d:union|d: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() &gt; 1)">
+      <xsl:text>&#10;</xsl:text>
+    </xsl:if>
+
+    <xsl:text>&#10;</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="d: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="d:specialization"/>
+      <xsl:call-template name="highlight-text">
+        <xsl:with-param name="text" select="';'"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="(string-length($full-decl-string) +
+                       string-length($indentation)) &lt; $max-columns">
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:call-template>
+        <xsl:apply-templates select="d: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="d:specialization"/>
+        <xsl:call-template name="highlight-special">
+          <xsl:with-param name="text" select="';'"/>
+        </xsl:call-template>
+      </xsl:when>
+
+      <xsl:otherwise>
+        <!-- Template header -->
+        <xsl:if test="d:template">
+          <xsl:call-template name="indent">
+            <xsl:with-param name="indentation" select="$indentation"/>
+          </xsl:call-template>
+          <xsl:apply-templates select="d:template" mode="synopsis">
+            <xsl:with-param name="indentation" select="$indentation"/>
+          </xsl:apply-templates>
+          <xsl:text>&#10;</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="d:specialization"/>
+        <xsl:call-template name="highlight-special">
+          <xsl:with-param name="text" select="';'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <!-- Free functions associated with the class -->
+    <xsl:apply-templates select="d: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>&#10;</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>.&#10;</xsl:text>
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$indentation + 3"/>
+        </xsl:call-template>
+        <xsl:text>.&#10;</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(d: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="d:type/*|d:type/text()"
+              mode="highlight"/>
+            <!--
+            <xsl:call-template name="source-highlight">
+              <xsl:with-param name="text">
+                <xsl:apply-templates select="d:type/*|d:type/text()"/>
+              </xsl:with-param>
+            </xsl:call-template>
+            -->
+          </xsl:otherwise>
+        </xsl:choose>
+
+        <xsl:choose>
+          <xsl:when test="$max-type-length &gt; 0">
+            <xsl:value-of select="substring($type-padding, 1,
+                                            $max-type-length - $type-length)"/>
+            <xsl:text> </xsl:text>
+            <xsl:variable name="truncated-typedef-name" select="substring(@name,
+              1, $max-name-length)"/>
+            <xsl:call-template name="link-or-anchor">
+              <xsl:with-param name="to" select="$link-to"/>
+              <xsl:with-param name="text" select="$truncated-typedef-name"/>
+              <xsl:with-param name="link-type" select="$link-type"/>
+              <xsl:with-param name="highlight" select="true()"/>
+            </xsl:call-template>
+            <xsl:call-template name="highlight-text">
+              <xsl:with-param name="text" select="substring(concat(';', $name-padding),
+                1, $max-name-length - string-length($truncated-typedef-name))"/>
+            </xsl:call-template>
+          </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:call-template name="highlight-special">
+              <xsl:with-param name="text" select="';'"/>
+            </xsl:call-template>
+          </xsl:otherwise>
+        </xsl:choose>
+
+        <xsl:if test="$compact and d:purpose">
+          <xsl:text>  </xsl:text>
+          <xsl:call-template name="highlight-comment">
+            <xsl:with-param name="text">
+              <xsl:text>// </xsl:text>
+              <xsl:apply-templates select="d:purpose" mode="comment"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="d:typedef" mode="synopsis">
+    <xsl:param name="indentation"/>
+    <xsl:param name="max-type-length" select="0"/>
+    <xsl:param name="max-name-length" select="0"/>
+    <xsl:param name="allow-anchor" select="true()"/>
+
+    <!-- True if we should compact this typedef -->
+    <xsl:variable name="compact"
+      select="not (d:para|d: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() &gt; 1)">
+          <xsl:text>&#10;</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="$allow-anchor"/>
+          <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="d:typedef" mode="namespace-reference">
+    <!-- True if this typedef was compacted -->
+    <xsl:variable name="compact"
+      select="not (d:para|d: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="d:purpose/*|d: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="header-link"/>
+          <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="d:description"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="d:typedef" mode="reference">
+    <!-- True if this typedef was compacted -->
+    <xsl:variable name="compact"
+      select="not (d:para|d:description) and ($boost.compact.typedef='1')"/>
+
+    <xsl:if test="not ($compact)">
+      <listitem>
+        <para>
+          <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="'anchor'"/>
+          </xsl:call-template>
+        </para>
+        <xsl:apply-templates select="d:description"/>
+      </listitem>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Emit a list of static constants -->
+  <xsl:template match="static-constant" mode="synopsis">
+    <xsl:param name="indentation"/>
+    <xsl:text>&#10;</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:apply-templates select="d:type" mode="highlight"/>
+
+    <xsl:if test="not(@name = '')">
+      <xsl:text> </xsl:text>
+      <xsl:call-template name="source-highlight">
+        <xsl:with-param name="text" select="@name"/>
+      </xsl:call-template>
+    </xsl:if>
+
+    <xsl:text> = </xsl:text>
+
+    <xsl:call-template name="source-highlight">
+      <xsl:with-param name="text">
+        <xsl:apply-templates select="d:default/*|d:default/text()"/>
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:call-template name="highlight-special">
+      <xsl:with-param name="text" select="';'"/>
+    </xsl:call-template>
+
+    <xsl:if test="d:purpose">
+      <xsl:text>  </xsl:text>
+      <xsl:call-template name="highlight-comment">
+        <xsl:with-param name="text">
+          <xsl:text>// </xsl:text>
+          <xsl:apply-templates select="d: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="d:inherit"/>
+  </xsl:template>
+
+  <xsl:template name="print.base.classes.multi">
+    <xsl:param name="indentation"/>
+
+    <xsl:variable name="n" select="count(d:inherit)"/>
+    <xsl:for-each select="d:inherit">
+      <!-- Indentation -->
+      <xsl:if test="position() &gt; 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::d:class|parent::d: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="d:type">
+          <xsl:apply-templates select="d:type/*|d:type/text()" mode="annotation">
+            <xsl:with-param name="highlight" select="true()"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:message>
+            <xsl:text>Warning: missing 'type' element inside 'inherit'</xsl:text>
+          </xsl:message>
+          <xsl:call-template name="print.warning.context"/>
+          <xsl:apply-templates mode="annotation"/>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <xsl:if test="@pack=1"><xsl:text>...</xsl:text></xsl:if>
+
+      <!-- Output a comma if not at the end -->
+      <xsl:if test="position() &lt; $n">
+        <xsl:text>,</xsl:text>
+      </xsl:if>
+
+      <!-- Output a comment if we have one -->
+      <xsl:if test="d:purpose">
+        <xsl:choose>
+          <xsl:when test="position() &lt; $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="d:purpose"
+              mode="comment"/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:if>
+
+      <xsl:if test="position() &lt; $n">
+        <xsl:text>&#10;</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(d:inherit/d: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
+                        &lt; $max-columns)">
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="' : '"/>
+        </xsl:call-template>
+        <xsl:call-template name="print.base.classes.single"/>
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="' {'"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="$single-line-candidate and
+                      (string-length($single-line) + $base-indentation + 2
+                        &lt; $max-columns)">
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="' :&#10;'"/>
+        </xsl:call-template>
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$base-indentation + 2"/>
+        </xsl:call-template>
+        <xsl:call-template name="print.base.classes.single"/>
+        <xsl:text>&#10;</xsl:text>
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$base-indentation"/>
+        </xsl:call-template>
+        <xsl:call-template name="highlight-special">
+          <xsl:with-param name="text" select="'{'"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="' : '"/>
+        </xsl:call-template>
+        <xsl:call-template name="print.base.classes.multi">
+          <xsl:with-param name="indentation" select="$indentation + 3"/>
+        </xsl:call-template>
+        <xsl:text>&#10;</xsl:text>
+        <xsl:call-template name="indent">
+          <xsl:with-param name="indentation" select="$base-indentation"/>
+        </xsl:call-template>
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="'{'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Emit a list of base classes without comments and on a single line -->
+  <xsl:template match="d:inherit">
+    <xsl:choose>
+      <xsl:when test="position()=1">
+      </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:if test="@pack=1"><xsl:text>...</xsl:text></xsl:if>
+  </xsl:template>
+
+  <!-- Find the maximum length of the types in typedefs -->
+  <xsl:template name="find-max-type-length">
+    <xsl:param name="typedefs" select="d: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/d: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 &gt; $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="d: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">
+        <xsl:call-template name="object-name"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="d: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">
+        <xsl:call-template name="object-name"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="d: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">
+        <xsl:call-template name="object-name"/>
+      </xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template name="class-members-synopsis">
+    <xsl:param name="indentation" select="0"/>
+    <!-- Used to suppress anchors in nested synopsis, so we don't get multiple anchors -->
+    <xsl:param name="allow-synopsis-anchors" select="false()"/>
+
+    <!-- Typedefs -->
+    <xsl:if test="d:typedef">
+      <xsl:text>&#10;</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">
+          <xsl:text>// </xsl:text>
+          <!-- True if there are any non-compacted typedefs -->
+          <xsl:variable name="have-typedef-references"
+            select="d:typedef and ((d:typedef/d:para|d:typedef/d:description) or ($boost.compact.typedef='0'))"/>
+          <xsl:choose>
+            <xsl:when test="$have-typedef-references">
+              <xsl:call-template name="internal-link">
+                <xsl:with-param name="to">
+                  <xsl:call-template name="generate.id"/>
+                  <xsl:text>types</xsl:text>
+                </xsl:with-param>
+                <xsl:with-param name="text" select="'types'"/>
+              </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>types</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:with-param>
+      </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="d: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:with-param name="allow-anchor" select="$allow-synopsis-anchors"/>
+      </xsl:apply-templates>
+    </xsl:if>
+
+    <!-- Static constants -->
+    <xsl:if test="d:static-constant">
+      <xsl:text>&#10;</xsl:text>
+      <xsl:if test="d:typedef">
+        <xsl:text>&#10;</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:if test="d:class|d:class-specialization|d:struct|d:struct-specialization|d:union|d:union-specialization">
+      <xsl:text>&#10;</xsl:text>
+      <xsl:if test="d:typedef|d:static-constant">
+        <xsl:text>&#10;</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="'// member classes/structs/unions'"/>
+      </xsl:call-template>
+      <xsl:apply-templates select="d:class|d:class-specialization|
+                                 d:struct|d:struct-specialization|
+                                 d:union|d:union-specialization"
+        mode="reference">
+        <xsl:with-param name="indentation" select="$indentation + 2"/>
+      </xsl:apply-templates>
+    </xsl:if>
+
+    <!-- Enums -->
+    <xsl:apply-templates select="d: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="d:method-group|d:method|d:overloaded-method"
+      mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation + 2"/>
+    </xsl:apply-templates>
+
+    <!-- Data members -->
+    <xsl:apply-templates select="d:data-member" mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation + 2"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:template name="print-access-specification">
+    <xsl:param name="indentation" select="0"/>
+    <xsl:param name="specification" select="'public'"/>
+
+    <xsl:text>&#10;</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="$specification"/>
+    </xsl:call-template>
+    <xsl:call-template name="highlight-special">
+      <xsl:with-param name="text" select="':'"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template match="d:access" mode="synopsis">
+    <xsl:param name="indentation" select="0"/>
+    <xsl:param name="allow-synopsis-anchors" select="false()"/>
+
+    <xsl:call-template name="print-access-specification">
+      <xsl:with-param name="indentation" select="$indentation"/>
+      <xsl:with-param name="specification" select="@name"/>
+    </xsl:call-template>
+    <xsl:call-template name="class-members-synopsis">
+      <xsl:with-param name="indentation" select="$indentation"/>
+      <xsl:with-param name="allow-synopsis-anchors" select="$allow-synopsis-anchors"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <xsl:template name="class-type-synopsis">
+    <xsl:param name="indentation" select="0"/>
+    <xsl:param name="allow-synopsis-anchors" select="false()"/>
+
+    <!-- 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::d:class|ancestor::d:class-specialization|
+                  ancestor::d:struct|ancestor::d:struct-specialization|
+                  ancestor::d:union|ancestor::d:union-specialization">
+      <xsl:text>&#10;</xsl:text>
+
+      <!-- If this nested class has a "purpose" element, use it as a
+           comment. -->
+      <xsl:if test="d:purpose">
+        <xsl:text>&#10;</xsl:text>
+        <xsl:variable name="spaces">
+          <xsl:call-template name="indent">
+            <xsl:with-param name="indentation" select="$indentation"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:copy-of select="$spaces"/>
+        <xsl:call-template name="highlight-comment">
+          <xsl:with-param name="text">
+            <xsl:text>// </xsl:text>
+            <xsl:apply-templates select="d:purpose" mode="comment">
+              <xsl:with-param name="wrap" select="true()"/>
+              <xsl:with-param name="prefix" select="concat($spaces, '// ')"/>
+            </xsl:apply-templates>
+          </xsl:with-param>
+        </xsl:call-template>
+        <xsl:text>&#10;</xsl:text>
+      </xsl:if>
+    </xsl:if>
+
+    <!-- Template header -->
+    <xsl:if test="d:template">
+      <xsl:call-template name="indent">
+        <xsl:with-param name="indentation" select="$indentation"/>
+      </xsl:call-template>
+      <xsl:apply-templates select="d:template" mode="reference">
+        <xsl:with-param name="indentation" select="$indentation"/>
+      </xsl:apply-templates>
+    </xsl:if>
+    <xsl:text>&#10;</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>
+
+    <!--  Make the class name a link to the class reference page (useful for nested classes) -->
+    <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:value-of select="@name"/>
+      </xsl:with-param>
+    </xsl:call-template>
+
+    <xsl:apply-templates select="d:specialization"/>
+
+    <xsl:choose>
+      <xsl:when test="d: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:call-template name="highlight-text">
+          <xsl:with-param name="text" select="' {'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <!-- Default public designator for members not inside explicit <access> elements -->
+    <xsl:if test="contains(local-name(.), 'class')">
+      <xsl:if test="count(d:static-constant|d:typedef|d:enum|
+        d:copy-assignment|d:constructor|d:destructor|d:method-group|
+        d:method|d:overloaded-method|d:data-member|
+        d:class|d:class-specialization|
+        d:struct|d:struct-specialization|
+        d:union|d:union-specialization) &gt; 0">
+        <xsl:call-template name="print-access-specification">
+          <xsl:with-param name="indentation" select="$indentation"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:call-template name="class-members-synopsis">
+      <xsl:with-param name="indentation" select="$indentation"/>
+      <xsl:with-param name="allow-synopsis-anchors" select="$allow-synopsis-anchors"/>
+    </xsl:call-template>
+
+    <xsl:apply-templates select="d:access" mode="synopsis">
+      <xsl:with-param name="indentation" select="$indentation"/>
+      <xsl:with-param name="allow-synopsis-anchors" select="$allow-synopsis-anchors"/>
+    </xsl:apply-templates>
+
+    <!-- Closing brace -->
+    <xsl:text>&#10;</xsl:text>
+    <xsl:call-template name="indent">
+      <xsl:with-param name="indentation" select="$indentation"/>
+    </xsl:call-template>
+    <xsl:call-template name="highlight-text">
+      <xsl:with-param name="text" select="'};'"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- Emit nested class reference documentation -->
+  <xsl:template match="d:class|d:class-specialization|
+                       d:struct|d:struct-specialization|
+                       d:union|d: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>
+
+  <xsl:template name="member-typedefs-reference">
+    <!-- True if there are any non-compacted typedefs -->
+    <xsl:variable name="have-typedef-references"
+      select="d:typedef and ((d:typedef/d:para|d:typedef/d:description) or ($boost.compact.typedef='0'))"/>
+    <xsl:if test="$have-typedef-references">
+      <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>types</xsl:text>
+            </xsl:with-param>
+            <xsl:with-param name="text" select="''"/>
+          </xsl:call-template>
+          <xsl:call-template name="monospaced">
+            <xsl:with-param name="text">
+              <xsl:call-template name="object-name"/>
+            </xsl:with-param>
+          </xsl:call-template>
+          <xsl:text> </xsl:text>
+          <xsl:call-template name="access-name"/>
+          <xsl:text> types</xsl:text>
+        </xsl:with-param>
+        <xsl:with-param name="text">
+          <orderedlist>
+            <xsl:apply-templates select="d:typedef" mode="reference"/>
+          </orderedlist>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+ </xsl:template>
+
+  <xsl:template name="class-members-reference">
+
+    <xsl:call-template name="member-typedefs-reference"/>
+
+    <xsl:call-template name="construct-copy-destruct-reference"/>
+
+    <xsl:apply-templates
+      select="d:method-group|d:method|d:overloaded-method"
+      mode="reference"/>
+
+    <!-- Emit reference docs for nested classes -->
+    <xsl:apply-templates
+      select="d:class|d:class-specialization|
+              d:struct|d:struct-specialization|
+              d:union|d:union-specialization"
+      mode="namespace-reference"/>
+
+    <!-- Emit reference docs for nested enums -->
+    <xsl:apply-templates
+      select="d:enum"
+      mode="namespace-reference"/>
+  </xsl:template>
+
+  <xsl:template match="d:access" mode="namespace-reference">
+    <xsl:call-template name="class-members-reference"/>
+  </xsl:template>
+
+  <!-- Emit namespace-level class reference documentation -->
+  <xsl:template match="d:class|d:class-specialization|
+                       d:struct|d:struct-specialization|
+                       d:union|d: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="d:purpose/*|d: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="header-link"/>
+        <xsl:call-template name="class-type-synopsis">
+          <xsl:with-param name="indentation" select="$indentation"/>
+          <xsl:with-param name="allow-synopsis-anchors" select="true()"/>
+        </xsl:call-template>
+        <!-- Associated free functions -->
+        <xsl:apply-templates select="d: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="d:para">
+          <xsl:message>
+            <xsl:text>Warning: Use of 'para' elements in 'class' element is deprecated.&#10;Wrap them in a 'description' element.</xsl:text>
+          </xsl:message>
+          <xsl:call-template name="print.warning.context"/>
+          <xsl:apply-templates select="d:para" mode="annotation"/>
+        </xsl:if>
+        <xsl:apply-templates select="d:description"/>
+
+        <xsl:call-template name="class-members-reference"/>
+        <xsl:apply-templates select="d:access" mode="namespace-reference"/>
+
+        <xsl:apply-templates select="d: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
+                      ../d:class-specialization[@name=$name]">
+          <refsect2>
+            <title>Specializations</title>
+            <itemizedlist>
+              <xsl:apply-templates
+                select="../d: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="d:class-specialization|
+                       d:struct-specialization|
+                       d: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="d:data-member" mode="synopsis">
+    <xsl:param name="indentation"/>
+
+    <xsl:choose>
+      <xsl:when test="ancestor::d:class|ancestor::d:class-specialization|
+                      ancestor::d:struct|ancestor::d:struct-specialization|
+                      ancestor::d:union|ancestor::d:union-specialization">
+
+        <!-- Spacing -->
+        <xsl:if
+          test="not(local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() &gt; 1)">
+          <xsl:text>&#10;</xsl:text>
+        </xsl:if>
+
+        <!-- Indent -->
+        <xsl:text>&#10;</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="d:type" mode="highlight"/>
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="@name"/>
+        <xsl:call-template name="highlight-text">
+          <xsl:with-param name="text" select="';'"/>
+        </xsl:call-template>
+
+      </xsl:when>
+      <xsl:otherwise>
+       <xsl:call-template name="global-synopsis">
+         <xsl:with-param name="indentation" select="$indentation"/>
+       </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+
+    <!-- If there is a <purpose>, then add it as an
+         inline comment immediately following the data
+         member definition in the synopsis -->
+    <xsl:if test="d: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="d:purpose/*|d:purpose/text()"
+            mode="purpose"/>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Data member reference -->
+  <xsl:template match="d:data-member" mode="reference">
+    <xsl:choose>
+      <xsl:when test="ancestor::d:class|ancestor::d:class-specialization|
+                      ancestor::d:struct|ancestor::d:struct-specialization|
+                      ancestor::d:union|ancestor::d:union-specialization"/>
+      <xsl:otherwise>
+        <xsl:call-template name="global-reference"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Enumeration synopsis -->
+  <xsl:template match="d:enum" mode="synopsis">
+    <xsl:param name="indentation"/>
+
+    <!-- Spacing -->
+    <xsl:if
+      test="(not (local-name(preceding-sibling::*[position()=1])=local-name(.))
+             and (position() &gt; 1)) or
+            not (d:para or d:description or not ($boost.compact.enum=1))">
+      <xsl:text>&#10;</xsl:text>
+    </xsl:if>
+
+    <!-- Indent -->
+    <xsl:text>&#10;</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="d:para or d: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="d:purpose">
+          <xsl:call-template name="highlight-comment">
+            <xsl:with-param name="text">
+              <xsl:text>// </xsl:text>
+              <xsl:apply-templates select="d:purpose" mode="comment"/>
+            </xsl:with-param>
+          </xsl:call-template>
+
+          <xsl:text>&#10;</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:call-template name="highlight-text">
+          <xsl:with-param name="text" select="' { '"/>
+        </xsl:call-template>
+        <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:call-template name="highlight-text">
+          <xsl:with-param name="text" select="' }'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:call-template name="highlight-text">
+      <xsl:with-param name="text" select="';'"/>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- Enumeration reference at namespace level -->
+  <xsl:template match="d:enum" mode="namespace-reference">
+    <xsl:if test="d:para or d: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="d:purpose/*|d: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="header-link"/>
+          <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="d:para">
+            <xsl:message>
+              <xsl:text>Warning: Use of 'para' elements in 'enum' element is deprecated.&#10;Wrap them in a 'description' element.</xsl:text>
+            </xsl:message>
+            <xsl:call-template name="print.warning.context"/>
+            <xsl:apply-templates select="d:para" mode="annotation"/>
+          </xsl:if>
+          <xsl:apply-templates select="d:description"/>
+          <xsl:if test="d:enumvalue/d:purpose | d:enumvalue/d:description">
+            <variablelist spacing="compact">
+              <xsl:apply-templates select="d:enumvalue" mode="reference"/>
+            </variablelist>
+          </xsl:if>
+        </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() &gt; 1">
+      <xsl:text>&#10;</xsl:text>
+    </xsl:if>
+
+    <xsl:text>&#10;</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:call-template name="highlight-text">
+      <xsl:with-param name="text" select="$header"/>
+    </xsl:call-template>
+
+    <!-- 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:call-template name="highlight-text">
+      <xsl:with-param name="text" select="' };'"/>
+    </xsl:call-template>
+  </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 &gt; count(d:enumvalue))">
+      <xsl:variable name="value" select="d: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::d:name"/>
+
+        <xsl:if test="$value/d:default">
+          <xsl:text> = </xsl:text>
+          <xsl:value-of select="$value/d:default/*|$value/d: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 &lt; $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 &lt; $max-columns)">
+        <xsl:text>&#10;</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/d:purpose or $value/d: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::d:name"/>
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$value/attribute::d:name"/>
+        </xsl:otherwise>
+      </xsl:choose>
+
+      <!-- If the enumeration value has a default,
+           print it. -->
+      <xsl:if test="$value/d:default">
+        <xsl:text> = </xsl:text>
+        <xsl:apply-templates
+          select="$value/d:default/*|$value/d: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="d:enumvalue" mode="reference">
+    <xsl:if test="d:purpose or d: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="d:purpose|d:description" mode="comment"/>
+        </listitem>
+      </varlistentry>
+    </xsl:if>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/api/utility.xsl b/xsl/api/utility.xsl
new file mode 100644 (file)
index 0000000..990950f
--- /dev/null
@@ -0,0 +1,54 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+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>
+
+  <!--   get name of first ancestor-or-self which is a class, struct or union -->
+  <xsl:template name="object-name">
+    <xsl:variable name="ancestors" select="ancestor-or-self::d:class |
+      ancestor-or-self::d:class-specialization |
+      ancestor-or-self::d:struct |
+      ancestor-or-self::d:struct-specialization |
+      ancestor-or-self::d:union |
+      ancestor-or-self::d:union-specialization"/>
+    <xsl:value-of select="$ancestors[last()]/@name"/>
+  </xsl:template>
+
+  <!--   get name of access specification that we are inside -->
+  <xsl:template name="access-name">
+    <xsl:variable name="ancestors" select="ancestor-or-self::d:access |
+      ancestor-or-self::d:class |
+      ancestor-or-self::d:class-specialization |
+      ancestor-or-self::d:struct |
+      ancestor-or-self::d:struct-specialization |
+      ancestor-or-self::d:union |
+      ancestor-or-self::d:union-specialization"/>
+    <xsl:choose>
+      <xsl:when test="name($ancestors[last()])='access'">
+        <xsl:value-of select="$ancestors[last()]/@name"/>
+      </xsl:when>
+      <xsl:otherwise>
+        public
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/api/xhtml.xsl b/xsl/api/xhtml.xsl
new file mode 100644 (file)
index 0000000..51f0334
--- /dev/null
@@ -0,0 +1,39 @@
+<?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 exclude-result-prefixes="d"
+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:d="http://docbook.org/ns/docbook"
+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"/>
+
+  <!-- Bring in the fast chunking overrides.  There's nothing
+       that we need to override, so include instead of importing it. -->
+  <xsl:include
+    href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunkfast.xsl"/>
+  
+  <!-- We have to make sure that our templates override all
+       docbook templates.  Therefore, we include our own templates
+       instead of importing them.  In order for this to work,
+       the stylesheets included here cannot also include each other -->
+  <xsl:include href="chunk-common.xsl"/>
+  <xsl:include href="docbook-layout.xsl"/>
+  <xsl:include href="navbar.xsl"/>
+  <xsl:include href="admon.xsl"/>
+  <xsl:include href="xref.xsl"/>
+  <xsl:include href="relative-href.xsl"/>
+  <xsl:include href="callout.xsl"/>
+  <xsl:include href="html-base.xsl"/>
+
+</xsl:stylesheet>
index bcadd04be054454ac364f0d19c98e6794cff3745..1a52f6df4e578391924cab588ce95936504aba6d 100644 (file)
@@ -38,14 +38,14 @@ xmlns:suwl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks"
 <xsl:template match="d:link" name="ulink">
   <xsl:variable name="link">
     <a>
-      <xsl:if test="@xml:id">
+      <xsl:if test="@id">
         <xsl:attribute name="name">
-          <xsl:value-of select="@xml:id"/>
+          <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:with-param name="target" select="@href"/>
         </xsl:call-template>
       </xsl:attribute>
       <xsl:if test="$link.target != ''">
@@ -55,7 +55,7 @@ xmlns:suwl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks"
       </xsl:if>
       <xsl:choose>
         <xsl:when test="count(child::node())=0">
-          <xsl:value-of select="@url"/>
+          <xsl:value-of select="@href"/>
         </xsl:when>
         <xsl:otherwise>
           <xsl:apply-templates/>