]> 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 18:00:38 +0000 (18:00 +0000)
committerrankoo <rankoo>
Mon, 16 Aug 2010 18:00:38 +0000 (18:00 +0000)
xsl/api/caramel/LICENSE [new file with mode: 0644]
xsl/api/caramel/concept2docbook.xsl [new file with mode: 0644]
xsl/api/caramel/cpp-operators.xml [new file with mode: 0644]
xsl/api/caramel/unparser.xsl [new file with mode: 0644]
xsl/api/doxygen/collect.xsl [new file with mode: 0644]
xsl/api/doxygen/doxygen2boostbook.xsl [new file with mode: 0644]

diff --git a/xsl/api/caramel/LICENSE b/xsl/api/caramel/LICENSE
new file mode 100644 (file)
index 0000000..d26de04
--- /dev/null
@@ -0,0 +1,58 @@
+Software License, Version 1.0
+
+Copyright 2002-2003, Trustees of Indiana University.
+Copyright 2000-2001, University of Notre Dame.
+All rights reserved.
+
+Indiana University has the exclusive rights to license this product under the
+following license.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+  * All redistributions of source code must retain the above copyright notice,
+    the list of authors in the original source code, this list of conditions
+    and the disclaimer listed in this license;
+
+  * All redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the disclaimer listed in this license
+    in the documentation and/or other materials provided with the distribution;
+
+  * Any documentation included with all redistributions must include the
+    following acknowledgement:
+
+      "This product includes software developed at the University of Notre Dame
+      and the Pervasive Technology Labs at Indiana University. For technical
+      information contact Andrew Lumsdaine at the Pervasive Technology Labs at
+      Indiana University.  For administrative and license questions contact the
+      Advanced Research and Technology Institute at 351 West 10th Street.
+      Indianapolis, Indiana 46202, phone 317-278-4100, fax 317-274-5902."
+
+    Alternatively, this acknowledgement may appear in the software itself, and
+    wherever such third-party acknowledgments normally appear.
+
+  * The name Indiana University, the University of Notre Dame or "Caramel"
+    shall not be used to endorse or promote products derived from this software
+    without prior written permission from Indiana University.  For written
+    permission, please contact Indiana University Advanced Research &
+    Technology Institute.
+
+  * Products derived from this software may not be called "Caramel", nor may
+    Indiana University, the University of Notre Dame or "Caramel" appear in
+    their name, without prior written permission of Indiana University Advanced
+    Research & Technology Institute.
+
+Indiana University provides no reassurances that the source code provided does
+not infringe the patent or any other intellectual property rights of any other
+entity.  Indiana University disclaims any liability to any recipient for claims
+brought by any other entity based on infringement of intellectual property
+rights or otherwise.  
+
+LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH NO WARRANTIES
+AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA UNIVERSITY GIVES NO WARRANTIES
+AND MAKES NO REPRESENTATION THAT SOFTWARE IS FREE OF INFRINGEMENT OF THIRD
+PARTY PATENT, COPYRIGHT, OR OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES
+NO WARRANTIES THAT SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES",
+"TRAP DOORS", "WORMS", OR OTHER HARMFUL CODE.  LICENSEE ASSUMES THE ENTIRE RISK
+AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, AND TO THE
+PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING SOFTWARE.
diff --git a/xsl/api/caramel/concept2docbook.xsl b/xsl/api/caramel/concept2docbook.xsl
new file mode 100644 (file)
index 0000000..f3d26d0
--- /dev/null
@@ -0,0 +1,814 @@
+<?xml version="1.0" ?>
+
+<!--
+Copyright (c) 2002-2003 The Trustees of Indiana University.
+                        All rights reserved.
+Copyright (c) 2000-2001 University of Notre Dame. All rights reserved.
+
+   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="* xsl:*"/>
+
+  <xsl:include href="unparser.xsl"/>
+
+  <xsl:key name="concepts" match="d:concept" use="@name"/>
+
+  <!-- The layout type to use for concept descriptions. Can be one of:
+       sgi: simulate the SGI STL documentation
+       austern: simulate the documentation in Generic Programming and the STL,
+         by Matthew H. Austern
+       caramel: simulate the formatting from Caramel
+       -->
+  <xsl:param name="boost.concept.layout" select="'austern'"/>
+
+  <xsl:template match="d:concept">
+    <refentry>
+      <xsl:attribute name="id">
+        <xsl:call-template name="generate.id"/>
+      </xsl:attribute>
+
+      <refmeta>
+        <refentrytitle>Concept <xsl:value-of select="@name"/></refentrytitle>
+        <manvolnum>7</manvolnum>
+      </refmeta>
+
+      <refnamediv>
+        <refname><xsl:value-of select="@name"/></refname>
+        <xsl:if test="d:purpose">
+          <refpurpose>
+            <xsl:apply-templates select="d:purpose/*|d:purpose/text()"/>
+          </refpurpose>
+        </xsl:if>
+      </refnamediv>
+
+      <!--
+      <refentryinfo>
+        <xsl:for-each select="d:copyright | copyright-include | d:legalnotice">
+          <xsl:choose>
+            <xsl:when test="name(.)='copyright'">
+              <copyright><xsl:copy-of select="./node()"/></copyright>
+            </xsl:when>
+            <xsl:when test="name(.)='legalnotice'">
+              <legalnotice><xsl:copy-of select="./node()"/></legalnotice>
+            </xsl:when>
+            <xsl:when test="name(.)='copyright-include'">
+              <copyright><xsl:copy-of select="document(concat('../concepts/', @file))/d:copyright/node()"/></copyright>
+            </xsl:when>
+          </xsl:choose>
+        </xsl:for-each>
+      </refentryinfo>
+-->
+
+    <xsl:if test="d:description">
+      <xsl:if test="d:description">
+        <refsect1>
+          <title>Description</title>
+          <xsl:for-each select="d:description">
+            <xsl:apply-templates/>
+          </xsl:for-each>
+        </refsect1>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:if test="d:refines | refines-when-mutable">
+      <refsect1>
+        <title>Refinement of</title>
+        <itemizedlist>
+          <xsl:if test="d:refines">
+            <xsl:for-each select="d:refines">
+              <listitem>
+                <para>
+                  <xsl:call-template name="concept.link">
+                    <xsl:with-param name="name" select="@concept"/>
+                  </xsl:call-template>
+                </para>
+              </listitem>
+            </xsl:for-each>
+          </xsl:if>
+          <xsl:if test="refines-when-mutable">
+            <xsl:for-each select="refines-when-mutable">
+              <listitem>
+                <para>
+                  <xsl:text>When mutable: </xsl:text>
+                  <xsl:call-template name="concept.link">
+                    <xsl:with-param name="name" select="@concept"/>
+                  </xsl:call-template>
+                </para>
+              </listitem>
+            </xsl:for-each>
+          </xsl:if>
+        </itemizedlist>
+      </refsect1>
+    </xsl:if>
+
+    <!-- This part must be run even if there are no associated types to print out, so the hidden type definitions can be found -->
+    <xsl:variable name="definition_list">
+      <xsl:call-template name="make-definition-list">
+        <xsl:with-param name="typedefs" select="define-type | associated-type"/>
+        <xsl:with-param name="definition_list">
+          <xsl:for-each select="d:param/@name">
+            @(@<xsl:value-of select="."/>=<xsl:value-of select="."/>@)@
+          </xsl:for-each>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <!-- <xsl:message>Definition list: <xsl:value-of select="$definition_list"/></xsl:message> -->
+
+    <xsl:call-template name="print-associated-types">
+      <xsl:with-param name="typedefs" select="associated-type"/>
+      <xsl:with-param name="definition_list" select="$definition_list"/>
+    </xsl:call-template>
+
+    <xsl:call-template name="concept.notation">
+      <xsl:with-param name="definition_list" select="$definition_list"/>
+    </xsl:call-template>
+
+    <xsl:variable name="notations">
+      <xsl:for-each select="d:notation">
+        @@(@@<xsl:call-template name="unparse-cpp">
+          <xsl:with-param name="typeref" select="*[1]"/>
+          <xsl:with-param name="definition_list" select="$definition_list"/>
+          <xsl:with-param name="ignore-cv" select="true()"/>
+          <xsl:with-param name="ignore-references" select="true()"/>
+        </xsl:call-template>@@=@@<xsl:value-of select="normalize-space(@variables)"/>@@)@@
+      </xsl:for-each>
+    </xsl:variable>
+
+    <!-- <xsl:message>Notations: <xsl:value-of select="normalize-space($notations)"/> End notations</xsl:message> -->
+
+    <xsl:if test="d:definition">
+      <refsect1>
+      <title>Definitions</title>
+        <xsl:for-each select="d:definition">
+          <p><xsl:apply-templates/></p>
+        </xsl:for-each>
+      </refsect1>
+    </xsl:if>
+
+    <xsl:if test="valid-type-expression | d:models | models-when-mutable">
+      <refsect1>
+        <title>Type expressions</title>
+        <variablelist>
+          <xsl:for-each select="d:models">
+            <varlistentry>
+              <term/>
+              <listitem>
+                <para>
+                  <xsl:call-template name="unparse-operator-definition">
+                    <xsl:with-param name="typeref" select="."/>
+                    <xsl:with-param name="operator_nodeset" select="key('concepts', @concept)/models-sentence/node()"/>
+                    <xsl:with-param name="definition_list" select="$definition_list"/>
+                    <xsl:with-param name="notations" select="$notations"/>
+                    <xsl:with-param name="ignore-cv" select="false()"/>
+                    <xsl:with-param name="self" select="@concept"/>
+                    <xsl:with-param name="use-code-block" select="true()"/>
+                  </xsl:call-template>
+                </para>
+              </listitem>
+            </varlistentry>
+          </xsl:for-each>
+          <xsl:for-each select="models-when-mutable">
+            <varlistentry>
+              <term>Only when mutable</term>
+              <listitem>
+                <para>
+                  <xsl:call-template name="unparse-operator-definition">
+                    <xsl:with-param name="typeref" select="."/>
+                    <xsl:with-param name="operator_nodeset" select="key('concepts', @concept)/models-sentence/node()"/>
+                    <xsl:with-param name="definition_list" select="$definition_list"/>
+                    <xsl:with-param name="notations" select="$notations"/>
+                    <xsl:with-param name="ignore-cv" select="false()"/>
+                    <xsl:with-param name="self" select="@concept"/>
+                    <xsl:with-param name="use-code-block" select="true()"/>
+                  </xsl:call-template>
+                </para>
+              </listitem>
+            </varlistentry>
+          </xsl:for-each>
+          <xsl:for-each select="valid-type-expression">
+            <varlistentry>
+              <term><xsl:value-of select="@name"/></term>
+              <listitem>
+                <para>
+                  <type>
+                    <xsl:call-template name="unparse-cpp">
+                      <xsl:with-param name="typeref" select="*[2]"/>
+                      <xsl:with-param name="definition_list" select="$definition_list"/>
+                      <xsl:with-param name="notations" select="normalize-space($notations)"/>
+                    </xsl:call-template>
+                  </type>
+
+                  <xsl:comment/> must be
+                  <xsl:for-each select="return-type/*">
+                    <xsl:if test="position()!=1 and last()!=2">, </xsl:if>
+                    <xsl:if test="position()=last() and last()!=1"> and </xsl:if>
+                    <xsl:call-template name="unparse-constraint">
+                      <xsl:with-param name="constraint" select="."/>
+                      <xsl:with-param name="definition_list" select="$definition_list"/>
+                      <xsl:with-param name="type-expr-mode" select="true()"/>
+                    </xsl:call-template>
+                  </xsl:for-each><xsl:comment/>.
+                </para>
+
+                <xsl:if test="d:description">
+                  <xsl:for-each select="d:description">
+                    <xsl:apply-templates/>
+                  </xsl:for-each>
+                </xsl:if>
+              </listitem>
+            </varlistentry>
+          </xsl:for-each>
+        </variablelist>
+      </refsect1>
+    </xsl:if>
+
+    <xsl:if test="valid-expression">
+      <refsect1>
+      <title>Valid expressions</title>
+
+      <xsl:variable name="columns">
+        <xsl:if test="valid-expression/return-type">
+          <xsl:text>T</xsl:text>
+        </xsl:if>
+        <xsl:if test="valid-expression/d:precondition">
+          <xsl:text>P</xsl:text>
+        </xsl:if>
+        <xsl:if test="valid-expression/d:semantics">
+          <xsl:text>S</xsl:text>
+        </xsl:if>
+        <xsl:if test="valid-expression/d:postcondition">
+          <xsl:text>O</xsl:text>
+        </xsl:if>
+      </xsl:variable>
+
+      <informaltable>
+        <tgroup>
+          <xsl:attribute name="cols">
+            <xsl:value-of select="string-length($columns) + 2"/>
+          </xsl:attribute>
+          <thead>
+            <row>
+              <entry>Name</entry>
+              <entry>Expression</entry>
+              <xsl:if test="contains($columns, 'T')">
+                <entry>Type</entry>
+              </xsl:if>
+              <xsl:if test="contains($columns, 'P')">
+                <entry>Precondition</entry>
+              </xsl:if>
+              <xsl:if test="contains($columns, 'S')">
+                <entry>Semantics</entry>
+              </xsl:if>
+              <xsl:if test="contains($columns, 'O')">
+                <entry>Postcondition</entry>
+              </xsl:if>
+            </row>
+          </thead>
+          <tbody>
+            <xsl:apply-templates select="valid-expression">
+              <xsl:with-param name="definition_list"
+                select="$definition_list"/>
+              <xsl:with-param name="notations"
+                select="normalize-space($notations)"/>
+              <xsl:with-param name="columns" select="$columns"/>
+            </xsl:apply-templates>
+          </tbody>
+        </tgroup>
+      </informaltable>
+      <!-- Doug prefers the table
+      <variablelist>
+        <xsl:for-each select="valid-expression">
+          <xsl:variable name="as-cxx-value">
+            <xsl:call-template name="unparse-cpp">
+              <xsl:with-param name="typeref" select="*[1]"/>
+              <xsl:with-param name="definition_list" select="$definition_list"/>
+              <xsl:with-param name="notations" select="normalize-space($notations)"/>
+            </xsl:call-template>
+          </xsl:variable>
+          <varlistentry>
+            <term><xsl:value-of select="@name"/>: <literal><xsl:value-of select="$as-cxx-value"/></literal></term>
+            <listitem><variablelist>
+              <xsl:if test="return-type/*">
+                <varlistentry><term>Return value</term><listitem><para>
+                  <xsl:for-each select="return-type/*">
+                    <xsl:if test="position()!=1 and last()!=2">, </xsl:if>
+                    <xsl:if test="position()=last() and last()!=1"> and </xsl:if>
+                    <xsl:call-template name="unparse-constraint">
+                      <xsl:with-param name="constraint" select="."/>
+                      <xsl:with-param name="definition_list" select="$definition_list"/>
+                      <xsl:with-param name="capitalize" select="position()=1"/>
+                    </xsl:call-template>
+                  </xsl:for-each>
+                </para></listitem></varlistentry>
+              </xsl:if>
+
+              <xsl:for-each select="d:precondition">
+                <varlistentry><term>Precondition</term><listitem><para>
+                  <xsl:apply-templates/>
+                </para></listitem></varlistentry>
+              </xsl:for-each>
+
+              <xsl:for-each select="d:semantics">
+                <varlistentry><term>Semantics</term><listitem><para>
+                  <xsl:apply-templates/>
+                </para></listitem></varlistentry>
+              </xsl:for-each>
+
+              <xsl:for-each select="d:postcondition">
+                <varlistentry><term>Postcondition</term><listitem><para>
+                  <xsl:apply-templates/>
+                </para></listitem></varlistentry>
+              </xsl:for-each>
+
+            </variablelist></listitem>
+          </varlistentry>
+
+        </xsl:for-each>
+      </variablelist>
+-->
+      </refsect1>
+    </xsl:if>
+
+    <xsl:if test="d:complexity">
+      <refsect1>
+      <title>Complexity</title>
+        <xsl:for-each select="d:complexity">
+          <para><xsl:apply-templates/></para>
+        </xsl:for-each>
+      </refsect1>
+    </xsl:if>
+
+    <xsl:if test="d:invariant">
+      <refsect1>
+      <title>Invariants</title>
+      <variablelist>
+        <xsl:for-each select="d:invariant">
+          <varlistentry>
+            <term><xsl:value-of select="@name"/></term>
+            <listitem>
+              <para><xsl:apply-templates/></para>
+            </listitem>
+          </varlistentry>
+        </xsl:for-each>
+      </variablelist>
+      </refsect1>
+    </xsl:if>
+
+    <xsl:if test="example-model">
+      <refsect1>
+      <title>Models</title>
+        <itemizedlist>
+        <xsl:for-each select="example-model">
+          <listitem>
+            <simplelist type="inline">
+            <xsl:for-each select="*">
+              <xsl:variable name="example-value">
+                <xsl:call-template name="unparse-cpp">
+                  <xsl:with-param name="typeref" select="."/>
+                  <xsl:with-param name="definition_list" select="$definition_list"/>
+                </xsl:call-template>
+              </xsl:variable>
+              <member><type><xsl:value-of select="$example-value"/></type></member>
+            </xsl:for-each>
+            </simplelist>
+          </listitem>
+        </xsl:for-each>
+        </itemizedlist>
+      </refsect1>
+    </xsl:if>
+
+    <xsl:variable name="see-also-list-0" select="concept-ref | see-also | d:refines | refines-when-mutable | models-as-first-arg | d:models | models-when-mutable"/>
+    <xsl:variable name="see-also-list-1" select="$see-also-list-0[string(@name | @concept) != string(../@name)]"/>
+    <xsl:variable name="see-also-list" select="$see-also-list-1[not(string(@name|@concept) = (preceding::*/@name | preceding::*/@concept | ancestor::*/@name | ancestor::*/@concept))]"/>
+    <xsl:if test="$see-also-list">
+      <refsect1>
+        <title>See also</title>
+        <itemizedlist>
+          <xsl:for-each select="$see-also-list">
+            <xsl:sort select="string(@name|@concept)" data-type="text"/>
+            <listitem>
+              <para>
+                <xsl:call-template name="concept.link">
+                  <xsl:with-param name="name" select="@name|@concept"/>
+                </xsl:call-template>
+              </para>
+            </listitem>
+          </xsl:for-each>
+        </itemizedlist>
+      </refsect1>
+    </xsl:if>
+
+  </refentry>
+  </xsl:template>
+
+  <xsl:template name="unparse-constraint">
+    <xsl:param name="constraint"/>
+    <xsl:param name="definition_list"/>
+    <xsl:param name="type-expr-mode" select="false()"/>
+    <xsl:param name="capitalize" select="true()"/>
+
+    <xsl:choose>
+
+      <xsl:when test="name($constraint)='require-same-type'">
+        <xsl:if test="$type-expr-mode">identical to </xsl:if>
+        <type>
+          <xsl:call-template name="unparse-cpp">
+            <xsl:with-param name="typeref" select="$constraint/*[1]"/>
+            <xsl:with-param name="definition_list" select="definition_list"/>
+          </xsl:call-template>
+        </type>
+      </xsl:when>
+
+      <xsl:when test="name($constraint)='convertible-to'">
+        <xsl:choose>
+          <xsl:when test="$type-expr-mode">convertible to </xsl:when>
+          <xsl:when test="not($type-expr-mode) and $capitalize">Convertible to </xsl:when>
+          <xsl:when test="not($type-expr-mode) and not($capitalize)">convertible to </xsl:when>
+        </xsl:choose>
+        <type>
+          <xsl:call-template name="unparse-cpp">
+            <xsl:with-param name="typeref" select="$constraint/*[1]"/>
+            <xsl:with-param name="definition_list" select="definition_list"/>
+          </xsl:call-template>
+        </type>
+      </xsl:when>
+
+      <xsl:when test="name($constraint)='derived-from'">
+        <xsl:choose>
+          <xsl:when test="$type-expr-mode">derived from </xsl:when>
+          <xsl:when test="not($type-expr-mode) and $capitalize">Derived from </xsl:when>
+          <xsl:when test="not($type-expr-mode) and not($capitalize)">derived from </xsl:when>
+        </xsl:choose>
+        <type>
+          <xsl:call-template name="unparse-cpp">
+            <xsl:with-param name="typeref" select="$constraint/*[1]"/>
+            <xsl:with-param name="definition_list" select="definition_list"/>
+          </xsl:call-template>
+        </type>
+      </xsl:when>
+
+      <xsl:when test="name($constraint)='assignable-to'">
+        <xsl:choose>
+          <xsl:when test="$type-expr-mode">assignable to </xsl:when>
+          <xsl:when test="not($type-expr-mode) and $capitalize">Assignable to </xsl:when>
+          <xsl:when test="not($type-expr-mode) and not($capitalize)">assignable to </xsl:when>
+        </xsl:choose>
+        <type>
+          <xsl:call-template name="unparse-cpp">
+            <xsl:with-param name="typeref" select="$constraint/*[1]"/>
+            <xsl:with-param name="definition_list" select="definition_list"/>
+          </xsl:call-template>
+        </type>
+      </xsl:when>
+
+      <xsl:when test="name($constraint)='models-as-first-arg'">
+        <xsl:choose>
+          <xsl:when test="$type-expr-mode"> a model </xsl:when>
+          <xsl:when test="not($type-expr-mode) and $capitalize"> Models </xsl:when>
+          <xsl:when test="not($type-expr-mode) and not($capitalize)"> models </xsl:when>
+        </xsl:choose>
+        <xsl:if test="$constraint/*"><xsl:comment/>
+          (along with <xsl:for-each select="$constraint/*"><type>
+              <xsl:call-template name="unparse-cpp">
+                <xsl:with-param name="typeref" select="."/>
+                <xsl:with-param name="definition_list" select="definition_list"/>
+              </xsl:call-template>
+            </type>
+            <xsl:choose>
+              <xsl:when test="position()=last()"/>
+              <xsl:when test="position()=last()-1 and last()=2"> and </xsl:when>
+              <xsl:when test="position()=last()-1 and last()!=2">, and </xsl:when>
+              <xsl:otherwise>, </xsl:otherwise>
+            </xsl:choose><xsl:comment/>
+          </xsl:for-each><xsl:comment/>) <xsl:comment/>
+        </xsl:if><xsl:comment/>
+        <xsl:if test="$type-expr-mode"> of </xsl:if>
+        <xsl:call-template name="concept.link">
+          <xsl:with-param name="name" select="$constraint/@concept"/>
+        </xsl:call-template>
+      </xsl:when>
+
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="make-definition-list">
+    <xsl:param name="typedefs"/>
+    <xsl:param name="definition_list"/>
+
+    <xsl:choose>
+      <xsl:when test="$typedefs">
+        <xsl:variable name="type_definition">
+          <xsl:if test="name($typedefs[1]/*[1])!='description'">
+            <xsl:call-template name="unparse-cpp">
+              <xsl:with-param name="typeref" select="$typedefs[1]/*[1]"/>
+              <xsl:with-param name="definition_list" select="$definition_list"/>
+            </xsl:call-template>
+          </xsl:if>
+        </xsl:variable>
+
+        <xsl:variable name="new_type_definition">
+          <xsl:choose>
+            <xsl:when test="name($typedefs[1])='associated-type'">
+              <xsl:value-of select="$typedefs[1]/@name"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="$type_definition"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
+
+        <xsl:call-template name="make-definition-list">
+          <xsl:with-param name="typedefs" select="$typedefs[position()!=1]"/>
+          <xsl:with-param name="definition_list" select="concat($definition_list, ' @(@', $typedefs[1]/@name, '=', $new_type_definition, '@)@')"/>
+        </xsl:call-template>
+
+      </xsl:when>
+
+      <xsl:otherwise> <!-- End of expression list, emit the results that have accumulated -->
+        <xsl:value-of select="$definition_list"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="print-associated-types">
+    <xsl:param name="typedefs"/>
+    <xsl:param name="definition_list"/>
+
+    <xsl:if test="$typedefs">
+      <refsect1>
+        <title>Associated types</title>
+
+        <xsl:choose>
+          <xsl:when test="$boost.concept.layout='sgi'">
+            <informaltable>
+              <tgroup cols="2">
+                <tbody>
+                  <xsl:apply-templates select="associated-type" mode="sgi">
+                    <xsl:with-param name="definition_list"
+                      select="$definition_list"/>
+                  </xsl:apply-templates>
+                </tbody>
+              </tgroup>
+            </informaltable>
+          </xsl:when>
+          <xsl:when test="$boost.concept.layout='austern'">
+            <itemizedlist>
+              <xsl:apply-templates select="associated-type" mode="austern">
+                <xsl:with-param name="definition_list"
+                  select="$definition_list"/>
+              </xsl:apply-templates>
+            </itemizedlist>
+          </xsl:when>
+          <xsl:when test="$boost.concept.layout='caramel'">
+            <segmentedlist>
+              <segtitle>Name</segtitle>
+              <segtitle>Code</segtitle>
+              <segtitle>Description</segtitle>
+              <xsl:for-each select="$typedefs">
+                <xsl:variable name="type_definition">
+                  <xsl:call-template name="unparse-cpp">
+                    <xsl:with-param name="typeref" select="*[1]"/>
+                    <xsl:with-param name="definition_list" select="$definition_list"/>
+                  </xsl:call-template>
+                </xsl:variable>
+                <seglistitem>
+                  <seg><xsl:value-of select="@name"/></seg>
+                  <seg><xsl:value-of select="$type_definition"/></seg>
+                  <seg>
+                    <xsl:for-each select="d:description">
+                      <xsl:call-template name="description"/>
+                    </xsl:for-each>
+                  </seg>
+                </seglistitem>
+              </xsl:for-each>
+            </segmentedlist>
+          </xsl:when>
+        </xsl:choose>
+      </refsect1>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="comma-list">
+    <xsl:param name="list"/>
+
+    <xsl:if test="$list!=''">
+      <term><varname>
+        <xsl:if test="substring-before($list,' ')=''"><xsl:value-of select="$list"/></xsl:if>
+        <xsl:value-of select="substring-before($list,' ')"/>
+      </varname></term>
+      <xsl:call-template name="comma-list">
+  <xsl:with-param name="list" select="substring-after($list,' ')"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="associated-type" mode="sgi">
+    <row>
+      <entry><simpara><xsl:value-of select="@name"/></simpara></entry>
+
+      <entry>
+        <para>
+          <xsl:for-each select="d:description">
+            <xsl:apply-templates/>
+          </xsl:for-each>
+        </para>
+      </entry>
+    </row>
+  </xsl:template>
+
+  <xsl:template match="associated-type" mode="austern">
+    <xsl:param name="definition_list" select="''"/>
+
+    <listitem>
+      <para>
+        <emphasis role="bold"><xsl:value-of select="@name"/></emphasis>
+
+        <xsl:call-template name="preformatted">
+          <xsl:with-param name="text">
+            <xsl:call-template name="unparse-cpp">
+              <xsl:with-param name="typeref" select="*[1]"/>
+              <xsl:with-param name="definition_list" select="$definition_list"/>
+            </xsl:call-template>
+          </xsl:with-param>
+        </xsl:call-template>
+
+        <xsl:for-each select="d:description">
+          <xsl:apply-templates/>
+        </xsl:for-each>
+      </para>
+    </listitem>
+  </xsl:template>
+
+  <xsl:template match="valid-expression">
+    <xsl:param name="definition_list"/>
+    <xsl:param name="notations"/>
+    <xsl:param name="columns"/>
+
+    <row>
+      <entry><simpara><xsl:value-of select="@name"/></simpara></entry>
+
+      <entry>
+        <simpara>
+          <xsl:call-template name="unparse-cpp">
+            <xsl:with-param name="typeref" select="*[1]"/>
+            <xsl:with-param name="definition_list" select="$definition_list"/>
+            <xsl:with-param name="notations" select="$notations"/>
+          </xsl:call-template>
+        </simpara>
+      </entry>
+
+      <xsl:if test="contains($columns, 'T')">
+        <entry>
+          <simpara>
+            <xsl:for-each select="return-type/*">
+              <xsl:if test="position()!=1 and last()!=2">, </xsl:if>
+              <xsl:if test="position()=last() and last()!=1"> and </xsl:if>
+              <xsl:call-template name="unparse-constraint">
+                <xsl:with-param name="constraint" select="."/>
+                <xsl:with-param name="definition_list"
+                  select="$definition_list"/>
+                <xsl:with-param name="capitalize" select="position()=1"/>
+              </xsl:call-template>
+            </xsl:for-each>
+          </simpara>
+        </entry>
+      </xsl:if>
+
+      <xsl:if test="contains($columns, 'P')">
+        <entry>
+          <xsl:for-each select="d:precondition">
+            <simpara><xsl:apply-templates/></simpara>
+          </xsl:for-each>
+        </entry>
+      </xsl:if>
+
+      <xsl:if test="contains($columns, 'S')">
+        <entry>
+          <xsl:for-each select="d:semantics">
+            <simpara><xsl:apply-templates/></simpara>
+          </xsl:for-each>
+        </entry>
+      </xsl:if>
+
+      <xsl:if test="contains($columns, 'O')">
+        <entry>
+          <xsl:for-each select="d:postcondition">
+            <simpara><xsl:apply-templates/></simpara>
+          </xsl:for-each>
+        </entry>
+      </xsl:if>
+    </row>
+  </xsl:template>
+
+  <xsl:template name="concept.notation">
+    <xsl:param name="definition_list"/>
+
+    <refsect1>
+      <title>Notation</title>
+      <variablelist>
+        <xsl:for-each select="d:param">
+          <varlistentry>
+            <term><xsl:value-of select="@name"/></term>
+            <listitem>
+              <simpara>
+                <xsl:text>A type playing the role of </xsl:text>
+                <xsl:value-of select="@role"/>
+                <xsl:text> in the </xsl:text>
+                <xsl:call-template name="concept.link">
+                  <xsl:with-param name="name" select="../@name"/>
+                </xsl:call-template>
+                <xsl:text> concept.</xsl:text>
+              </simpara>
+            </listitem>
+          </varlistentry>
+        </xsl:for-each>
+        <xsl:for-each select="d:notation">
+          <xsl:variable name="notation_name">
+            <xsl:call-template name="comma-list">
+              <xsl:with-param name="list"
+                select="normalize-space(@variables)"/>
+            </xsl:call-template>
+          </xsl:variable>
+
+          <varlistentry>
+            <xsl:copy-of select="$notation_name"/>
+            <listitem>
+              <simpara>
+                <xsl:variable name="output-plural" select="substring-before(normalize-space(@variables),' ')!=''"/>
+                <xsl:if test="name(*[1])='sample-value'">Object<xsl:if test="$output-plural">s</xsl:if> of type </xsl:if>
+                <xsl:variable name="typeref-to-print" select="*[name()!='sample-value'] | sample-value/*[name()!='sample-value']"/>
+                <xsl:call-template name="unparse-cpp">
+                  <xsl:with-param name="typeref" select="$typeref-to-print"/>
+                  <xsl:with-param name="definition_list" select="$definition_list"/>
+                  <xsl:with-param name="ignore-cv" select="true()"/>
+                  <xsl:with-param name="ignore-references" select="true()"/>
+                </xsl:call-template>
+              </simpara>
+            </listitem>
+          </varlistentry>
+        </xsl:for-each>
+      </variablelist>
+    </refsect1>
+  </xsl:template>
+
+  <xsl:template name="concept.link">
+    <xsl:param name="name" select="text()"/>
+    <xsl:param name="warn" select="true()"/>
+    <xsl:param name="text" select="$name"/>
+    <xsl:variable name="node" select="key('concepts', $name)"/>
+
+    <xsl:choose>
+      <xsl:when test="count($node)=0">
+        <xsl:if test="$warn">
+          <xsl:message>
+            <xsl:text>warning: cannot find concept '</xsl:text>
+            <xsl:value-of select="$name"/>
+            <xsl:text>'</xsl:text>
+          </xsl:message>
+        </xsl:if>
+        <xsl:value-of select="$text"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <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="$text"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="remove-whitespace">
+    <xsl:param name="text" select="text()"/>
+
+    <xsl:variable name="normalized" select="normalize-space($text)"/>
+    <xsl:choose>
+      <xsl:when test="contains($normalized, ' ')">
+        <xsl:value-of select="substring-before($normalized, ' ')"/>
+        <xsl:call-template name="remove-whitespace">
+          <xsl:with-param name="text"
+            select="substring-after($normalized, ' ')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$normalized"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="d:concept" mode="generate.id">
+    <xsl:call-template name="remove-whitespace">
+      <xsl:with-param name="text" select="@name"/>
+    </xsl:call-template>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/xsl/api/caramel/cpp-operators.xml b/xsl/api/caramel/cpp-operators.xml
new file mode 100644 (file)
index 0000000..1ae0803
--- /dev/null
@@ -0,0 +1,279 @@
+<!-- Converted by db4-upgrade version 1.0 -->
+
+<operator-list xmlns="http://docbook.org/ns/docbook" version="5.0">
+  <!-- This list is from Pohl's book, and needs to be checked for accuracy -->
+
+  <op name="postincrement">
+    <apply priority="100"><arg num="1"/>++</apply> <!-- No assoc - always use parentheses -->
+    <impl position="method">operator++(int)</impl>
+  </op>
+
+  <op name="postdecrement">
+    <apply priority="100"><arg num="1"/>--</apply>
+    <impl position="method">operator--(int)</impl>
+  </op>
+
+  <op name="apply-function">
+    <apply priority="100"><name/>(<arg-list start="1" priority="30"/>)</apply>
+    <impl position="freestanding"><name/>(<arg-list/>)</impl>
+  </op>
+
+  <op name="apply-method">
+    <apply priority="100" assoc="1"><arg num="1"/>.<name/>(<arg-list start="2" priority="30"/>)</apply>
+    <impl position="method"><name/>(<arg-list/>)</impl>
+  </op>
+
+  <op name="pointer-apply-method">
+    <apply priority="100" assoc="1"><arg num="1"/>-&gt;<name/>(<arg-list start="2" priority="30"/>)</apply>
+    <impl>Error</impl>
+  </op>
+
+  <op name="apply-funcobj">
+    <apply priority="100" assoc="1"><arg num="1"/>(<arg-list start="2" priority="30"/>)</apply>
+    <impl position="method">operator()(<arg-list/>)</impl>
+  </op>
+
+  <op name="construct">
+    <apply priority="100"><arg num="1"/>(<arg-list start="2" priority="30"/>)</apply>
+    <impl position="method"><self/>(<arg-list/>)</impl>
+  </op>
+
+  <op name="subscript">
+    <apply priority="100" assoc="1"><arg num="1"/>[<arg num="2" priority="0"/>]</apply>
+    <impl position="method">operator[](<arg-list/>)</impl>
+  </op>
+
+  <op name="class-member">
+    <apply priority="100" assoc="1"><arg num="1"/>.<name/></apply>
+    <impl>Error</impl>
+  </op>
+
+  <op name="pointer-member">
+    <!-- Note: non-testable constraint -->
+    <apply priority="100"><arg num="1" assoc="1"/>-&gt;{member-name} (return type is pointer-to-object type)</apply>
+    <impl>operator-&gt;(<arg-list/>)</impl>
+  </op>
+
+  <op name="preincrement">
+    <apply priority="95">++<arg num="1"/></apply>
+    <impl position="method">operator++(<arg-list/>)</impl>
+  </op>
+
+  <op name="predecrement">
+    <apply priority="95">--<arg num="1"/></apply>
+    <impl position="method">operator--(<arg-list/>)</impl>
+  </op>
+
+  <op name="logical-not">
+    <apply priority="95" assoc="1">!<arg num="1"/></apply>
+    <impl position="method">operator!(<arg-list/>)</impl>
+  </op>
+
+  <op name="bitwise-not">
+    <apply priority="95" assoc="1">~<arg num="1"/></apply>
+    <impl position="method">operator~(<arg-list/>)</impl>
+  </op>
+
+  <op name="address-of">
+    <apply priority="95">&amp;<arg num="1"/></apply>
+    <impl position="method">operator&amp;(<arg-list/>)</impl>
+  </op>
+
+  <op name="dereference">
+    <apply priority="95" assoc="1">*<arg num="1"/></apply>
+    <impl position="method">operator*(<arg-list/>)</impl>
+  </op>
+
+  <op name="unary-plus">
+    <apply priority="95">+<arg num="1"/></apply>
+    <impl position="method">operator+(<arg-list/>)</impl>
+  </op>
+
+  <op name="unary-minus">
+    <apply priority="95">-<arg num="1"/></apply>
+    <impl position="method">operator-(<arg-list/>)</impl>
+  </op>
+
+  <op name="class-member-ptr">
+    <apply priority="90" assoc="1"><arg num="1"/>.*<arg num="2"/></apply>
+    <impl>Error</impl>
+  </op>
+
+  <op name="pointer-member-ptr">
+    <apply priority="90" assoc="1"><arg num="1"/>-&gt;*<arg num="2"/></apply>
+    <impl position="method">operator-&gt;*(<arg-list/>)</impl>
+  </op>
+
+  <op name="multiply">
+    <apply priority="90" assoc="1"><arg num="1"/> * <arg num="2"/></apply>
+    <impl position="freestanding">operator * (<arg-list/>)</impl>
+  </op>
+
+  <op name="divide">
+    <apply priority="90" assoc="1"><arg num="1"/> / <arg num="2"/></apply>
+    <impl position="freestanding">operator / (<arg-list/>)</impl>
+  </op>
+
+  <op name="modulus">
+    <apply priority="90" assoc="1"><arg num="1"/> % <arg num="2"/></apply>
+    <impl position="freestanding">operator % (<arg-list/>)</impl>
+  </op>
+
+  <op name="add">
+    <apply priority="85" assoc="1"><arg num="1"/> + <arg num="2"/></apply>
+    <impl position="freestanding">operator + (<arg-list/>)</impl>
+  </op>
+
+  <op name="subtract">
+    <apply priority="85" assoc="1"><arg num="1"/> - <arg num="2"/></apply>
+    <impl position="freestanding">operator - (<arg-list/>)</impl>
+  </op>
+
+  <op name="shift-left">
+    <apply priority="80" assoc="1"><arg num="1"/> &lt;&lt; <arg num="2"/></apply>
+    <impl position="freestanding">operator &lt;&lt; (<arg-list/>)</impl>
+  </op>
+
+  <op name="shift-right">
+    <apply priority="80" assoc="1"><arg num="1"/> &gt;&gt; <arg num="2"/></apply>
+    <impl position="freestanding">operator &gt;&gt; (<arg-list/>)</impl>
+  </op>
+
+  <op name="less-than">
+    <apply priority="75"><arg num="1"/> &lt; <arg num="2"/></apply>
+    <impl position="freestanding">operator &lt; (<arg-list/>)</impl>
+  </op>
+
+  <op name="greater-than">
+    <apply priority="75"><arg num="1"/> &gt; <arg num="2"/></apply>
+    <impl position="freestanding">operator &gt; (<arg-list/>)</impl>
+  </op>
+
+  <op name="less-than-or-equal">
+    <apply priority="75"><arg num="1"/> &lt;= <arg num="2"/></apply>
+    <impl position="freestanding">operator &lt;= (<arg-list/>)</impl>
+  </op>
+
+  <op name="greater-than-or-equal">
+    <apply priority="75"><arg num="1"/> &gt;= <arg num="2"/></apply>
+    <impl position="freestanding">operator &gt;= (<arg-list/>)</impl>
+  </op>
+
+  <op name="equal-to">
+    <apply priority="70"><arg num="1"/> == <arg num="2"/></apply>
+    <impl position="freestanding">operator == (<arg-list/>)</impl>
+  </op>
+
+  <op name="not-equal-to">
+    <apply priority="70"><arg num="1"/> != <arg num="2"/></apply>
+    <impl position="freestanding">operator != (<arg-list/>)</impl>
+  </op>
+
+  <op name="bitwise-and">
+    <apply priority="65" assoc="1"><arg num="1"/> &amp; <arg num="2"/></apply>
+    <impl position="freestanding">operator &amp; (<arg-list/>)</impl>
+  </op>
+
+  <op name="bitwise-or">
+    <apply priority="60" assoc="1"><arg num="1"/> | <arg num="2"/></apply>
+    <impl position="freestanding">operator | (<arg-list/>)</impl>
+  </op>
+
+  <op name="bitwise-xor">
+    <apply priority="55" assoc="1"><arg num="1"/> ^ <arg num="2"/></apply>
+    <impl position="freestanding">operator ^ (<arg-list/>)</impl>
+  </op>
+
+  <op name="logical-and">
+    <apply priority="50" assoc="1"><arg num="1"/> &amp;&amp; <arg num="2"/></apply>
+    <impl position="freestanding">operator &amp;&amp; (<arg-list/>)</impl>
+  </op>
+
+  <op name="logical-or">
+    <apply priority="45" assoc="1"><arg num="1"/> || <arg num="2"/></apply>
+    <impl position="freestanding">operator || (<arg-list/>)</impl>
+  </op>
+
+  <op name="conditional">
+    <apply priority="40" assoc="3"><arg num="1"/> ? <arg num="2"/> : <arg num="3"/></apply>
+    <impl>Error</impl>
+  </op>
+
+  <op name="assign">
+    <apply priority="35" assoc="2"><arg num="1"/> = <arg num="2"/></apply>
+    <impl position="method">operator = (<arg-list/>)</impl>
+  </op>
+
+  <op name="add-assign">
+    <apply priority="35" assoc="2"><arg num="1"/> += <arg num="2"/></apply>
+    <impl position="method">operator += (<arg-list/>)</impl>
+  </op>
+
+  <op name="subtract-assign">
+    <apply priority="35" assoc="2"><arg num="1"/> -= <arg num="2"/></apply>
+    <impl position="method">operator -= (<arg-list/>)</impl>
+  </op>
+
+  <op name="multiply-assign">
+    <apply priority="35" assoc="2"><arg num="1"/> *= <arg num="2"/></apply>
+    <impl position="method">operator *= (<arg-list/>)</impl>
+  </op>
+
+  <op name="divide-assign">
+    <apply priority="35" assoc="2"><arg num="1"/> /= <arg num="2"/></apply>
+    <impl position="method">operator /= (<arg-list/>)</impl>
+  </op>
+
+  <op name="modulus-assign">
+    <apply priority="35" assoc="2"><arg num="1"/> %= <arg num="2"/></apply>
+    <impl position="method">operator %= (<arg-list/>)</impl>
+  </op>
+
+  <op name="shift-left-assign">
+    <apply priority="35" assoc="2"><arg num="1"/> &lt;&lt;= <arg num="2"/></apply>
+    <impl position="method">operator &lt;&lt;= (<arg-list/>)</impl>
+  </op>
+
+  <op name="shift-right-assign">
+    <apply priority="35" assoc="2"><arg num="1"/> &gt;&gt;= <arg num="2"/></apply>
+    <impl position="method">operator &gt;&gt;= (<arg-list/>)</impl>
+  </op>
+
+  <op name="bitwise-and-assign">
+    <apply priority="35" assoc="2"><arg num="1"/> &amp;= <arg num="2"/></apply>
+    <impl position="method">operator &amp;= (<arg-list/>)</impl>
+  </op>
+
+  <op name="bitwise-or-assign">
+    <apply priority="35" assoc="2"><arg num="1"/> |= <arg num="2"/></apply>
+    <impl position="method">operator |= (<arg-list/>)</impl>
+  </op>
+
+  <op name="bitwise-xor-assign">
+    <apply priority="35" assoc="2"><arg num="1"/> ^= <arg num="2"/></apply>
+    <impl position="method">operator ^= (<arg-list/>)</impl>
+  </op>
+
+  <op name="comma">
+    <apply priority="20"><arg num="1"/>, <arg num="2"/></apply>
+    <impl position="freestanding">operator , (<arg-list/>)</impl>
+  </op>
+
+  <op name="function-pointer">
+    <apply><arg num="1"/> (*)(<arg-list start="2" priority="30"/>)</apply>
+    <impl>Error</impl>
+  </op>
+
+  <op name="functorize-operator">
+    <!-- Note: non-testable constraint -->
+    <apply>functorization of operator <name/> on arguments {<arg-list start="1"/>}</apply>
+    <impl>Error</impl>
+  </op>
+
+  <op name="functorize-function">
+    <!-- Note: non-testable constraint -->
+    <apply>functorization of function <name/> on arguments {<arg-list start="1"/>}</apply>
+    <impl>Error</impl>
+  </op>
+
+</operator-list>
diff --git a/xsl/api/caramel/unparser.xsl b/xsl/api/caramel/unparser.xsl
new file mode 100644 (file)
index 0000000..28b71b9
--- /dev/null
@@ -0,0 +1,499 @@
+<?xml version="1.0" ?>
+
+<!--
+Copyright (c) 2002-2003 The Trustees of Indiana University.
+                        All rights reserved.
+Copyright (c) 2000-2001 University of Notre Dame. All rights reserved.
+
+   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="unparse-cpp">
+    <xsl:param name="typeref"/>
+    <xsl:param name="definition_list"/>
+    <xsl:param name="priority">0</xsl:param>
+    <xsl:param name="ignore-cv" select="false()"/>
+    <xsl:param name="ignore-references" select="false()"/>
+    <xsl:param name="notations"/>
+    <xsl:param name="ignore-notation" select="false()"/>
+    <xsl:param name="print-updated-notation" select="false()"/>
+    <xsl:param name="use-typename" select="false()"/>
+    <xsl:param name="const-if-not-mutable-value" select="'const-if-not-mutable'"/>
+
+    <xsl:variable name="notation_check">
+      <xsl:if test="not($ignore-notation)"> <!-- Prevent infinite recursion -->
+       <xsl:call-template name="unparse-cpp">
+         <xsl:with-param name="typeref" select="$typeref"/>
+         <xsl:with-param name="definition_list" select="$definition_list"/>
+         <xsl:with-param name="priority">0</xsl:with-param>
+         <xsl:with-param name="ignore-cv" select="true()"/>
+         <xsl:with-param name="ignore-references" select="true()"/>
+         <xsl:with-param name="notations" select="$notations"/>
+         <xsl:with-param name="ignore-notation" select="true()"/>
+         <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/>
+       </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
+
+    <!--
+    <xsl:message>Notation check: <xsl:value-of select="$notation_check"/>
+                Notations: <xsl:value-of select="$notations"/>
+    </xsl:message> -->
+
+    <xsl:variable name="this_op_priority" select="document('cpp-operators.xml')/operator-list/d:op[@name=name($typeref)]/d:apply/@priority"/>
+
+    <xsl:variable name="result">
+
+      <xsl:variable name="subcall_priority">
+       <xsl:choose>
+         <xsl:when test="true() or ($this_op_priority &gt; $priority)">
+           <xsl:value-of select="$this_op_priority"/>
+         </xsl:when>
+         <!-- <xsl:otherwise>0</xsl:otherwise> -->
+       </xsl:choose>
+      </xsl:variable>
+
+      <xsl:if test="$this_op_priority &lt;= $priority">(</xsl:if>
+
+      <xsl:choose>
+
+       <xsl:when test="name($typeref)='sample-value'"
+         >boost::sample_value &lt; <xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/><xsl:with-param name="ignore-references" select="$ignore-references"/><xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/></xsl:call-template> &gt;()</xsl:when>
+
+       <xsl:when test="name($typeref)='reference-to'"
+         ><xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="priority" select="$subcall_priority"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/><xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/></xsl:call-template><xsl:if test="not($ignore-references)"> &amp;</xsl:if></xsl:when>
+
+       <xsl:when test="name($typeref)='pointer-to'"
+         ><xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="priority" select="$subcall_priority"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/></xsl:call-template> *</xsl:when>
+
+       <xsl:when test="name($typeref)='const'"
+       ><xsl:if test="not($ignore-cv)">const </xsl:if><xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="priority" select="$subcall_priority"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/><xsl:with-param name="ignore-references" select="$ignore-references"/><xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/></xsl:call-template>
+       </xsl:when>
+
+       <xsl:when test="name($typeref)='const-if-not-mutable'"
+       ><xsl:if test="not($ignore-cv)"><xsl:value-of select="$const-if-not-mutable-value"/><xsl:if test="$const-if-not-mutable-value"><xsl:text> </xsl:text></xsl:if></xsl:if><xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="priority" select="$subcall_priority"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/><xsl:with-param name="ignore-references" select="$ignore-references"/><xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/></xsl:call-template>
+       </xsl:when>
+
+       <xsl:when test="name($typeref)='volatile'"
+       ><xsl:if test="not($ignore-cv)">volatile </xsl:if><xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="priority" select="$subcall_priority"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/><xsl:with-param name="ignore-references" select="$ignore-references"/><xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/></xsl:call-template>
+       </xsl:when>
+
+       <xsl:when test="name($typeref)='apply-template'">
+         <xsl:value-of select="$typeref/@name"/>&lt;<xsl:for-each select="$typeref/*">
+             <xsl:if test="position()!=1">, </xsl:if><xsl:comment/>
+             <xsl:call-template name="unparse-cpp">
+               <xsl:with-param name="typeref" select="."/>
+               <xsl:with-param name="definition_list" select="$definition_list"/>
+               <xsl:with-param name="ignore-cv" select="$ignore-cv"/>
+               <xsl:with-param name="notations" select="$notations"/>
+               <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/>
+             </xsl:call-template></xsl:for-each
+           ><xsl:comment/>&gt;</xsl:when>
+
+       <xsl:when test="name($typeref)='get-member-type'">
+         <xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/><xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/></xsl:call-template>::<xsl:value-of select="$typeref/@name"/>
+       </xsl:when>
+
+       <xsl:when test="name($typeref)='type'">
+         <xsl:variable name="typeref_value" select="normalize-space(substring-before(substring-after($definition_list,concat('@(@',$typeref/@name,'=')),'@)@'))"/>
+         <xsl:choose>
+           <xsl:when test="$typeref_value=''">
+             <xsl:value-of select="$typeref/@name"/><xsl:comment/>
+           </xsl:when>
+           <xsl:otherwise>
+             <xsl:value-of select="$typeref_value"/><xsl:comment/>
+           </xsl:otherwise>
+         </xsl:choose>
+       </xsl:when>
+
+       <xsl:when test="name($typeref)='documentation'"/>
+
+       <xsl:when test="document('cpp-operators.xml')/operator-list/d:op[@name=name($typeref)]">
+         <xsl:variable name="op_file" select="document('cpp-operators.xml')/operator-list"/>
+         <xsl:variable name="op_info" select="$op_file/d:op[@name=name($typeref)]/d:apply/."/>
+
+         <xsl:call-template name="unparse-operator-definition">
+           <xsl:with-param name="typeref" select="$typeref"/>
+           <xsl:with-param name="operator_nodeset" select="$op_info/child::node()"/>
+           <xsl:with-param name="my_priority" select="$subcall_priority"/>
+           <xsl:with-param name="definition_list" select="$definition_list"/>
+           <xsl:with-param name="notations" select="$notations"/>
+           <xsl:with-param name="ignore-cv" select="$ignore-cv"/>
+           <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/>
+           <xsl:with-param name="print-updated-notation" select="$print-updated-notation"/>
+         </xsl:call-template>
+
+       </xsl:when>
+
+       <xsl:otherwise>
+         (Unrecognized tag <xsl:value-of select="name($typeref)"/>)
+       </xsl:otherwise>
+      </xsl:choose>
+
+      <!-- Close parenthesis code moved below -->
+
+    </xsl:variable>
+
+    <!-- <xsl:message>ignore-notation = <xsl:value-of select="$ignore-notation"/></xsl:message> -->
+    <!-- <xsl:message>notation_check = <xsl:value-of select="$notation_check"/></xsl:message> -->
+    <!-- <xsl:message>notations = <xsl:value-of select="$notations"/></xsl:message> -->
+    <!-- <xsl:message>result = <xsl:value-of select="$result"/></xsl:message> -->
+
+    <xsl:variable name="used_notation" select="boolean($notation_check) and boolean(substring-before(substring-after($notations, concat('@@(@@', $notation_check, '@@=@@')),'@@)@@'))"/>
+
+    <xsl:variable name="notations2">
+      <!-- Possibly replace from result of unparse-operator-definition -->
+      <xsl:choose>
+       <xsl:when test="contains($result, ' *@@@* ')">
+         <xsl:value-of select="substring-after($result, ' *@@@* ')"/>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:value-of select="$notations"/>
+       </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:variable name="result2">
+      <!-- Possibly replace from result of unparse-operator-definition -->
+      <xsl:choose>
+       <xsl:when test="contains($result, ' *@@@* ')">
+         <xsl:value-of select="substring-before($result, ' *@@@* ')"/>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:value-of select="$result"/>
+       </xsl:otherwise>
+      </xsl:choose>
+      <!-- Close parenthesis code -->
+      <xsl:if test="$this_op_priority &lt;= $priority">)</xsl:if>
+    </xsl:variable>
+
+    <xsl:variable name="notation_varlist">
+      <xsl:choose>
+       <xsl:when test="$used_notation">
+         <xsl:value-of select="substring-before(substring-after($notations2, concat('@@(@@', $notation_check, '@@=@@')), '@@)@@')"/>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:value-of select="$result2"/>
+       </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:variable name="new_varlist" select="substring-after(normalize-space($notation_varlist), ' ')"/>
+
+    <xsl:variable name="notation_var">
+      <xsl:choose>
+       <xsl:when test="not($used_notation)">
+         <xsl:value-of select="$result2"/>
+       </xsl:when>
+       <xsl:when test="$new_varlist=''">
+         <xsl:value-of select="$notation_varlist"/>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:value-of select="substring-before(normalize-space($notation_varlist), ' ')"/>
+       </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- Generate new notation list -->
+    <xsl:variable name="new_notations">
+      <xsl:choose>
+       <xsl:when test="$used_notation">
+         <xsl:value-of select="normalize-space(concat('@@(@@', $notation_check, '@@=@@', $new_varlist, '@@)@@', $notations2))"/>
+         <!-- Duplicate entries always use first occurrance, so I can optimize this -->
+       </xsl:when>
+       <xsl:otherwise><xsl:value-of select="$notations2"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <!-- <xsl:message>final_result = <xsl:value-of select="normalize-space($final_result)"/></xsl:message> -->
+
+    <xsl:call-template name="add-typename"><xsl:with-param name="really-do-it" select="$use-typename"/><xsl:with-param name="type"><xsl:value-of select="normalize-space($notation_var)"/></xsl:with-param></xsl:call-template><xsl:if test="$print-updated-notation"> *@@@* <xsl:value-of select="$new_notations"/></xsl:if>
+
+  </xsl:template>
+
+  <xsl:template name="unparse-operator-definition">
+    <xsl:param name="typeref"/>
+    <xsl:param name="operator_nodeset"/>
+    <xsl:param name="current_start">1</xsl:param>
+    <xsl:param name="my_priority"/>
+    <xsl:param name="definition_list"/>
+    <xsl:param name="notations"/>
+    <xsl:param name="ignore-cv"/>
+    <xsl:param name="self"/>
+    <xsl:param name="use-code-block" select="false()"/>
+    <xsl:param name="print-updated-notation" select="false()"/>
+    <xsl:param name="const-if-not-mutable-value"/>
+
+    <xsl:variable name="op_current" select="$operator_nodeset[position()=1]"/>
+    <xsl:variable name="op_rest" select="$operator_nodeset[position()!=1]"/>
+
+    <xsl:choose>
+
+      <xsl:when test="count($operator_nodeset)=0">
+       <xsl:if test="$print-updated-notation"> *@@@* <xsl:value-of select="$notations"/></xsl:if>
+      </xsl:when>
+
+      <xsl:when test="$op_current != $op_current/../*"> <!-- If I am not an element -->
+       <xsl:value-of select="$op_current"/>
+       <xsl:call-template name="unparse-operator-definition">
+         <xsl:with-param name="typeref" select="$typeref"/>
+         <xsl:with-param name="operator_nodeset" select="$op_rest"/>
+         <xsl:with-param name="my_priority" select="$my_priority"/>
+         <xsl:with-param name="definition_list" select="$definition_list"/>
+         <xsl:with-param name="notations" select="$notations"/>
+         <xsl:with-param name="self" select="$self"/>
+         <xsl:with-param name="use-code-block" select="$use-code-block"/>
+         <xsl:with-param name="print-updated-notation" select="$print-updated-notation"/>
+         <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/>
+       </xsl:call-template>
+      </xsl:when>
+
+      <xsl:when test="name($op_current)='name'">
+       <xsl:value-of select="$typeref/@name"/>
+       <xsl:call-template name="unparse-operator-definition">
+         <xsl:with-param name="typeref" select="$typeref"/>
+         <xsl:with-param name="operator_nodeset" select="$op_rest"/>
+         <xsl:with-param name="my_priority" select="$my_priority"/>
+         <xsl:with-param name="definition_list" select="$definition_list"/>
+         <xsl:with-param name="notations" select="$notations"/>
+         <xsl:with-param name="ignore-cv" select="$ignore-cv"/>
+         <xsl:with-param name="self" select="$self"/>
+         <xsl:with-param name="use-code-block" select="$use-code-block"/>
+         <xsl:with-param name="print-updated-notation" select="$print-updated-notation"/>
+         <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/>
+       </xsl:call-template>
+      </xsl:when>
+
+      <xsl:when test="name($op_current)='self'">
+        <xsl:call-template name="concept.link">
+          <xsl:with-param name="name" select="string($self)"/>
+        </xsl:call-template>
+       <xsl:call-template name="unparse-operator-definition">
+         <xsl:with-param name="typeref" select="$typeref"/>
+         <xsl:with-param name="operator_nodeset" select="$op_rest"/>
+         <xsl:with-param name="my_priority" select="$my_priority"/>
+         <xsl:with-param name="definition_list" select="$definition_list"/>
+         <xsl:with-param name="notations" select="$notations"/>
+         <xsl:with-param name="ignore-cv" select="$ignore-cv"/>
+         <xsl:with-param name="self" select="$self"/>
+         <xsl:with-param name="use-code-block" select="$use-code-block"/>
+         <xsl:with-param name="print-updated-notation" select="$print-updated-notation"/>
+         <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/>
+       </xsl:call-template>
+      </xsl:when>
+
+      <xsl:when test="name($op_current)='arg'">
+       <xsl:variable name="num" select="$op_current/@num"/>
+       <xsl:variable name="assoc" select="$op_current/../@assoc"/>
+       <xsl:variable name="my_priority_before" select="$my_priority"/>
+       <xsl:variable name="my_priority">
+         <xsl:choose>
+           <xsl:when test="count($op_current/@priority)">
+             <xsl:value-of select="$op_current/@priority"/>
+           </xsl:when>
+           <xsl:when test="$assoc and ($num = $assoc)">
+             <xsl:value-of select="$my_priority_before - 1"/>
+           </xsl:when>
+           <xsl:otherwise>
+             <xsl:value-of select="$my_priority"/>
+           </xsl:otherwise>
+         </xsl:choose>
+       </xsl:variable>
+       <xsl:variable name="typeref-result">
+         <xsl:call-template name="unparse-cpp">
+           <xsl:with-param name="typeref" select="$typeref/*[position()=$num]"/>
+           <xsl:with-param name="definition_list" select="$definition_list"/>
+           <xsl:with-param name="priority" select="$my_priority"/>
+           <xsl:with-param name="ignore-cv" select="$ignore-cv"/>
+           <xsl:with-param name="notations" select="$notations"/>
+           <xsl:with-param name="print-updated-notation" select="true()"/>
+           <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/>
+         </xsl:call-template>
+       </xsl:variable>
+       <xsl:variable name="typeref-print" select="normalize-space(substring-before($typeref-result, ' *@@@* '))"/>
+       <xsl:variable name="new_notations" select="normalize-space(substring-after($typeref-result, ' *@@@* '))"/>
+
+       <xsl:choose>
+         <xsl:when test="$use-code-block">
+           <type><xsl:value-of select="$typeref-print"/></type>
+         </xsl:when>
+         <xsl:otherwise>
+           <xsl:value-of select="$typeref-print"/>
+         </xsl:otherwise>
+       </xsl:choose>
+
+       <xsl:call-template name="unparse-operator-definition">
+         <xsl:with-param name="typeref" select="$typeref"/>
+         <xsl:with-param name="operator_nodeset" select="$op_rest"/>
+         <xsl:with-param name="my_priority" select="$my_priority_before"/>
+         <xsl:with-param name="definition_list" select="$definition_list"/>
+         <xsl:with-param name="notations" select="$new_notations"/>
+         <xsl:with-param name="ignore-cv" select="$ignore-cv"/>
+         <xsl:with-param name="self" select="$self"/>
+         <xsl:with-param name="use-code-block" select="$use-code-block"/>
+         <xsl:with-param name="print-updated-notation" select="$print-updated-notation"/>
+         <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/>
+       </xsl:call-template>
+      </xsl:when>
+
+      <xsl:when test="name($op_current)='arg-list'">
+       <xsl:variable name="start" select="$op_current/@start"/>
+       <xsl:variable name="typeref-result">
+         <xsl:choose>
+           <xsl:when test="$current_start &gt;= $start">
+             <xsl:call-template name="unparse-cpp">
+               <xsl:with-param name="typeref" select="$typeref/*[$current_start]"/>
+               <xsl:with-param name="definition_list" select="$definition_list"/>
+               <xsl:with-param name="priority" select="$my_priority"/>
+               <xsl:with-param name="ignore-cv" select="$ignore-cv"/>
+               <xsl:with-param name="notations" select="$notations"/>
+               <xsl:with-param name="print-updated-notation" select="true()"/>
+               <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/>
+             </xsl:call-template>
+           </xsl:when>
+
+           <xsl:otherwise>
+              *@@@* <xsl:value-of select="$notations"/>
+           </xsl:otherwise>
+         </xsl:choose>
+       </xsl:variable>
+
+       <xsl:variable name="typeref-print" select="normalize-space(substring-before($typeref-result, ' *@@@* '))"/>
+       <xsl:variable name="new_notations" select="normalize-space(substring-after($typeref-result, ' *@@@* '))"/>
+
+       <xsl:choose>
+         <xsl:when test="$use-code-block">
+           <type><xsl:value-of select="$typeref-print"/></type>
+         </xsl:when>
+         <xsl:otherwise>
+           <xsl:value-of select="$typeref-print"/>
+         </xsl:otherwise>
+       </xsl:choose>
+
+       <xsl:if test="$current_start &gt;= $start">
+         <xsl:if test="$current_start!=count($typeref/*)">, </xsl:if>
+       </xsl:if>
+
+       <xsl:choose>
+         <xsl:when test="$current_start != count($typeref/*)">
+           <xsl:call-template name="unparse-operator-definition">
+             <xsl:with-param name="typeref" select="$typeref"/>
+             <xsl:with-param name="operator_nodeset" select="$operator_nodeset"/>
+             <xsl:with-param name="current_start" select="$current_start + 1"/>
+             <xsl:with-param name="my_priority" select="$my_priority"/>
+             <xsl:with-param name="definition_list" select="$definition_list"/>
+             <xsl:with-param name="notations" select="$new_notations"/>
+             <xsl:with-param name="ignore-cv" select="$ignore-cv"/>
+             <xsl:with-param name="self" select="$self"/>
+             <xsl:with-param name="use-code-block" select="$use-code-block"/>
+             <xsl:with-param name="print-updated-notation" select="$print-updated-notation"/>
+             <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/>
+           </xsl:call-template>
+         </xsl:when>
+         <xsl:otherwise>
+           <xsl:call-template name="unparse-operator-definition">
+             <xsl:with-param name="typeref" select="$typeref"/>
+             <xsl:with-param name="operator_nodeset" select="$op_rest"/>
+             <xsl:with-param name="my_priority" select="$my_priority"/>
+             <xsl:with-param name="definition_list" select="$definition_list"/>
+             <xsl:with-param name="notations" select="$new_notations"/>
+             <xsl:with-param name="ignore-cv" select="$ignore-cv"/>
+             <xsl:with-param name="self" select="$self"/>
+             <xsl:with-param name="use-code-block" select="$use-code-block"/>
+             <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/>
+           </xsl:call-template>
+         </xsl:otherwise>
+       </xsl:choose>
+      </xsl:when>
+
+      <xsl:otherwise>Invalid tag in operator definition: <xsl:value-of select="name($op_current)"/></xsl:otherwise>
+
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="add-typename">
+    <!-- Adds typename to the front of a string if it is necessary. -->
+    <xsl:param name="type"/> <!-- string to prepend to -->
+    <xsl:param name="params" select="/d:concept/d:param | /d:concept/define-type | /d:concept/associated-type"/>
+      <!-- nodeset of param tags for concept -->
+      <!-- associated types are assumed to be dependent -->
+    <xsl:param name="really-do-it"/> <!-- really change anything? -->
+
+    <xsl:variable name="type-after-last-scope">
+      <xsl:call-template name="substring-before-last">
+       <xsl:with-param name="string" select="$type"/>
+       <xsl:with-param name="to-find" select="'::'"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:variable name="tokenized-type-after-last-scope">
+      <xsl:call-template name="rough-tokenize">
+       <xsl:with-param name="string" select="$type-after-last-scope"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="$really-do-it and boolean($params[contains($tokenized-type-after-last-scope, concat(' ', @name, ' '))])">
+      <!-- If the tokenized string contains any of the param names in a
+      token by itself, return true.  Return false otherwise -->
+       <xsl:comment/>typename <xsl:value-of select="$type"/><xsl:comment/>
+      </xsl:when>
+      <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="substring-before-last">
+    <xsl:param name="string"/>
+    <xsl:param name="to-find"/>
+    <xsl:param name="string-processed-so-far"/> <!-- internal -->
+    <!-- Find the substring of $string before the last occurrance of
+    $to-find, returning '' if it was not found. -->
+
+    <xsl:choose>
+      <xsl:when test="contains($string, $to-find)">
+       <xsl:call-template name="substring-before-last">
+         <xsl:with-param name="string" select="substring-after($string, $to-find)"/>
+         <xsl:with-param name="to-find" select="$to-find"/>
+         <xsl:with-param name="string-processed-so-far" select="concat($string-processed-so-far, substring-before($string, $to-find), $to-find)"/>
+       </xsl:call-template>
+      </xsl:when>
+
+      <xsl:otherwise>
+       <xsl:value-of select="substring($string-processed-so-far, 1, string-length($string-processed-so-far)-(string-length($to-find)))"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="substring-after-last">
+    <xsl:param name="string"/>
+    <xsl:param name="to-find"/>
+    <!-- Find the substring of $string after the last occurrance of
+    $to-find, returning the original string if it was not found. -->
+
+    <xsl:choose>
+      <xsl:when test="contains($string, $to-find)">
+       <xsl:call-template name="substring-after-last">
+         <xsl:with-param name="string" select="substring-after($string, $to-find)"/>
+         <xsl:with-param name="to-find" select="$to-find"/>
+       </xsl:call-template>
+      </xsl:when>
+
+      <xsl:otherwise>
+       <xsl:value-of select="$string"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="rough-tokenize">
+    <xsl:param name="string"/>
+    <!-- Do a rough tokenization of the string.  Right now, just translate
+    all non-token-chars to spaces, normalize-space the result, and prepend
+    and append spaces. -->
+
+    <xsl:value-of select="concat(' ', normalize-space(translate($string, '&lt;&gt;,./?;:[]{}-=\\_+|!@#$%^&amp;*()', '                             ')), ' ')"/>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/xsl/api/doxygen/collect.xsl b/xsl/api/doxygen/collect.xsl
new file mode 100644 (file)
index 0000000..af9ff3a
--- /dev/null
@@ -0,0 +1,60 @@
+<?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" version="1.0" indent="yes" standalone="yes" />
+  <xsl:template match="/">
+    <doxygen>
+      <xsl:attribute name="version">
+        <xsl:choose>
+          <xsl:when test="d:doxygen">
+            <xsl:value-of select="d:doxygen/attribute::d:version"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="d:doxygenindex/attribute::d:version"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+
+      <!-- Load all doxgen generated xml files -->
+      <xsl:for-each select="d:doxygen/d:compound">
+        <xsl:variable name="id">
+          <xsl:choose>
+            <xsl:when test="@refid">
+              <xsl:value-of select="@refid"/>
+            </xsl:when>
+            <xsl:when test="@id">
+              <xsl:value-of select="@id"/>
+            </xsl:when>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:if test="$id">
+          <xsl:copy-of select="document( concat( $id, '.xml' ), / )/d:doxygen/*" />
+        </xsl:if>
+      </xsl:for-each>
+      <xsl:for-each select="d:doxygenindex/d:compound">
+        <xsl:variable name="id">
+          <xsl:choose>
+            <xsl:when test="@refid">
+              <xsl:value-of select="@refid"/>
+            </xsl:when>
+            <xsl:when test="@id">
+              <xsl:value-of select="@id"/>
+            </xsl:when>
+          </xsl:choose>
+        </xsl:variable>
+        <xsl:if test="$id">
+          <xsl:copy-of select="document( concat($id, '.xml'), /)/d:doxygen/*" />
+        </xsl:if>
+      </xsl:for-each>
+    </doxygen>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/xsl/api/doxygen/doxygen2boostbook.xsl b/xsl/api/doxygen/doxygen2boostbook.xsl
new file mode 100644 (file)
index 0000000..a61e97f
--- /dev/null
@@ -0,0 +1,1557 @@
+<?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:import href="../lookup.xsl"/>
+
+  <!-- Set this parameter to a space-separated list of headers that
+       will be included in the output (all others are ignored). If this
+       parameter is omitted or left as the empty string, all headers will
+       be output. -->
+  <xsl:param name="boost.doxygen.headers" select="''"/>
+
+  <!-- The common prefix to all headers -->
+  <xsl:param name="boost.doxygen.header.prefix" select="'boost'"/>
+
+  <!-- The text that Doxygen places in overloaded functions. Damn them
+       for forcing us to compare TEXT just to figure out what's overloaded
+       and what isn't. -->
+  <xsl:param name="boost.doxygen.overload">
+    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
+  </xsl:param>
+
+  <!-- The namespace used to identify code that should not be
+       processed at all. -->
+  <xsl:param name="boost.doxygen.detailns">detail</xsl:param>
+
+  <!-- The substring used to identify unspecified types that we can't
+       mask from within Doxygen. This is a hack (big surprise). -->
+  <xsl:param name="boost.doxygen.detail"><xsl:value-of select="$boost.doxygen.detailns"/>::</xsl:param>
+
+  <!-- The title that will be used for the BoostBook library reference emitted. 
+       If left blank, BoostBook will assign a default title. -->
+  <xsl:param name="boost.doxygen.reftitle" select="''"/>
+
+  <!-- The id used for the library-reference. By default, it is the normalized
+       form of the reftitle. -->
+  <xsl:param name="boost.doxygen.refid" select="''"/>
+
+  <!-- The directory into which png files corresponding to LaTeX formulas will be found. -->
+  <xsl:param name="boost.doxygen.formuladir" select="'images/'"/>
+
+  <xsl:output method="xml" indent="no" standalone="yes"/>
+
+  <xsl:key name="compounds-by-kind" match="d:compounddef" use="@kind"/>
+  <xsl:key name="compounds-by-id" match="d:compounddef" use="@id"/>
+  <xsl:key name="members-by-id" match="d:memberdef" use="@id" />
+
+  <xsl:strip-space elements="d:briefdescription d:detaileddescription d:inbodydescription"/>
+
+  <xsl:template name="kind-error-message">
+    <xsl:param name="message"/>
+
+    <xsl:variable name="location" select=".//d:location[1]" />
+    <xsl:variable name="name" select="./d:name" />
+
+    <xsl:message>
+      <xsl:if test="$location">
+        <xsl:value-of select="concat($location/@file, ':', $location/@line, ': ')" />
+      </xsl:if>
+      <xsl:value-of select="concat($message, ' with kind=', @kind)" />
+      <xsl:if test="$name">
+        <xsl:value-of select="concat(' (name=', $name, ') ')" />
+      </xsl:if>
+    </xsl:message>
+  </xsl:template>
+
+  <!-- translate-name: given a string, return a string suitable for use as a refid -->
+  <xsl:template name="translate-name">
+    <xsl:param name="name"/>
+    <xsl:value-of select="translate($name,
+                                    'ABCDEFGHIJKLMNOPQRSTUVWXYZ ~!%^&amp;*()[].,&lt;&gt;|/ +-=',
+                                    'abcdefghijklmnopqrstuvwxyz_____________________')"/>
+  </xsl:template>
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="d:doxygen"/>
+  </xsl:template>
+
+  <xsl:template match="d:doxygen">
+    <library-reference>
+      <xsl:if test="string($boost.doxygen.reftitle) != ''">
+        <!-- when a reference section has a reftitle, also give it a refid. The id
+             is determined by the boost.doxygen.refid param, which defaults to a 
+             normalized form of the boost.doxygen.reftitle -->
+        <xsl:attribute name="id">
+          <xsl:choose>
+            <xsl:when test="string($boost.doxygen.refid) != ''">
+              <xsl:value-of select="$boost.doxygen.refid"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:call-template name="translate-name">
+                <xsl:with-param name="name" select="$boost.doxygen.reftitle"/>
+              </xsl:call-template>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:attribute>
+
+        <title><xsl:copy-of select="$boost.doxygen.reftitle"/></title>
+      </xsl:if>
+      <xsl:apply-templates select="key('compounds-by-kind', 'file')"/>
+    </library-reference>
+  </xsl:template>
+
+  <xsl:template match="d:compounddef">
+    <!-- The set of innernamespace nodes that limits our search -->
+    <xsl:param name="with-namespace-refs"/>
+    <xsl:param name="in-file"/>
+
+    <xsl:choose>
+      <!-- If the string INTERNAL ONLY is in the description, don't
+           emit this entity. This hack is necessary because Doxygen doesn't
+           tell us what is \internal and what isn't. -->
+      <xsl:when test="contains(d:detaileddescription/d:para, 'INTERNAL ONLY')"/>
+      <xsl:when test="contains(d:briefdescription/d:para, 'INTERNAL ONLY')"/>
+      <xsl:when test="contains(d:inbodydescription/d:para, 'INTERNAL ONLY')"/>
+
+      <xsl:when test="@kind='file'">
+        <xsl:call-template name="file"/>
+      </xsl:when>
+      <xsl:when test="@kind='namespace'">
+        <xsl:call-template name="namespace">
+          <xsl:with-param name="with-namespace-refs" 
+            select="$with-namespace-refs"/>
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="@kind='class'">
+        <xsl:call-template name="class">
+          <xsl:with-param name="class-key" select="'class'"/>
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="@kind='struct'">
+        <xsl:call-template name="class">
+          <xsl:with-param name="class-key" select="'struct'"/>
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="@kind='union'">
+        <xsl:call-template name="class">
+          <xsl:with-param name="class-key" select="'union'"/>
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="kind-error-message">
+          <xsl:with-param name="message" select="'Cannot handle compounddef'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="namespace">
+    <!-- The set of innernamespace nodes that limits our search -->
+    <xsl:param name="with-namespace-refs"/>
+    <xsl:param name="in-file"/>
+
+    <xsl:variable name="fullname" select="string(d:compoundname)"/>
+
+    <xsl:if test="$with-namespace-refs[string(text())=$fullname]
+                  and not(contains($fullname, $boost.doxygen.detailns))">
+      <!-- Namespace without the prefix -->
+      <xsl:variable name="rest">
+        <xsl:call-template name="strip-qualifiers">
+          <xsl:with-param name="name" select="d:compoundname"/>
+        </xsl:call-template>
+      </xsl:variable>
+      
+      <!-- Grab only the namespace name, not any further nested namespaces -->
+      <xsl:variable name="name">
+        <xsl:choose>
+          <xsl:when 
+            test="contains($rest, '::')">
+            <xsl:value-of select="substring-before($rest, '::')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$rest"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+      
+      <namespace>
+        <xsl:attribute name="name">
+          <xsl:value-of select="$name"/>
+        </xsl:attribute>
+        
+        <xsl:apply-templates>
+          <xsl:with-param name="with-namespace-refs" 
+            select="$with-namespace-refs"/>
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:apply-templates>
+      </namespace>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="class">
+    <xsl:param name="class-key"/>
+    <xsl:param name="in-file"/>
+    <xsl:param name="with-namespace-refs"/>
+
+    <xsl:if test="string(d:location/attribute::d:file)=$in-file">
+    
+      <!-- The short name of this class -->
+      <xsl:variable name="name-with-spec">
+        <xsl:call-template name="strip-qualifiers">
+          <xsl:with-param name="name" select="d:compoundname"/>
+        </xsl:call-template>
+      </xsl:variable>
+      
+      <xsl:variable name="name">
+        <xsl:choose>
+          <xsl:when test="contains($name-with-spec, '&lt;')">
+            <xsl:value-of select="substring-before($name-with-spec, '&lt;')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$name-with-spec"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
+      <xsl:variable name="specialization">
+        <xsl:if test="contains($name-with-spec, '&lt;')">
+          <xsl:variable name="spec-with-gt" 
+            select="substring-after($name-with-spec, '&lt;')"/>
+          <xsl:value-of select="substring($spec-with-gt, 1, 
+                                          string-length($spec-with-gt)-1)"/>
+        </xsl:if>
+      </xsl:variable>
+
+      <xsl:variable name="actual-class-key">
+        <xsl:value-of select="$class-key"/>
+        <xsl:if test="string-length($specialization) &gt; 0">
+          <xsl:text>-specialization</xsl:text>
+        </xsl:if>
+      </xsl:variable>
+
+      <xsl:element name="{$actual-class-key}">
+        <xsl:attribute name="name">
+          <xsl:value-of select="$name"/>
+        </xsl:attribute>
+        
+        <xsl:apply-templates select="d:templateparamlist" mode="template"/>
+
+        <xsl:if test="string-length($specialization) &gt; 0">
+          <specialization>
+            <xsl:call-template name="specialization">
+              <xsl:with-param name="specialization" select="$specialization"/>
+            </xsl:call-template>
+          </specialization>
+        </xsl:if>
+
+        <xsl:apply-templates select="d:basecompoundref" mode="inherit"/>
+
+        <xsl:apply-templates select="d:briefdescription" mode="passthrough"/>
+        <xsl:apply-templates select="d:detaileddescription" mode="passthrough"/>
+        <xsl:apply-templates select="d:inbodydescription" mode="passthrough"/>
+        <xsl:apply-templates>
+          <xsl:with-param name="in-file" select="$in-file"/>  
+        </xsl:apply-templates>
+      </xsl:element>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="enum">
+    <xsl:param name="in-file"/>
+
+    <xsl:if test="string(d:location/attribute::d:file)=$in-file">
+      <xsl:variable name="name">
+        <xsl:call-template name="strip-qualifiers">
+          <xsl:with-param name="name" select="d:name"/>
+        </xsl:call-template>
+      </xsl:variable>
+      
+      <enum>
+        <xsl:attribute name="name">
+          <xsl:value-of select="$name"/>
+        </xsl:attribute>
+        
+        <xsl:apply-templates select="d:enumvalue"/>
+        
+        <xsl:apply-templates select="d:briefdescription" mode="passthrough"/>
+        <xsl:apply-templates select="d:detaileddescription" mode="passthrough"/>
+        <xsl:apply-templates select="d:inbodydescription" mode="passthrough"/>
+      </enum>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="d:enumvalue">
+    <xsl:choose>
+      <!-- If the string INTERNAL ONLY is in the description, don't
+           emit this entity. This hack is necessary because Doxygen doesn't
+           tell us what is \internal and what isn't. -->
+      <xsl:when test="contains(d:detaileddescription/d:para, 'INTERNAL ONLY')"/>
+      <xsl:when test="contains(d:briefdescription/d:para, 'INTERNAL ONLY')"/>
+      <xsl:when test="contains(d:inbodydescription/d:para, 'INTERNAL ONLY')"/>
+      <xsl:otherwise>
+  
+        <enumvalue>
+          <xsl:attribute name="name">
+            <xsl:value-of select="d:name"/>
+          </xsl:attribute>
+
+          <xsl:if test="d:initializer">
+            <default>
+              <xsl:apply-templates select="d:initializer/*|d:initializer/text()" mode="passthrough"/>
+            </default>
+          </xsl:if>
+
+          <xsl:apply-templates select="d:briefdescription" mode="passthrough"/>
+          <xsl:apply-templates select="d:detaileddescription" mode="passthrough"/>
+          <xsl:apply-templates select="d:inbodydescription" mode="passthrough"/>
+        </enumvalue>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="doxygen.include.header.rec">
+    <xsl:param name="name"/>
+    <xsl:param name="header-list" select="$boost.doxygen.headers"/>
+
+    <xsl:choose>
+      <xsl:when test="contains($header-list, ' ')">
+        <xsl:variable name="header" 
+          select="substring-before($header-list, ' ')"/>
+        <xsl:variable name="rest" select="substring-after($header-list, ' ')"/>
+
+        <xsl:choose>
+          <xsl:when test="$name=$header">
+            <xsl:text>yes</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="doxygen.include.header.rec">
+              <xsl:with-param name="name" select="$name"/>
+              <xsl:with-param name="header-list" select="$rest"/>
+            </xsl:call-template>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="$name=$header-list">
+        <xsl:text>yes</xsl:text>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="doxygen.include.header">
+    <xsl:param name="name"/>
+    
+    <xsl:if test="$boost.doxygen.headers=''">
+      <xsl:text>yes</xsl:text>
+    </xsl:if>
+    <xsl:if test="not($boost.doxygen.headers='')">
+      <xsl:call-template name="doxygen.include.header.rec">
+        <xsl:with-param name="name" select="$name"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="file">
+    <xsl:variable name="include-header">
+      <xsl:call-template name="doxygen.include.header">
+        <xsl:with-param name="name" select="string(d:compoundname)"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:if test="$include-header='yes'">
+      <header>
+        <xsl:attribute name="name">
+          <xsl:call-template name="shorten.header.name">
+            <xsl:with-param name="header" select="d:location/attribute::d:file"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        
+        <xsl:if test="d:briefdescription/*|d:detaileddescription/*|d:inbodydescription/*">
+          <xsl:apply-templates select="d:briefdescription/*" mode="passthrough"/>
+          <xsl:apply-templates select="d:detaileddescription/*" mode="passthrough"/>
+          <xsl:apply-templates select="d:inbdoydescription/*" mode="passthrough"/>
+        </xsl:if>
+        
+        <xsl:apply-templates mode="toplevel">
+          <xsl:with-param name="with-namespace-refs"
+            select="d:innernamespace"/>
+          <xsl:with-param name="in-file" select="d:location/attribute::d:file"/>
+        </xsl:apply-templates>
+      </header>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template name="shorten.header.name">
+    <xsl:param name="header"/>
+
+    <xsl:variable name="prefix">
+      <xsl:value-of select="concat($boost.doxygen.header.prefix, '/')"/>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="contains($header, $prefix)">
+        <xsl:variable name="rest" select="substring-after($header, $prefix)"/>
+        <xsl:choose>
+          <xsl:when test="contains($rest, $prefix)">
+            <xsl:call-template name="shorten.header.name">
+              <xsl:with-param name="header" select="$rest"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$prefix"/>
+            <xsl:value-of select="$rest"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$header"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+
+  <xsl:template match="d:innernamespace">
+    <xsl:param name="with-namespace-refs"/>
+    <xsl:param name="in-file"/>
+
+    <xsl:apply-templates select="key('compounds-by-id', @refid)">
+      <xsl:with-param name="with-namespace-refs"
+        select="$with-namespace-refs"/>
+      <xsl:with-param name="in-file" select="$in-file"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:template match="d:innernamespace" mode="toplevel">
+    <!-- The set of innernamespace nodes that limits our search -->
+    <xsl:param name="with-namespace-refs"/>
+    <xsl:param name="in-file"/>
+
+    <!-- The full name of the namespace we are referring to -->
+    <xsl:variable name="fullname" 
+      select="string(key('compounds-by-id', @refid)/d:compoundname)"/>
+
+    <!-- Only pass on top-level namespaces -->
+    <xsl:if test="not(contains($fullname, '::'))">
+      <xsl:apply-templates select="key('compounds-by-id', @refid)">
+        <xsl:with-param name="with-namespace-refs" 
+          select="$with-namespace-refs"/>
+        <xsl:with-param name="in-file" select="$in-file"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="d:sectiondef" mode="toplevel">
+    <xsl:param name="in-file" select="''"/>
+
+    <xsl:apply-templates mode="toplevel"
+                         select="d:memberdef[generate-id() =
+                                 generate-id(key('members-by-id', @id))]">
+      <xsl:with-param name="in-file" select="$in-file"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:template match="d:memberdef" mode="toplevel">
+    <xsl:param name="with-namespace-refs"/>
+    <xsl:param name="in-file"/>
+
+    <xsl:choose>
+      <!-- If the string INTERNAL ONLY is in the description, don't
+           emit this entity. This hack is necessary because Doxygen doesn't
+           tell us what is \internal and what isn't. -->
+      <xsl:when test="contains(d:detaileddescription/d:para, 'INTERNAL ONLY')"/>
+      <xsl:when test="contains(d:briefdescription/d:para, 'INTERNAL ONLY')"/>
+      <xsl:when test="contains(d:inbodydescription/d:para, 'INTERNAL ONLY')"/>
+
+      <xsl:when test="@kind='define'">
+        <macro>
+          <xsl:attribute name="name">
+            <xsl:value-of select="d:name/text()"/>
+          </xsl:attribute>
+
+          <xsl:if test="d:param">
+            <xsl:attribute name="kind">
+              <xsl:value-of select="'functionlike'"/>
+            </xsl:attribute>
+          </xsl:if>
+
+          <xsl:for-each select="d:param">
+            <macro-parameter>
+              <xsl:attribute name="name">
+                <xsl:value-of select="d:defname/text()"/>
+              </xsl:attribute>
+            </macro-parameter>
+          </xsl:for-each>
+
+          <xsl:apply-templates select="d:briefdescription" mode="passthrough"/>
+          <xsl:apply-templates select="d:detaileddescription" mode="passthrough"/>
+          <xsl:apply-templates select="d:inbodydescription" mode="passthrough"/>
+        </macro>
+      </xsl:when>
+
+      <xsl:when test="@kind='function'">
+        <xsl:call-template name="function">
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:call-template>
+      </xsl:when>
+
+      <xsl:when test="@kind='typedef'">
+        <xsl:call-template name="typedef">
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:call-template>
+      </xsl:when>
+
+      <xsl:when test="@kind='variable'">
+        <xsl:call-template name="variable" />
+      </xsl:when>
+
+      <xsl:when test="@kind='enum'">
+        <xsl:call-template name="enum" />
+      </xsl:when>
+
+      <xsl:otherwise>
+        <xsl:call-template name="kind-error-message">
+          <xsl:with-param name="message" select="'Cannot handle toplevel memberdef element'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="d:innerclass" mode="toplevel">
+    <xsl:param name="with-namespace-refs"/>
+    <xsl:param name="in-file"/>
+
+    <xsl:variable name="name">
+      <xsl:call-template name="strip-qualifiers">
+        <xsl:with-param name="name" select="."/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <!-- Only process this if it is indeed global -->
+    <xsl:if test=".=$name">
+      <xsl:apply-templates select="key('compounds-by-id', @refid)">
+        <xsl:with-param name="with-namespace-refs" 
+          select="$with-namespace-refs"/>
+        <xsl:with-param name="in-file" select="$in-file"/>
+      </xsl:apply-templates>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="d:innerclass">
+    <xsl:param name="with-namespace-refs"/>
+    <xsl:param name="in-file"/>
+
+    <xsl:apply-templates select="key('compounds-by-id', @refid)">
+      <xsl:with-param name="with-namespace-refs" 
+        select="$with-namespace-refs"/>
+      <xsl:with-param name="in-file" select="$in-file"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <!-- Classes -->
+  <xsl:template match="d:templateparamlist" mode="template">
+    <template>
+      <xsl:apply-templates mode="template"/>
+    </template>
+  </xsl:template>
+
+  <xsl:template match="d:param" mode="template">
+    <xsl:choose>
+      <xsl:when test="string(d:type)='class' or string(d:type)='typename'">
+        <template-type-parameter>
+          <xsl:attribute name="name">
+            <xsl:value-of select="normalize-space(string(d:declname))"/>
+          </xsl:attribute>
+          <xsl:if test="d:defval">
+            <default>
+              <xsl:apply-templates select="d:defval/*|d:defval/text()" 
+                mode="passthrough"/>
+            </default>
+          </xsl:if>
+        </template-type-parameter>
+      </xsl:when>
+      <!-- Doxygen 1.5.8 generates odd xml for template type parameters.
+           This deals with that -->
+      <xsl:when test="not(d:declname) and
+        (starts-with(string(d:type), 'class ') or starts-with(string(d:type), 'typename '))">
+        <template-type-parameter>
+          <xsl:attribute name="name">
+            <xsl:value-of select="normalize-space(substring-after(string(d:type), ' '))"/>
+          </xsl:attribute>
+          <xsl:if test="d:defval">
+            <default>
+              <xsl:apply-templates select="d:defval/*|d:defval/text()" 
+                mode="passthrough"/>
+            </default>
+          </xsl:if>
+        </template-type-parameter>
+      </xsl:when>
+      <xsl:otherwise>
+        <template-nontype-parameter>
+          <xsl:attribute name="name">
+            <xsl:value-of select="normalize-space(string(d:declname))"/>
+          </xsl:attribute>
+          <type>
+            <xsl:apply-templates select="d:type"/>
+          </type>
+          <xsl:if test="d:defval">
+            <default>
+              <xsl:apply-templates select="d:defval/*|d:defval/text()" 
+                mode="passthrough"/>
+            </default>
+          </xsl:if>
+        </template-nontype-parameter>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="d:templateparamlist"/>
+
+  <!-- "Parse" a specialization from part of a name -->
+  <xsl:template name="specialization">
+    <xsl:param name="specialization"/>
+
+    <xsl:choose>
+      <xsl:when test="contains($specialization, ',')">
+        <template-arg>
+          <xsl:value-of 
+            select="normalize-space(substring-before($specialization, ','))"/>
+        </template-arg>
+        <xsl:call-template name="specialization">
+          <xsl:with-param name="specialization" 
+            select="substring-after($specialization, ',')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <template-arg>
+          <xsl:value-of select="normalize-space($specialization)"/>
+        </template-arg>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Inheritance -->
+  <xsl:template match="d:basecompoundref" mode="inherit">
+    <xsl:choose>
+      <xsl:when test="contains(string(.), $boost.doxygen.detail)"/>
+      <xsl:otherwise>
+        <inherit>
+          <!-- Access specifier for inheritance -->
+          <xsl:attribute name="access">
+            <xsl:value-of select="@prot"/>
+          </xsl:attribute>
+          <!-- TBD: virtual vs. non-virtual inheritance -->
+
+          <xsl:apply-templates mode="passthrough"/>
+        </inherit>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="d:basecompoundref"/>
+
+  <!-- Skip over sections: they aren't very useful at all -->
+  <xsl:template match="d:sectiondef">
+    <xsl:param name="in-file" select="''"/>
+
+    <xsl:choose>
+      <xsl:when test="@kind='public-static-func'">
+        <!-- TBD: pass on the fact that these are static functions -->
+        <method-group name="public static functions">
+          <xsl:apply-templates>
+            <xsl:with-param name="in-section" select="true()"/>
+            <xsl:with-param name="in-file" select="$in-file"/>
+          </xsl:apply-templates>
+        </method-group>
+      </xsl:when>
+      <xsl:when test="@kind='protected-static-func'">
+        <!-- TBD: pass on the fact that these are static functions -->
+        <method-group name="protected static functions">
+          <xsl:apply-templates>
+            <xsl:with-param name="in-section" select="true()"/>
+            <xsl:with-param name="in-file" select="$in-file"/>
+          </xsl:apply-templates>
+        </method-group>
+      </xsl:when>
+      <xsl:when test="@kind='private-static-func'">
+        <!-- TBD: pass on the fact that these are static functions -->
+        <method-group name="private static functions">
+          <xsl:apply-templates>
+            <xsl:with-param name="in-section" select="true()"/>
+            <xsl:with-param name="in-file" select="$in-file"/>
+          </xsl:apply-templates>
+        </method-group>
+      </xsl:when>
+      <xsl:when test="@kind='public-func'">
+        <xsl:variable name="members" select="./d:memberdef"/>
+        <xsl:variable name="num-internal-only">
+          <xsl:value-of
+            select="count($members[contains(d:detaileddescription/d:para,
+                                  'INTERNAL ONLY')])"/>
+        </xsl:variable>
+        <xsl:if test="$num-internal-only &lt; count($members)">
+          <method-group name="public member functions">
+            <xsl:apply-templates>
+              <xsl:with-param name="in-section" select="true()"/>
+              <xsl:with-param name="in-file" select="$in-file"/>
+            </xsl:apply-templates>
+          </method-group>
+          <xsl:apply-templates/>
+        </xsl:if>
+      </xsl:when>
+      <xsl:when test="@kind='protected-func'">
+        <method-group name="protected member functions">
+          <xsl:apply-templates>
+            <xsl:with-param name="in-section" select="true()"/>
+            <xsl:with-param name="in-file" select="$in-file"/>
+          </xsl:apply-templates>
+        </method-group>
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:when test="@kind='private-func'">
+        <xsl:variable name="members" select="./d:memberdef"/>
+        <xsl:variable name="num-internal-only">
+          <xsl:value-of 
+            select="count($members[contains(d:detaileddescription/d:para,
+                                  'INTERNAL ONLY')])"/>
+        </xsl:variable>
+        <xsl:if test="$num-internal-only &lt; count($members)">
+          <method-group name="private member functions">
+            <xsl:apply-templates>
+              <xsl:with-param name="in-section" select="true()"/>
+              <xsl:with-param name="in-file" select="$in-file"/>
+            </xsl:apply-templates>
+          </method-group>
+        </xsl:if>
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:when test="@kind='friend'">
+        <xsl:if test="./d:memberdef/d:detaileddescription/d:para or ./d:memberdef/d:briefdescription/d:para">
+          <method-group name="friend functions">
+            <xsl:apply-templates>
+              <xsl:with-param name="in-section" select="true()"/>
+              <xsl:with-param name="in-file" select="$in-file"/>
+            </xsl:apply-templates>
+          </method-group>
+        </xsl:if>
+      </xsl:when>
+      <xsl:when test="@kind='public-static-attrib' or @kind='public-attrib'">
+        <xsl:apply-templates>
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:when test="@kind='public-type'">
+        <xsl:apply-templates>
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:when test="@kind='private-type'">
+        <!--skip private members-->
+      </xsl:when>
+      <xsl:when test="@kind='private-static-attrib' or @kind='private-attrib'">
+        <!--skip private members-->
+      </xsl:when>
+      <xsl:when test="@kind='func'">
+        <xsl:apply-templates>
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:when test="@kind='typedef'">
+        <xsl:apply-templates>
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:when test="@kind='var'">
+        <xsl:apply-templates>
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:when test="@kind='enum'">
+        <xsl:apply-templates>
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:when test="@kind='user-defined'">
+        <xsl:apply-templates>
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:when test="@kind=''">
+        <xsl:apply-templates select="d:memberdef[generate-id() =
+                                     generate-id(key('members-by-id', @id))]">
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:apply-templates>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="kind-error-message">
+          <xsl:with-param name="message" select="'Cannot handle sectiondef'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Handle member definitions -->
+  <xsl:template match="d:memberdef">
+    <!-- True when we're inside a section -->
+    <xsl:param name="in-section" select="false()"/>
+    <xsl:param name="in-file" select="''"/>
+
+    <xsl:choose>
+      <!-- If the string INTERNAL ONLY is in the description, don't
+           emit this entity. This hack is necessary because Doxygen doesn't
+           tell us what is \internal and what isn't. -->
+      <xsl:when test="contains(d:detaileddescription/d:para, 'INTERNAL ONLY')"/>
+      <xsl:when test="contains(d:briefdescription/d:para, 'INTERNAL ONLY')"/>
+      <xsl:when test="contains(d:inbodydescription/d:para, 'INTERNAL ONLY')"/>
+
+      <xsl:when test="@kind='typedef'">
+        <xsl:call-template name="typedef">
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="@kind='function'">
+        <xsl:choose>
+          <xsl:when test="ancestor::d:compounddef/attribute::d:kind='namespace'">
+            <xsl:call-template name="function">
+              <xsl:with-param name="in-file" select="$in-file"/>
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <!-- We are in a class -->
+            <!-- The name of the class we are in -->
+            <xsl:variable name="in-class">
+              <xsl:call-template name="strip-qualifiers">
+                <xsl:with-param name="name" 
+                  select="string(ancestor::d:compounddef/d:compoundname/text())"/>
+              </xsl:call-template>
+            </xsl:variable>
+            
+            <xsl:choose>
+              <xsl:when test="string(d:name/text())=$in-class">
+                <xsl:if test="not ($in-section)">
+                  <xsl:call-template name="constructor"/>
+                </xsl:if>
+              </xsl:when>
+              <xsl:when test="string(d:name/text())=concat('~',$in-class)">
+                <xsl:if test="not ($in-section)">
+                  <xsl:call-template name="destructor"/>
+                </xsl:if>
+              </xsl:when>
+              <xsl:when test="string(d:name/text())='operator='">
+                <xsl:if test="not ($in-section)">
+                  <xsl:call-template name="copy-assignment"/>
+                </xsl:if>
+              </xsl:when>
+              <xsl:when test="normalize-space(string(d:type))=''
+                              and contains(d:name/text(), 'operator ')">
+                <xsl:if test="$in-section">
+                  <xsl:call-template name="conversion-operator"/>
+                </xsl:if>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:if test="$in-section">
+                  <xsl:call-template name="method"/>
+                </xsl:if>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:when test="@kind='friend'">
+        <xsl:if test="./d:detaileddescription/d:para or ./d:briefdescription/d:para">
+          <xsl:call-template name="method"/>
+        </xsl:if>
+      </xsl:when>
+      <xsl:when test="@kind='enum'">
+        <xsl:call-template name="enum">
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:when test="@kind='variable'">
+        <xsl:call-template name="variable">
+          <xsl:with-param name="in-file" select="$in-file"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="kind-error-message">
+          <xsl:with-param name="message" select="'Cannot handle memberdef element'"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Display typedefs -->
+  <xsl:template name="typedef">
+    <xsl:param name="in-file" select="''"/>
+
+    <xsl:if test="string(d:location/attribute::d:file)=$in-file">
+      <!-- TBD: Handle public/protected/private -->
+      <typedef>
+        <!-- Name of the type -->
+        <xsl:attribute name="name">
+          <xsl:value-of select="d:name/text()"/>
+        </xsl:attribute>
+        
+        <xsl:apply-templates select="d:briefdescription" mode="passthrough"/>
+        <xsl:apply-templates select="d:detaileddescription" mode="passthrough"/>
+        <xsl:apply-templates select="d:inbodydescription" mode="passthrough"/>
+        
+        <type><xsl:apply-templates select="d:type"/></type>
+      </typedef>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Handle function parameters -->
+  <xsl:template match="d:param" mode="function">
+    <parameter>
+      <!-- Parameter name -->
+      <xsl:attribute name="name">
+        <xsl:value-of select="normalize-space(d:declname/text())"/>
+      </xsl:attribute>
+
+      <!-- Parameter type -->
+      <paramtype><xsl:apply-templates select="d:type"/></paramtype>
+
+      <!-- Default argument -->
+      <xsl:if test="d:defval">
+        <default>
+          <xsl:choose>
+            <xsl:when test="contains(string(d:defval), $boost.doxygen.detail)">
+              <emphasis>unspecified</emphasis>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:apply-templates select="d:defval/*|d:defval/text()" 
+                mode="passthrough"/>
+            </xsl:otherwise>
+          </xsl:choose>
+
+        </default>
+      </xsl:if>
+
+      <!-- Parameter description -->
+      <xsl:variable name="name">
+        <xsl:value-of select="normalize-space(d:declname/text())"/>
+      </xsl:variable>
+
+      <xsl:apply-templates select="../*[self::d:detaileddescription or self::d:inbodydescription]//d:parameterlist[attribute::d:kind='param']/*"
+        mode="parameter.description">
+        <xsl:with-param name="name">
+          <xsl:value-of select="$name"/>
+        </xsl:with-param>
+      </xsl:apply-templates>
+    </parameter>
+  </xsl:template>
+
+  <xsl:template match="d:parameteritem" mode="parameter.description">
+    <!-- The parameter name we are looking for -->
+    <xsl:param name="name"/>
+    
+    <xsl:if test="string(d:parameternamelist/d:parametername) = $name">
+      <description>
+        <xsl:apply-templates select="d:parameterdescription/d:para" mode="passthrough"/>
+      </description>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- For older versions of Doxygen, which didn't use parameteritem -->
+  <xsl:template match="d:parameterdescription" mode="parameter.description">
+    <!-- The parameter name we are looking for -->
+    <xsl:param name="name"/>
+    
+    <!-- The parametername node associated with this description -->
+    <xsl:variable name="name-node" select="preceding-sibling::*[1]"/>
+
+    <xsl:if test="string($name-node/text()) = $name">
+      <description>
+        <xsl:apply-templates select="d:para" mode="passthrough"/>
+      </description>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Handle function children -->
+  <xsl:template name="function.children">
+    <xsl:param name="is-overloaded" select="false()"/>
+
+    <xsl:if test="not($is-overloaded)">
+      <!-- Emit template header -->
+      <xsl:apply-templates select="d:templateparamlist" mode="template"/>
+      
+      <!-- Emit function parameters -->
+      <xsl:apply-templates select="d:param" mode="function"/>
+    </xsl:if>
+
+    <!-- The description -->
+    <xsl:apply-templates select="d:briefdescription" mode="passthrough"/>
+    <xsl:apply-templates select="d:detaileddescription" mode="passthrough"/>
+    <xsl:apply-templates select="d:inbodydescription" mode="passthrough"/>
+      
+    <xsl:apply-templates 
+      select="*[self::d:detaileddescription or self::d:inbodydescription]/d:para/d:simplesect[@kind='pre']"
+      mode="function-clauses"/>
+    <xsl:apply-templates 
+      select="*[self::d:detaileddescription or self::d:inbodydescription]/d:para/d:simplesect[@kind='post']"
+      mode="function-clauses"/>
+    <xsl:apply-templates 
+      select="*[self::d:detaileddescription or self::d:inbodydescription]/d:para/d:simplesect[@kind='return']"
+      mode="function-clauses"/>
+    <xsl:if test="*[self::d:detaileddescription or self::d:inbodydescription]/d:para/d:parameterlist[@kind='exception']">
+      <throws>
+        <xsl:apply-templates 
+          select="*[self::d:detaileddescription or self::d:inbodydescription]/d:para/d:parameterlist[@kind='exception']"
+          mode="function-clauses"/>
+      </throws>
+    </xsl:if>
+    <xsl:variable name="notes" select="*[self::d:detaileddescription or self::d:inbodydescription]/d:para/d:simplesect[@kind='note' or @kind='attention']"/>
+    <xsl:if test="count($notes) &gt; 0"> 
+      <notes>
+        <xsl:apply-templates select="$notes" mode="function-clauses"/>
+      </notes>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Handle free functions -->
+  <xsl:template name="function">
+    <xsl:param name="in-file" select="''"/>
+
+    <xsl:variable name="firstpara" 
+      select="normalize-space(d:detaileddescription/d:para[1])"/>
+    <xsl:if test="string(d:location/attribute::d:file)=$in-file
+                  and 
+                  not($firstpara=normalize-space($boost.doxygen.overload))">
+
+      <xsl:variable name="next-node" select="following-sibling::*[1]"/>
+      <xsl:variable name="has-overload">
+        <xsl:if test="not(local-name($next-node)='memberdef')">
+          false
+        </xsl:if>
+        <xsl:if test="not(string($next-node/d:name/text())=string(d:name/text()))">
+          false
+        </xsl:if>
+        <xsl:if 
+          test="not(normalize-space($next-node/d:detaileddescription/d:para[1])
+                    =normalize-space($boost.doxygen.overload))">
+          false
+        </xsl:if>
+      </xsl:variable>
+
+      <xsl:choose>
+        <xsl:when test="not(contains($has-overload, 'false'))">
+          <overloaded-function>
+            <xsl:attribute name="name">
+              <xsl:call-template name="normalize-name"/>
+            </xsl:attribute>
+
+            <xsl:call-template name="overload-signatures"/>
+            <xsl:call-template name="function.children">
+              <xsl:with-param name="is-overloaded" select="true()"/>
+            </xsl:call-template>
+          </overloaded-function>
+        </xsl:when>
+        <xsl:otherwise>
+          <function>
+            <xsl:attribute name="name">
+              <xsl:call-template name="normalize-name"/>
+            </xsl:attribute>
+            
+            <!-- Return type -->
+            <type><xsl:apply-templates select="d:type"/></type>
+            
+            <xsl:call-template name="function.children"/>
+          </function>          
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Emit overload signatures -->
+  <xsl:template name="overload-signatures">
+    <xsl:param name="node" select="."/>
+    <xsl:param name="name" select="string(d:name/text())"/>
+    <xsl:param name="first" select="true()"/>
+
+    <xsl:choose>
+      <xsl:when test="not(local-name($node)='memberdef')"/>
+      <xsl:when test="not(string($node/d:name/text())=$name)"/>
+      <xsl:when test="not(normalize-space($node/d:detaileddescription/d:para[1])
+                          =normalize-space($boost.doxygen.overload))
+                      and not($first)"/>
+      <xsl:otherwise>
+        <signature>
+          <type>
+            <xsl:apply-templates select="$node/d:type"/>
+          </type>
+          <xsl:apply-templates select="$node/d:templateparamlist" 
+            mode="template"/>
+          <xsl:apply-templates select="$node/d:param" mode="function"/>
+        </signature>
+
+        <xsl:call-template name="overload-signatures">
+          <xsl:with-param name="node" select="$node/following-sibling::*[1]"/>
+          <xsl:with-param name="name" select="$name"/>
+          <xsl:with-param name="first" select="false()"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Handle constructors -->
+  <xsl:template name="constructor">
+    <constructor>
+      <xsl:call-template name="function.children"/>
+    </constructor>
+  </xsl:template>
+
+  <!-- Handle Destructors -->
+  <xsl:template name="destructor">
+    <destructor>
+      <xsl:call-template name="function.children"/>
+    </destructor>
+  </xsl:template>
+
+  <!-- Handle Copy Assignment -->
+  <xsl:template name="copy-assignment">
+    <copy-assignment>
+      <xsl:call-template name="function.children"/>
+    </copy-assignment>
+  </xsl:template>
+
+  <!-- Handle conversion operator -->
+  <xsl:template name="conversion-operator">
+    <method>
+      <xsl:attribute name="name">
+        <xsl:text>conversion-operator</xsl:text>
+      </xsl:attribute>
+
+      <!-- CV Qualifiers -->
+      <xsl:if test="not (@const='no' and @volatile='no')">
+        <xsl:attribute name="cv">
+          <xsl:if test="@const='yes'">
+            <xsl:text>const</xsl:text>
+          </xsl:if>
+          <xsl:if test="@volatile='yes'">
+            <xsl:if test="@const='yes'">
+              <xsl:text> </xsl:text>
+            </xsl:if>
+            <xsl:text>volatile</xsl:text>
+          </xsl:if>
+        </xsl:attribute>
+      </xsl:if>
+
+      <!-- Conversion type -->
+      <type>
+        <xsl:value-of select="substring-after(d:name/text(), 'operator ')"/>
+      </type>
+
+      <xsl:call-template name="function.children"/>
+    </method>
+  </xsl:template>
+
+  <!-- Handle methods -->
+  <xsl:template name="method">
+    <method>
+      <xsl:attribute name="name">
+        <xsl:value-of select="d:name/text()"/>
+      </xsl:attribute>
+
+      <!-- CV Qualifiers -->
+      <xsl:if test="not (@const='no' and @volatile='no')">
+        <xsl:attribute name="cv">
+          <xsl:if test="@const='yes'">
+            <xsl:text>const</xsl:text>
+          </xsl:if>
+          <xsl:if test="@volatile='yes'">
+            <xsl:if test="@const='yes'">
+              <xsl:text> </xsl:text>
+            </xsl:if>
+            <xsl:text>volatile</xsl:text>
+          </xsl:if>
+        </xsl:attribute>
+      </xsl:if>
+
+      <!-- Return type -->
+      <xsl:element name="type">
+        <!-- Cheat on virtual and static by dropping them into the type -->
+        <xsl:if test="@static='yes'">
+          <xsl:text>static </xsl:text>
+        </xsl:if>
+
+        <xsl:if test="@virtual='yes'">
+          <xsl:text>virtual </xsl:text>
+        </xsl:if>
+
+        <xsl:apply-templates select="d:type"/>
+      </xsl:element>
+
+      <xsl:call-template name="function.children"/>
+    </method>
+  </xsl:template>
+
+  <!-- Handle member variables -->
+  <xsl:template name="variable">
+    <xsl:param name="in-file"/>
+    <xsl:if test="string(d:location/attribute::d:file)=$in-file">
+    <data-member>
+      <xsl:attribute name="name">
+        <xsl:value-of select="d:name/text()"/>
+      </xsl:attribute>
+
+      <!-- Specifiers -->
+      <xsl:if test="@static = 'yes'">
+        <xsl:attribute name="specifiers">static</xsl:attribute>
+      </xsl:if>
+      <xsl:if test="@mutable = 'yes'">
+        <xsl:attribute name="specifiers">mutable</xsl:attribute>
+      </xsl:if>
+
+      <type>
+        <xsl:apply-templates select="d:type"/>
+      </type>
+
+      <xsl:apply-templates select="d:briefdescription" mode="passthrough"/>
+      <xsl:apply-templates select="d:detaileddescription" mode="passthrough"/>
+      <xsl:apply-templates select="d:inbodydescription" mode="passthrough"/>
+    </data-member>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Things we ignore directly -->
+  <xsl:template match="d:compoundname" mode="toplevel"/>
+  <xsl:template match="d:includes|d:includedby|d:incdepgraph|d:invincdepgraph" mode="toplevel"/>
+  <xsl:template match="d:programlisting" mode="toplevel"/>
+  <xsl:template match="text()" mode="toplevel"/>
+
+  <xsl:template match="text()"/>
+
+  <!-- Passthrough of text -->
+  <xsl:template match="text()" mode="passthrough">
+    <xsl:value-of select="."/>
+  </xsl:template>
+  <xsl:template match="d:para" mode="passthrough">
+    <para>
+      <xsl:apply-templates mode="passthrough"/>
+    </para>
+  </xsl:template>
+  <xsl:template match="d:copydoc" mode="passthrough">
+    <xsl:apply-templates mode="passthrough"/>
+  </xsl:template>
+
+  <xsl:template match="d:para/d:simplesect" mode="passthrough">
+    <xsl:if test="not (@kind='pre') and
+                  not (@kind='return') and 
+                  not (@kind='post') and
+                  not (@kind='attention') and
+                  not (@kind='note')">
+      <xsl:apply-templates mode="passthrough"/>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="d:para/d:simplesect[@kind='par']" mode="passthrough">
+    <formalpara>
+      <xsl:apply-templates mode="passthrough"/>
+    </formalpara>
+  </xsl:template>
+
+  <xsl:template match="d:simplesectsep" mode="passthrough">
+    <xsl:apply-templates mode="passthrough"/>
+  </xsl:template>
+
+  <xsl:template match="*" mode="passthrough">
+    <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates mode="passthrough"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="d:parameterlist" mode="passthrough"/>
+
+  <xsl:template match="bold" mode="passthrough">
+    <emphasis role="bold">
+      <xsl:apply-templates mode="passthrough"/>
+    </emphasis>
+  </xsl:template>
+
+  <xsl:template match="d:linebreak" mode="passthrough">
+    <sbr/>
+  </xsl:template>
+
+  <xsl:template match="d:briefdescription" mode="passthrough">
+    <xsl:if test="text()|*">
+      <purpose>
+        <xsl:apply-templates mode="purpose"/>
+      </purpose>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="d:detaileddescription" mode="passthrough">
+    <xsl:if test="text()|*">
+      <description>
+        <xsl:apply-templates mode="passthrough"/>
+      </description>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="d:inbodydescription" mode="passthrough">
+    <xsl:if test="text()|*">
+      <description>
+        <xsl:apply-templates mode="passthrough"/>
+      </description>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- Ignore ref elements for now, as there is a lot of documentation which
+       will have incorrect ref elements at the moment -->
+  <xsl:template match="d:ref" mode="passthrough">
+    <xsl:apply-templates mode="passthrough"/>
+  </xsl:template>
+
+  <!-- Handle function clauses -->
+  <xsl:template match="d:simplesect" mode="function-clauses">
+    <xsl:if test="@kind='pre'">
+      <requires>
+        <xsl:apply-templates mode="passthrough"/>
+      </requires>
+    </xsl:if>
+    <xsl:if test="@kind='return'">
+      <returns>
+        <xsl:apply-templates mode="passthrough"/>
+      </returns>
+    </xsl:if>
+    <xsl:if test="@kind='post'">
+      <postconditions>
+        <xsl:apply-templates mode="passthrough"/>
+      </postconditions>
+    </xsl:if>
+    <xsl:if test="@kind='note' or @kind='attention'">
+      <xsl:apply-templates mode="passthrough"/>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="d:parameterlist" mode="function-clauses">
+    <xsl:if test="@kind='exception'">
+      <simpara>
+        <xsl:choose>
+          <xsl:when test="normalize-space(.//d:parametername//text())='nothrow'">
+            <xsl:text>Will not throw.</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <classname>
+              <xsl:value-of select=".//d:parametername//text()"/>
+            </classname>
+            <xsl:text> </xsl:text>
+            <xsl:apply-templates 
+              select="d:parameterdescription/d:para/text()
+                      |d:parameterdescription/d:para/*"
+              mode="passthrough"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </simpara>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="d:type">
+    <xsl:choose>
+      <xsl:when test="contains(string(.), $boost.doxygen.detail)">
+        <emphasis>unspecified</emphasis>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates mode="type"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="d:ref" mode="type">
+    <xsl:choose>
+      <xsl:when test="@kindref='compound'">
+        <classname>
+          <xsl:value-of select="text()"/>
+        </classname>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="text()"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="*" mode="type">
+    <xsl:value-of select="."/>
+  </xsl:template>
+
+  <!-- Normalize the names of functions, because Doxygen sometimes
+       puts in an obnoixous space. -->
+  <xsl:template name="normalize-name">
+    <xsl:param name="name" select="d:name/text()"/>
+
+    <xsl:choose>
+      <xsl:when test="contains($name, ' ')">
+        <xsl:value-of select="substring-before($name, ' ')"/>
+        <xsl:value-of select="substring-after($name, ' ')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$name"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Convert HTML tables into DocBook format -->
+  <xsl:template match="d:table" mode="passthrough">
+    <informaltable>
+      <tgroup>
+        <xsl:attribute name="cols">
+          <xsl:value-of select="@cols"/>
+        </xsl:attribute>
+
+        <tbody>
+          <xsl:apply-templates mode="table"/>
+        </tbody>
+      </tgroup>
+    </informaltable>
+  </xsl:template>
+
+  <xsl:template match="d:row" mode="table">
+    <row>
+      <xsl:apply-templates mode="table"/>
+    </row>
+  </xsl:template>
+  
+  <xsl:template match="d:entry" mode="table">
+    <entry>
+      <xsl:if test="d:para/d:center">
+        <xsl:attribute name="valign">
+          <xsl:value-of select="'middle'"/>
+        </xsl:attribute>
+        <xsl:attribute name="align">
+          <xsl:value-of select="'center'"/>
+        </xsl:attribute>
+      </xsl:if>
+
+      <xsl:choose>
+        <xsl:when test="@thead='yes'">
+          <emphasis role="bold">
+            <xsl:call-template name="table-entry"/>
+          </emphasis>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:call-template name="table-entry"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </entry>
+  </xsl:template>
+
+  <xsl:template name="table-entry">
+    <xsl:choose>
+      <xsl:when test="d:para/d:center">
+        <xsl:apply-templates select="d:para/d:center/*|d:para/d:center/text()"
+          mode="passthrough"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="d:para/*|d:para/text()" mode="passthrough"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- Handle program listings -->
+  <xsl:template match="d:programlisting" mode="passthrough">
+    <programlisting>
+      <xsl:apply-templates mode="programlisting"/>
+    </programlisting>
+  </xsl:template>
+
+  <xsl:template match="d:highlight|d:codeline" mode="programlisting">
+    <xsl:apply-templates mode="programlisting"/>
+  </xsl:template>
+
+  <xsl:template match="d:sp" mode="programlisting">
+    <xsl:text> </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="*" mode="programlisting">
+    <xsl:apply-templates select="." mode="passthrough"/>
+  </xsl:template>
+
+  <!-- Replace top-level "para" elements with "simpara" elements in
+       the purpose -->
+  <xsl:template match="*" mode="purpose">
+    <xsl:apply-templates mode="passthrough"/>
+  </xsl:template>
+
+  <xsl:template match="text()" mode="purpose">
+    <xsl:apply-templates mode="passthrough"/>
+  </xsl:template>
+
+  <xsl:template match="d:para" mode="purpose">
+    <xsl:apply-templates select="*|text()" mode="passthrough"/>
+  </xsl:template>
+
+  <!--
+  Eric Niebler: Jan-8-2008
+  Here is some 3/4-baked support for LaTeX formulas in
+  Doxygen comments. Doxygen doesn't generate the PNG files
+  when outputting XML. In order to use this code, you must
+  run Doxygen first to generate HTML (and the PNG files for
+  the formulas). You can do this in a Jamfile with 
+  "doxygen foo.html : <sources, etc...> ; ", where the ".html"
+  is significant. Then the png files should be copied into the 
+  images/ directory (or another place relative to the html/
+  directory, as specified by $boost.doxygen.formuladir XSL
+  parameter). This can be done with a custom action in a 
+  Jamfile. Finally, the docs can be built as normal.
+  See libs/accumulators/doc/Jamfile.v2 for a working example.
+  -->
+  <xsl:template match="d:formula" mode="passthrough">
+    <xsl:choose>
+      <xsl:when test="substring(*|text(), 1, 2) = '\['">
+        <equation>
+          <title/>
+          <alt>
+            <xsl:value-of select="*|text()"/>
+          </alt>
+          <mediaobject>
+            <imageobject role="html">
+              <imagedata format="PNG" align="center">
+                <xsl:attribute name="fileref">
+                  <xsl:value-of select="concat(concat(concat($boost.doxygen.formuladir, 'form_'), @id), '.png')"/>
+                </xsl:attribute>
+              </imagedata>
+            </imageobject>
+            <textobject role="tex">
+              <phrase>
+                <xsl:value-of select="*|text()"/>
+              </phrase>
+            </textobject>
+          </mediaobject>
+        </equation>
+      </xsl:when>
+      <xsl:otherwise>
+        <inlineequation>
+          <alt>
+            <xsl:value-of select="*|text()"/>
+          </alt>
+          <inlinemediaobject>
+            <imageobject role="html">
+              <imagedata format="PNG">
+                <xsl:attribute name="fileref">
+                  <xsl:value-of select="concat(concat(concat($boost.doxygen.formuladir, 'form_'), @id), '.png')"/>
+                </xsl:attribute>
+              </imagedata>
+            </imageobject>
+            <textobject role="tex">
+              <phrase>
+                <xsl:value-of select="*|text()"/>
+              </phrase>
+            </textobject>
+          </inlinemediaobject>
+        </inlineequation>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+ </xsl:stylesheet>