Imported BoostBook XSL stylesheets and DTD

[SVN r17862]
This commit is contained in:
Douglas Gregor 2003-03-12 22:01:44 +00:00
commit df433e64bd
21 changed files with 5337 additions and 0 deletions

96
.gitattributes vendored Normal file
View File

@ -0,0 +1,96 @@
* text=auto !eol svneol=native#text/plain
*.gitattributes text svneol=native#text/plain
# Scriptish formats
*.bat text svneol=native#text/plain
*.bsh text svneol=native#text/x-beanshell
*.cgi text svneol=native#text/plain
*.cmd text svneol=native#text/plain
*.js text svneol=native#text/javascript
*.php text svneol=native#text/x-php
*.pl text svneol=native#text/x-perl
*.pm text svneol=native#text/x-perl
*.py text svneol=native#text/x-python
*.sh eol=lf svneol=LF#text/x-sh
configure eol=lf svneol=LF#text/x-sh
# Image formats
*.bmp binary svneol=unset#image/bmp
*.gif binary svneol=unset#image/gif
*.ico binary svneol=unset#image/ico
*.jpeg binary svneol=unset#image/jpeg
*.jpg binary svneol=unset#image/jpeg
*.png binary svneol=unset#image/png
*.tif binary svneol=unset#image/tiff
*.tiff binary svneol=unset#image/tiff
*.svg text svneol=native#image/svg%2Bxml
# Data formats
*.pdf binary svneol=unset#application/pdf
*.avi binary svneol=unset#video/avi
*.doc binary svneol=unset#application/msword
*.dsp text svneol=crlf#text/plain
*.dsw text svneol=crlf#text/plain
*.eps binary svneol=unset#application/postscript
*.gz binary svneol=unset#application/gzip
*.mov binary svneol=unset#video/quicktime
*.mp3 binary svneol=unset#audio/mpeg
*.ppt binary svneol=unset#application/vnd.ms-powerpoint
*.ps binary svneol=unset#application/postscript
*.psd binary svneol=unset#application/photoshop
*.rdf binary svneol=unset#text/rdf
*.rss text svneol=unset#text/xml
*.rtf binary svneol=unset#text/rtf
*.sln text svneol=native#text/plain
*.swf binary svneol=unset#application/x-shockwave-flash
*.tgz binary svneol=unset#application/gzip
*.vcproj text svneol=native#text/xml
*.vcxproj text svneol=native#text/xml
*.vsprops text svneol=native#text/xml
*.wav binary svneol=unset#audio/wav
*.xls binary svneol=unset#application/vnd.ms-excel
*.zip binary svneol=unset#application/zip
# Text formats
.htaccess text svneol=native#text/plain
*.bbk text svneol=native#text/xml
*.cmake text svneol=native#text/plain
*.css text svneol=native#text/css
*.dtd text svneol=native#text/xml
*.htm text svneol=native#text/html
*.html text svneol=native#text/html
*.ini text svneol=native#text/plain
*.log text svneol=native#text/plain
*.mak text svneol=native#text/plain
*.qbk text svneol=native#text/plain
*.rst text svneol=native#text/plain
*.sql text svneol=native#text/x-sql
*.txt text svneol=native#text/plain
*.xhtml text svneol=native#text/xhtml%2Bxml
*.xml text svneol=native#text/xml
*.xsd text svneol=native#text/xml
*.xsl text svneol=native#text/xml
*.xslt text svneol=native#text/xml
*.xul text svneol=native#text/xul
*.yml text svneol=native#text/plain
boost-no-inspect text svneol=native#text/plain
CHANGES text svneol=native#text/plain
COPYING text svneol=native#text/plain
INSTALL text svneol=native#text/plain
Jamfile text svneol=native#text/plain
Jamroot text svneol=native#text/plain
Jamfile.v2 text svneol=native#text/plain
Jamrules text svneol=native#text/plain
Makefile* text svneol=native#text/plain
README text svneol=native#text/plain
TODO text svneol=native#text/plain
# Code formats
*.c text svneol=native#text/plain
*.cpp text svneol=native#text/plain
*.h text svneol=native#text/plain
*.hpp text svneol=native#text/plain
*.ipp text svneol=native#text/plain
*.tpp text svneol=native#text/plain
*.jam text svneol=native#text/plain
*.java text svneol=native#text/plain

398
dtd/boostbook.dtd Normal file
View File

@ -0,0 +1,398 @@
<!--
BoostBook DTD version 1.0
For further information, see: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Boost_Documentation_Format
Copyright (c) 2002 by Peter Simons <simons@computer.org>.
All Rights Reserved.
This DTD module is identified by the PUBLIC and SYSTEM identifiers:
PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
SYSTEM "http://cryp.to/boost-sandbox/libs/documentation/dtd/boostbook.dtd"
$Revision$
$Date$
-->
<!--========== Define XInclude features. ==========-->
<!-- This is not really integrated into the DTD yet. Needs more
research. -->
<!--
<!ELEMENT xi:include (xi:fallback)?>
<!ATTLIST xi:include
xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"
href CDATA #REQUIRED
parse (xml|text) "xml"
encoding CDATA #IMPLIED>
<!ELEMENT xi:fallback ANY>
<!ATTLIST xi:fallback
xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude">
-->
<!ENTITY % local.common.attrib "xml:base CDATA #IMPLIED">
<!--========== Define the BoostBook extensions ==========-->
<!ENTITY % boost.common.attrib "%local.common.attrib;">
<!ENTITY % boost.namespace.mix
"class|class-specialization|struct|struct-specialization|
union|union-specialization|typedef|enum|
free-function-group|function|overloaded-function|
namespace">
<!ENTITY % boost.template.mix
"template-type-parameter|template-nontype-parameter|template-varargs">
<!ENTITY % boost.class.mix
"static-constant|typedef|enum|
copy-assignment|constructor|destructor|member-function-group|
free-function-group|function|method|overloaded-function|
overloaded-method|data-member">
<!ENTITY % boost.class.content
"template?, inherit*, purpose?, description?,
(%boost.class.mix;)*">
<!ENTITY % boost.class-specialization.content
"template?, specialization?, inherit?, purpose?, description?,
(%boost.class.mix;)*">
<!ENTITY % boost.function.semantics
"para*, requires?, effects?, postconditions?, returns?, throws?,
complexity?, notes?, rationale?">
<!ENTITY % library.content
"libraryinfo, (title, ((section|library-reference|testsuite))+)?">
<!ELEMENT library (%library.content;)>
<!ATTLIST library
name CDATA #REQUIRED
dirname CDATA #REQUIRED
html-only CDATA #IMPLIED
url CDATA #IMPLIED
id CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT boostbook (title, (chapter|library)*)>
<!ATTLIST boostbook %boost.common.attrib;>
<!ELEMENT libraryinfo (author+, copyright*, legalnotice*, librarypurpose, librarycategory*)>
<!ATTLIST libraryinfo %boost.common.attrib;>
<!ELEMENT librarypurpose (#PCDATA|code|ulink|functionname|methodname|classname)*>
<!ATTLIST librarypurpose %boost.common.attrib;>
<!ELEMENT librarycategory (#PCDATA)>
<!ATTLIST librarycategory
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT libraryname (#PCDATA)>
<!ATTLIST libraryname %boost.common.attrib;>
<!ELEMENT library-reference ANY>
<!ATTLIST library-reference
%boost.common.attrib;>
<!ELEMENT librarylist EMPTY>
<!ATTLIST librarylist %boost.common.attrib;>
<!ELEMENT librarycategorylist (librarycategorydef)*>
<!ATTLIST librarycategorylist %boost.common.attrib;>
<!ELEMENT librarycategorydef (#PCDATA)>
<!ATTLIST librarycategorydef
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT header ANY>
<!ATTLIST header
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT namespace (%boost.namespace.mix;)*>
<!ATTLIST namespace
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT class (%boost.class.content;)>
<!ATTLIST class
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT struct (%boost.class.content;)>
<!ATTLIST struct
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT union (%boost.class.content;)>
<!ATTLIST union
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT class-specialization (%boost.class-specialization.content;)>
<!ATTLIST class-specialization
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT struct-specialization (%boost.class-specialization.content;)>
<!ATTLIST struct-specialization
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT union-specialization (%boost.class-specialization.content;)>
<!ATTLIST union-specialization
name CDATA #REQUIRED
%boost.common.attrib;>
<!--========= C++ Templates =========-->
<!ELEMENT template (%boost.template.mix;)*>
<!ATTLIST template %boost.common.attrib;>
<!ELEMENT template-type-parameter (default?, purpose?)>
<!ATTLIST template-type-parameter
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT template-nontype-parameter (type, default?, purpose?)>
<!ATTLIST template-nontype-parameter
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT template-varargs EMPTY>
<!ATTLIST template-varargs %boost.common.attrib;>
<!ELEMENT specialization (template-arg)*>
<!ATTLIST specialization %boost.common.attrib;>
<!ELEMENT template-arg ANY>
<!ATTLIST template-arg %boost.common.attrib;>
<!ELEMENT default ANY>
<!ATTLIST default %boost.common.attrib;>
<!ELEMENT inherit ANY>
<!ATTLIST inherit
access CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT purpose ANY>
<!ATTLIST purpose %boost.common.attrib;>
<!ELEMENT description ANY>
<!ATTLIST description %boost.common.attrib;>
<!ELEMENT type ANY>
<!ATTLIST type %boost.common.attrib;>
<!ELEMENT typedef (type?, purpose?, description?)>
<!ATTLIST typedef
type CDATA #IMPLIED
name CDATA #REQUIRED
comment CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT enum (enumvalue*, purpose?, description?)>
<!ATTLIST enum
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT enumvalue (default?)>
<!ATTLIST enumvalue
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT static-constant EMPTY>
<!ATTLIST static-constant
type CDATA #REQUIRED
name CDATA #REQUIRED
value CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT data-member (type)>
<!ATTLIST data-member
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT constructor (template?, parameter*, %boost.function.semantics;)>
<!ATTLIST constructor %boost.common.attrib;>
<!ELEMENT paramtype ANY>
<!ATTLIST paramtype %boost.common.attrib;>
<!ELEMENT effects ANY>
<!ATTLIST effects %boost.common.attrib;>
<!ELEMENT postconditions ANY>
<!ATTLIST postconditions %boost.common.attrib;>
<!ELEMENT destructor (%boost.function.semantics;)>
<!ATTLIST destructor %boost.common.attrib;>
<!ELEMENT member-function-group (method|overloaded-method)*>
<!ATTLIST member-function-group
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT overloaded-method (signature*, purpose?, %boost.function.semantics;)>
<!ATTLIST overloaded-method
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT signature (template?, type?, parameter)*>
<!ATTLIST signature
return-type CDATA #IMPLIED
cv CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT requires ANY>
<!ATTLIST requires %boost.common.attrib;>
<!ELEMENT returns ANY>
<!ATTLIST returns %boost.common.attrib;>
<!ELEMENT throws ANY>
<!ATTLIST throws %boost.common.attrib;>
<!ELEMENT complexity ANY>
<!ATTLIST complexity %boost.common.attrib;>
<!ELEMENT notes ANY>
<!ATTLIST notes %boost.common.attrib;>
<!ELEMENT method (template?, type?, parameter*, %boost.function.semantics;)>
<!ATTLIST method
name CDATA #REQUIRED
return-type CDATA #IMPLIED
cv CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT function
(template?, type?, parameter*, purpose?, %boost.function.semantics;)>
<!ATTLIST function
name CDATA #REQUIRED
return-type CDATA #IMPLIED
%boost.common.attrib;>
<!ELEMENT overloaded-function (signature*, purpose?, %boost.function.semantics;)>
<!ATTLIST overloaded-function
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT rationale ANY>
<!ATTLIST rationale %boost.common.attrib;>
<!ELEMENT functionname (#PCDATA)>
<!ATTLIST functionname %boost.common.attrib;>
<!ELEMENT copy-assignment
(template?, type?, parameter*, %boost.function.semantics;)>
<!ATTLIST copy-assignment %boost.common.attrib;>
<!ELEMENT free-function-group (function|overloaded-function)*>
<!ATTLIST free-function-group
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT precondition ANY>
<!ATTLIST precondition %boost.common.attrib;>
<!ELEMENT code ANY>
<!ATTLIST code %boost.common.attrib;>
<!ELEMENT using-namespace EMPTY>
<!ATTLIST using-namespace
name CDATA #REQUIRED
%boost.common.attrib;>
<!ELEMENT using-class EMPTY>
<!ATTLIST using-class
name CDATA #REQUIRED
conformance CDATA #IMPLIED
%boost.common.attrib;>
<!--========== Boost Testsuite Extensions ==========-->
<!ENTITY % boost.testsuite.tests
"compile-test|link-test|run-test|
compile-fail-test|link-fail-test|run-fail-test">
<!ENTITY % boost.testsuite.test.content
"source*, lib*, requirement*, purpose, if-fails?">
<!ELEMENT testsuite ((%boost.testsuite.tests;)+)>
<!ATTLIST testsuite %boost.common.attrib;>
<!ELEMENT compile-test (%boost.testsuite.test.content;)>
<!ATTLIST compile-test
filename CDATA #REQUIRED
name CDATA #IMPLIED>
<!ELEMENT link-test (%boost.testsuite.test.content;)>
<!ATTLIST link-test
filename CDATA #REQUIRED
name CDATA #IMPLIED>
<!ELEMENT run-test (%boost.testsuite.test.content;)>
<!ATTLIST run-test
filename CDATA #REQUIRED
name CDATA #IMPLIED>
<!ELEMENT compile-fail-test (%boost.testsuite.test.content;)>
<!ATTLIST compile-fail-test
filename CDATA #REQUIRED
name CDATA #IMPLIED>
<!ELEMENT link-fail-test (%boost.testsuite.test.content;)>
<!ATTLIST link-fail-test
filename CDATA #REQUIRED
name CDATA #IMPLIED>
<!ELEMENT run-fail-test (%boost.testsuite.test.content;)>
<!ATTLIST run-fail-test
filename CDATA #REQUIRED
name CDATA #IMPLIED>
<!ELEMENT source (#PCDATA|snippet)*>
<!ELEMENT snippet EMPTY>
<!ATTLIST snippet
name CDATA #REQUIRED>
<!ELEMENT lib (#PCDATA)>
<!ELEMENT requirement (#PCDATA)>
<!ATTLIST requirement
name CDATA #REQUIRED>
<!ELEMENT if-fails ANY>
<!ELEMENT parameter (paramtype, default?)>
<!ATTLIST parameter
name CDATA #IMPLIED>
<!ELEMENT programlisting ANY>
<!ATTLIST programlisting
name CDATA #IMPLIED
format CDATA #IMPLIED
conformance CDATA #IMPLIED>
<!--========== Customize the DocBook DTD ==========-->
<!ENTITY % local.tech.char.class "|functionname|libraryname|code">
<!ENTITY % local.para.class
"|using-namespace|using-class|librarylist|librarycategorylist">
<!ENTITY % local.descobj.class "|libraryinfo">
<!ENTITY % local.classname.attrib "alt CDATA #IMPLIED">
<!ENTITY % local.methodname.attrib "alt CDATA #IMPLIED">
<!ENTITY % local.refentry.class "|library-reference|testsuite">
<!ENTITY % local.title.char.mix "">
<!ENTITY % programlisting.module "IGNORE">
<!ENTITY % parameter.module "IGNORE">
<!ENTITY % function.module "IGNORE">
<!ENTITY % type.module "IGNORE">
<!--========== Import DocBook DTD ==========-->
<!ENTITY % DocBook PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
%DocBook;

189
xsl/annotation.xsl Normal file
View File

@ -0,0 +1,189 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:key name="classes" match="class" use="@name"/>
<xsl:key name="methods" match="method|overloaded-method" use="@name"/>
<xsl:key name="functions" match="function|overloaded-function" use="@name"/>
<xsl:key name="libraries" match="library" use="@name"/>
<xsl:template match="classname" mode="annotation">
<!-- Determine the (possibly qualified) class name we are looking for -->
<xsl:variable name="fullname">
<xsl:choose>
<xsl:when test="@alt">
<xsl:value-of select="@alt"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string(.)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Strip off any instantiation -->
<xsl:variable name="name">
<xsl:choose>
<xsl:when test="contains($fullname, '&lt;')">
<xsl:value-of select="substring-before($fullname, '&lt;')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$fullname"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Determine the unqualified name -->
<xsl:variable name="unqualified-name">
<xsl:call-template name="strip-qualifiers">
<xsl:with-param name="name" select="$name"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="cxx-link-name">
<xsl:with-param name="lookup" select="."/>
<xsl:with-param name="type" select="'class'"/>
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="display-name" select="string(.)"/>
<xsl:with-param name="unqualified-name" select="$unqualified-name"/>
<xsl:with-param name="nodes" select="key('classes', $unqualified-name)"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="methodname" mode="annotation">
<!-- Determine the (possibly qualified) method name we are looking for -->
<xsl:variable name="fullname">
<xsl:choose>
<xsl:when test="@alt">
<xsl:value-of select="@alt"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string(.)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Strip off any call -->
<xsl:variable name="name">
<xsl:choose>
<xsl:when test="contains($fullname, '(')">
<xsl:value-of select="substring-before($fullname, '(')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$fullname"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Determine the unqualified name -->
<xsl:variable name="unqualified-name">
<xsl:call-template name="strip-qualifiers">
<xsl:with-param name="name" select="$name"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="cxx-link-name">
<xsl:with-param name="lookup" select="."/>
<xsl:with-param name="type" select="'method'"/>
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="display-name" select="string(.)"/>
<xsl:with-param name="unqualified-name" select="$unqualified-name"/>
<xsl:with-param name="nodes" select="key('methods', $unqualified-name)"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="functionname" mode="annotation">
<!-- Determine the (possibly qualified) function name we are
looking for -->
<xsl:variable name="fullname">
<xsl:choose>
<xsl:when test="@alt">
<xsl:value-of select="@alt"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string(.)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Strip off any call -->
<xsl:variable name="name">
<xsl:choose>
<xsl:when test="contains($fullname, '(')">
<xsl:value-of select="substring-before($fullname, '(')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$fullname"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Determine the unqualified name -->
<xsl:variable name="unqualified-name">
<xsl:call-template name="strip-qualifiers">
<xsl:with-param name="name" select="$name"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="cxx-link-name">
<xsl:with-param name="lookup" select="."/>
<xsl:with-param name="type" select="'function'"/>
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="display-name" select="string(.)"/>
<xsl:with-param name="unqualified-name" select="$unqualified-name"/>
<xsl:with-param name="nodes"
select="key('functions', $unqualified-name)"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="libraryname" mode="annotation">
<xsl:variable name="name" select="text()"/>
<xsl:variable name="node" select="key('libraries', $name)"/>
<xsl:choose>
<xsl:when test="count($node)=0">
<xsl:message>
Cannot find library '<xsl:value-of select="$name"/>'
</xsl:message>
<xsl:value-of select="$name"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="library.link">
<xsl:with-param name="node" select="$node"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="text()" mode="annotation">
<xsl:param name="highlight" select="false()"/>
<xsl:choose>
<xsl:when test="$highlight">
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="code" mode="annotation">
<computeroutput>
<xsl:apply-templates mode="annotation"/>
</computeroutput>
</xsl:template>
<xsl:template match="node()" mode="annotation">
<xsl:param name="highlight" select="false()"/>
<xsl:element name="{name(.)}">
<xsl:for-each select="./@*">
<xsl:attribute name="{name(.)}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates select="./*|./text()" mode="annotation">
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:apply-templates>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

354
xsl/docbook.xsl Normal file
View File

@ -0,0 +1,354 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:include href="reference.xsl"/>
<xsl:output method="xml"
doctype-public="-//OASIS//DTD DocBook XML V4.2//EN"
doctype-system="http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"/>
<!-- The maximum number of columns allowed in preformatted text -->
<xsl:param name="max-columns" select="78"/>
<!-- The root of the Boost directory -->
<xsl:param name="boost.root" select="'./'"/>
<!-- A space-separated list of libraries to include in the
output. If this list is empty, all libraries will be included. -->
<xsl:param name="boost.include.libraries" select="''"/>
<xsl:template match="library-reference">
<xsl:choose>
<xsl:when test="ancestor::library-reference">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<section>
<xsl:choose>
<xsl:when test="@id">
<xsl:attribute name="id">
<xsl:value-of select="@id"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="ancestor::library/attribute::id">
<xsl:attribute name="id">
<xsl:value-of select="ancestor::library/attribute::id"/>
<xsl:text>.reference</xsl:text>
</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:if test="not(title)">
<title>
<xsl:text>Reference</xsl:text>
</title>
</xsl:if>
<xsl:apply-templates/>
</section>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="header">
<xsl:if test="*">
<section>
<xsl:attribute name="id">
<xsl:call-template name="generate.id"/>
</xsl:attribute>
<title>
<xsl:text>Header &lt;</xsl:text>
<ulink>
<xsl:attribute name="url">
<xsl:text>../../</xsl:text>
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:value-of select="@name"/>
</ulink>
<xsl:text>&gt;</xsl:text>
</title>
<xsl:apply-templates select="para|section" mode="annotation"/>
<xsl:apply-templates mode="synopsis">
<xsl:with-param name="indentation" select="0"/>
</xsl:apply-templates>
<xsl:apply-templates mode="reference"/>
</section>
</xsl:if>
</xsl:template>
<xsl:template match="header" mode="generate.id">
<xsl:text>header.</xsl:text>
<xsl:value-of select="translate(@name, '/','.')"/>
</xsl:template>
<xsl:template match="*" mode="passthrough">
<xsl:copy-of select="."/>
</xsl:template>
<!-- Syntax highlighting -->
<xsl:template name="highlight-keyword">
<xsl:param name="keyword"/>
<xsl:choose>
<xsl:when test="$boost.syntax.highlight='1'">
<emphasis role="bold"><xsl:value-of select="$keyword"/></emphasis>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$keyword"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="highlight-comment">
<xsl:param name="text"/>
<emphasis><xsl:value-of select="$text"/></emphasis>
</xsl:template>
<xsl:template name="monospaced">
<xsl:param name="text"/>
<computeroutput><xsl:value-of select="$text"/></computeroutput>
</xsl:template>
<!-- Linking -->
<xsl:template name="internal-link">
<xsl:param name="to"/>
<xsl:param name="text"/>
<xsl:param name="highlight" select="false()"/>
<link linkend="{$to}">
<xsl:if test="$highlight">
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="$text"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not($highlight)">
<xsl:value-of select="string($text)"/>
</xsl:if>
</link>
</xsl:template>
<xsl:template name="anchor">
<xsl:param name="to"/>
<xsl:param name="text"/>
<xsl:param name="highlight" select="false()"/>
<anchor id="{$to}"></anchor>
<xsl:if test="$highlight">
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="$text"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not($highlight)">
<xsl:value-of select="$text"/>
</xsl:if>
</xsl:template>
<xsl:template name="link-or-anchor">
<xsl:param name="to"/>
<xsl:param name="text"/>
<!-- True if we should create an anchor, otherwise we will create
a link. If you require more control (e.g., with the possibility of
having no link or anchor), set link-type instead: if present, it
takes precedence. -->
<xsl:param name="is-anchor"/>
<!-- 'anchor', 'link', or 'none' -->
<xsl:param name="link-type">
<xsl:choose>
<xsl:when test="$is-anchor">
<xsl:text>anchor</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>link</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="highlight" select="false()"/>
<xsl:choose>
<xsl:when test="$link-type='anchor'">
<xsl:call-template name="anchor">
<xsl:with-param name="to" select="$to"/>
<xsl:with-param name="text" select="$text"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$link-type='link'">
<xsl:call-template name="internal-link">
<xsl:with-param name="to" select="$to"/>
<xsl:with-param name="text" select="$text"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$link-type='none'">
<xsl:if test="$highlight">
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="$text"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not($highlight)">
<xsl:value-of select="$text"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:message>
Error: XSL template 'link-or-anchor' called with invalid link-type '<xsl:value-of select="$link-type"/>'
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="separator"/>
<xsl:template name="reference-documentation">
<xsl:param name="name"/>
<xsl:param name="refname"/>
<xsl:param name="purpose"/>
<xsl:param name="anchor"/>
<xsl:param name="synopsis"/>
<xsl:param name="text"/>
<refentry id="{$anchor}">
<refmeta>
<refentrytitle><xsl:value-of select="$name"/></refentrytitle>
<manvolnum>3</manvolnum>
</refmeta>
<refnamediv>
<refname><xsl:value-of select="$refname"/></refname>
<refpurpose><xsl:value-of select="$purpose"/></refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis>
<xsl:copy-of select="$synopsis"/>
</synopsis>
</refsynopsisdiv>
<xsl:if test="not(string($text)='')">
<refsect1>
<title>Description</title>
<xsl:copy-of select="$text"/>
</refsect1>
</xsl:if>
</refentry>
</xsl:template>
<xsl:template name="member-documentation">
<xsl:param name="name"/>
<xsl:param name="text"/>
<refsect2>
<title><xsl:copy-of select="$name"/></title>
<xsl:copy-of select="$text"/>
</refsect2>
</xsl:template>
<xsl:template name="preformatted">
<xsl:param name="text"/>
<literallayout class="monospaced">
<xsl:copy-of select="$text"/>
</literallayout>
</xsl:template>
<xsl:template name="synopsis">
<xsl:param name="text"/>
<synopsis>
<xsl:copy-of select="$text"/>
</synopsis>
</xsl:template>
<!-- Fallthrough for DocBook elements -->
<xsl:template match="*">
<xsl:element name="{name(.)}">
<xsl:for-each select="./@*">
<xsl:choose>
<xsl:when test="local-name(.)='last-revision'">
<xsl:attribute
name="rev:last-revision"
namespace="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="{name(.)}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="code">
<computeroutput>
<xsl:apply-templates mode="annotation"/>
</computeroutput>
</xsl:template>
<xsl:template match="library">
<xsl:if test="not(@html-only = 1) and
($boost.include.libraries='' or
contains($boost.include.libraries, @id))">
<chapter>
<xsl:attribute name="id">
<xsl:choose>
<xsl:when test="@id">
<xsl:value-of select="@id"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="generate-id(.)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:if test="@last-revision">
<xsl:attribute
name="rev:last-revision"
namespace="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision">
<xsl:value-of select="@last-revision"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</chapter>
</xsl:if>
</xsl:template>
<xsl:template match="chapter">
<xsl:if test="$boost.include.libraries=''">
<chapter>
<xsl:for-each select="./@*">
<xsl:attribute name="{name(.)}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</chapter>
</xsl:if>
</xsl:template>
<xsl:template match="boostbook">
<book><xsl:apply-templates/></book>
</xsl:template>
<xsl:template match="programlisting">
<programlisting><xsl:apply-templates/></programlisting>
</xsl:template>
<!-- These DocBook elements have special meaning. Use the annotation mode -->
<xsl:template match="classname|methodname|functionname|libraryname">
<xsl:apply-templates select="." mode="annotation"/>
</xsl:template>
<xsl:template match="description">
<xsl:apply-templates mode="annotation"/>
</xsl:template>
<!-- Swallow using-namespace and using-class directives along with
last-revised elements -->
<xsl:template match="using-namespace|using-class|last-revised"/>
</xsl:stylesheet>

14
xsl/doxygen/collect.xsl Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0" indent="yes" standalone="yes" />
<xsl:template match="/">
<doxygen version="{doxygen/@version}">
<!-- Load all doxgen generated xml files -->
<xsl:for-each select="doxygen/compound">
<xsl:copy-of select="document( concat(
@refid, '.xml' ) )/doxygen/*" />
</xsl:for-each>
</doxygen>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,699 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
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="''"/>
<!-- Prefix all of the headers output with this string -->
<xsl:param name="boost.doxygen.header.prefix" select="''"/>
<xsl:output method="xml" indent="yes" standalone="yes"/>
<xsl:key name="compounds-by-kind" match="compounddef" use="@kind"/>
<xsl:key name="compounds-by-id" match="compounddef" use="@id"/>
<xsl:strip-space elements="briefdescription detaileddescription"/>
<xsl:template match="/">
<xsl:apply-templates select="doxygen"/>
</xsl:template>
<xsl:template match="doxygen">
<library-reference>
<xsl:apply-templates select="key('compounds-by-kind', 'file')"/>
</library-reference>
</xsl:template>
<xsl:template match="compounddef">
<!-- The set of innernamespace nodes that limits our search -->
<xsl:param name="with-namespace-refs"/>
<xsl:param name="in-file"/>
<xsl:choose>
<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:message>
Cannot handle compounddef with kind=<xsl:value-of select="@kind"/>
</xsl:message>
</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(compoundname)"/>
<xsl:if test="$with-namespace-refs[string(text())=$fullname]">
<!-- Namespace without the prefix -->
<xsl:variable name="rest">
<xsl:call-template name="strip-qualifiers">
<xsl:with-param name="name" select="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="$in-file=string(includes)">
<!-- The short name of this class -->
<xsl:variable name="name">
<xsl:call-template name="strip-qualifiers">
<xsl:with-param name="name" select="compoundname"/>
</xsl:call-template>
</xsl:variable>
<xsl:element name="{$class-key}">
<xsl:attribute name="name">
<xsl:value-of select="$name"/>
</xsl:attribute>
<xsl:apply-templates select="templateparamlist" mode="template"/>
<xsl:apply-templates select="basecompoundref" mode="inherit"/>
<xsl:if test="briefdescription/text()|briefdescription/*">
<purpose>
<xsl:apply-templates select="briefdescription" mode="passthrough"/>
</purpose>
</xsl:if>
<xsl:if test="detaileddescription/text()|detaileddescription/*">
<xsl:apply-templates select="detaileddescription"
mode="passthrough"/>
</xsl:if>
<xsl:apply-templates/>
</xsl:element>
</xsl:if>
</xsl:template>
<xsl:template name="enum">
<xsl:variable name="name">
<xsl:call-template name="strip-qualifiers">
<xsl:with-param name="name" select="name"/>
</xsl:call-template>
</xsl:variable>
<enum>
<xsl:attribute name="name">
<xsl:value-of select="$name"/>
</xsl:attribute>
<xsl:apply-templates select="enumvalue"/>
<xsl:if test="briefdescription/text()|briefdescription/*">
<purpose>
<xsl:apply-templates select="briefdescription" mode="passthrough"/>
</purpose>
</xsl:if>
<xsl:if test="detaileddescription/text()|detaileddescription/*">
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
</xsl:if>
</enum>
</xsl:template>
<xsl:template match="enumvalue">
<enumvalue>
<xsl:attribute name="name">
<xsl:value-of select="name"/>
</xsl:attribute>
<xsl:if test="initializer">
<default>
<xsl:apply-templates select="initializer" mode="passthrough"/>
</default>
</xsl:if>
</enumvalue>
</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(compoundname)"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$include-header='yes'">
<header>
<xsl:attribute name="name">
<xsl:value-of select="concat($boost.doxygen.header.prefix,
string(compoundname))"/>
</xsl:attribute>
<xsl:apply-templates
select="detaileddescription/*|detaileddescription/text()"
mode="passthrough"/>
<xsl:apply-templates mode="toplevel">
<xsl:with-param name="with-namespace-refs"
select="innernamespace"/>
<xsl:with-param name="in-file" select="string(compoundname)"/>
</xsl:apply-templates>
</header>
</xsl:if>
</xsl:template>
<xsl:template match="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="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)/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="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="templateparamlist" mode="template">
<template>
<xsl:apply-templates mode="template"/>
</template>
</xsl:template>
<xsl:template match="param" mode="template">
<xsl:choose>
<xsl:when test="string(type)='class' or string(type)='typename'">
<template-type-parameter>
<xsl:attribute name="name">
<xsl:value-of select="string(declname)"/>
</xsl:attribute>
<xsl:if test="defval">
<default>
<xsl:apply-templates select="defval/*|defval/text()"
mode="passthrough"/>
</default>
</xsl:if>
</template-type-parameter>
</xsl:when>
<xsl:otherwise>
<xsl:message>
Cannot handle template parameter with type <xsl:value-of select="string(type)"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="templateparamlist"/>
<!-- Inheritance -->
<xsl:template match="basecompoundref" mode="inherit">
<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:template>
<xsl:template match="basecompoundref"/>
<!-- Skip over sections: they aren't very useful at all -->
<xsl:template match="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 -->
<member-function-group name="Public static functions">
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
</xsl:apply-templates>
</member-function-group>
</xsl:when>
<xsl:when test="@kind='protected-static-func'">
<!-- TBD: pass on the fact that these are static functions -->
<member-function-group name="Protected static functions">
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
</xsl:apply-templates>
</member-function-group>
</xsl:when>
<xsl:when test="@kind='private-static-func'">
<!-- TBD: pass on the fact that these are static functions -->
<member-function-group name="Private static functions">
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
</xsl:apply-templates>
</member-function-group>
</xsl:when>
<xsl:when test="@kind='public-func'">
<member-function-group name="Public member functions">
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
</xsl:apply-templates>
</member-function-group>
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="@kind='protected-func'">
<member-function-group name="Protected member functions">
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
</xsl:apply-templates>
</member-function-group>
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="@kind='private-func'">
<member-function-group name="Private member functions">
<xsl:apply-templates>
<xsl:with-param name="in-section" select="true()"/>
</xsl:apply-templates>
</member-function-group>
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="@kind='public-type'">
<xsl:apply-templates/>
</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:when>
<xsl:when test="@kind='enum'">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
Cannot handle sectiondef with kind=<xsl:value-of select="@kind"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Handle member definitions -->
<xsl:template match="memberdef">
<!-- True when we're inside a section -->
<xsl:param name="in-section" select="false()"/>
<xsl:param name="in-file" select="''"/>
<xsl:choose>
<xsl:when test="@kind='typedef'">
<xsl:call-template name="typedef"/>
</xsl:when>
<xsl:when test="@kind='function'">
<xsl:choose>
<xsl:when test="ancestor::compounddef/attribute::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::compounddef/compoundname/text())"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="string(name/text())=$in-class">
<xsl:if test="not ($in-section)">
<xsl:call-template name="constructor"/>
</xsl:if>
</xsl:when>
<xsl:when test="string(name/text())=concat('~',$in-class)">
<xsl:if test="not ($in-section)">
<xsl:call-template name="destructor"/>
</xsl:if>
</xsl:when>
<xsl:when test="string(name/text())='operator='">
<xsl:if test="not ($in-section)">
<xsl:call-template name="copy-assignment"/>
</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='enum'">
<xsl:call-template name="enum"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
Cannot handle memberdef element with kind=<xsl:value-of select="@kind"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Display typedefs -->
<xsl:template name="typedef">
<!-- TBD: Handle public/protected/private -->
<typedef>
<!-- Name of the type -->
<xsl:attribute name="name">
<xsl:value-of select="name/text()"/>
</xsl:attribute>
<!-- Comment for the type -->
<xsl:if test="briefdescription/text()|briefdescription/*">
<xsl:attribute name="comment">
<xsl:value-of select="briefdescription/text()"/>
</xsl:attribute>
</xsl:if>
<type>
<xsl:apply-templates select="type/text()|type/*"
mode="passthrough"/>
</type>
</typedef>
</xsl:template>
<!-- Handle function parameters -->
<xsl:template match="param" mode="function">
<parameter>
<!-- Parameter name -->
<xsl:attribute name="name">
<xsl:value-of select="declname/text()"/>
</xsl:attribute>
<!-- Parameter type -->
<paramtype>
<xsl:apply-templates select="type/*|type/text()" mode="passthrough"/>
</paramtype>
<!-- TBD: handling of parameter descriptions -->
<xsl:if test="defval">
<default>
<xsl:apply-templates select="defval/*|defval/text()"
mode="passthrough"/>
</default>
</xsl:if>
</parameter>
</xsl:template>
<!-- Handle function children -->
<xsl:template name="function.children">
<!-- Emit template header -->
<xsl:apply-templates select="templateparamlist" mode="template"/>
<!-- Emit function parameters -->
<xsl:apply-templates select="param" mode="function"/>
<!-- The description -->
<xsl:if test="briefdescription/text()|briefdescription/*">
<purpose>
<xsl:apply-templates select="briefdescription" mode="passthrough"/>
</purpose>
</xsl:if>
<xsl:if test="detaileddescription/text()|detaileddescription/*">
<xsl:apply-templates select="detaileddescription" mode="passthrough"/>
</xsl:if>
<xsl:apply-templates
select="detaileddescription/para/simplesect[@kind='post']"
mode="function-clauses"/>
<xsl:apply-templates
select="detaileddescription/para/simplesect[@kind='return']"
mode="function-clauses"/>
<xsl:if test="detaileddescription/para/parameterlist[@kind='exception']">
<throws>
<xsl:apply-templates
select="detaileddescription/para/parameterlist[@kind='exception']"
mode="function-clauses"/>
</throws>
</xsl:if>
</xsl:template>
<!-- Handle free functions -->
<xsl:template name="function">
<xsl:param name="in-file" select="''"/>
<xsl:if test="contains(string(location/attribute::file), $in-file)">
<function>
<xsl:attribute name="name">
<xsl:value-of select="name/text()"/>
</xsl:attribute>
<!-- Return type -->
<xsl:attribute name="return-type">
<xsl:value-of select="type"/>
</xsl:attribute>
<xsl:call-template name="function.children"/>
</function>
</xsl:if>
</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 methods -->
<xsl:template name="method">
<method>
<xsl:attribute name="name">
<xsl:value-of select="name/text()"/>
</xsl:attribute>
<!-- TBD: virtual and static functions -->
<!-- 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:attribute name="return-type">
<xsl:value-of select="type"/>
</xsl:attribute>
<xsl:call-template name="function.children"/>
</method>
</xsl:template>
<!-- Things we ignore directly -->
<xsl:template match="compoundname" mode="toplevel"/>
<xsl:template match="includes|includedby|incdepgraph|invincdepgraph" mode="toplevel"/>
<xsl:template match="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="para" mode="passthrough">
<para>
<xsl:apply-templates mode="passthrough"/>
</para>
</xsl:template>
<xsl:template match="para/simplesect" mode="passthrough">
<xsl:if test="not (@kind='return') and
not (@kind='post')">
<xsl:apply-templates mode="passthrough"/>
</xsl:if>
</xsl:template>
<xsl:template match="parameterlist" mode="passthrough"/>
<xsl:template match="bold" mode="passthrough">
<emphasis role="bold">
<xsl:apply-templates mode="passthrough"/>
</emphasis>
</xsl:template>
<!-- Handle function clauses -->
<xsl:template match="simplesect" mode="function-clauses">
<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:template>
<xsl:template match="parameterlist" mode="function-clauses">
<xsl:if test="@kind='exception'">
<simpara>
<classname><xsl:value-of select="parametername/text()"/></classname>
<xsl:text> </xsl:text>
<xsl:apply-templates
select="parameterdescription/para/text()|parameterdescription/para/*"
mode="passthrough"/>
</simpara>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

12
xsl/error.xsl Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template name="print.warning.context">
<xsl:message>
<xsl:text> In </xsl:text>
<xsl:call-template name="fully-qualified-name">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:message>
</xsl:template>
</xsl:stylesheet>

15
xsl/fo.xsl Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- Import the FO stylesheet -->
<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
<xsl:param name="chapter.autolabel" select="0"/>
<xsl:param name="refentry.generate.name" select="0"/>
<xsl:param name="refentry.generate.title" select="1"/>
<xsl:param name="fop.extensions" select="1"/>
<xsl:param name="make.year.ranges" select="1"/>
<xsl:param name="ulink.show" select="0"/>
</xsl:stylesheet>

1073
xsl/function.xsl Normal file

File diff suppressed because it is too large Load Diff

27
xsl/html-single.xsl Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"
version="1.0">
<!-- Import the HTML stylesheet -->
<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
<xsl:param name="chapter.autolabel" select="0"/>
<xsl:param name="refentry.generate.name" select="0"/>
<xsl:param name="refentry.generate.title" select="1"/>
<xsl:param name="make.year.ranges" select="1"/>
<xsl:template match="variablelist">
<p><xsl:apply-templates mode="boost.variablelist"/></p>
</xsl:template>
<xsl:template match="varlistentry" mode="boost.variablelist">
<xsl:if test="position() &gt; 1">
<br/>
</xsl:if>
<b><xsl:apply-templates select="term"/></b>:
<xsl:apply-templates select="listitem/*|listitem/text()"/>
</xsl:template>
</xsl:stylesheet>

164
xsl/html.xsl Normal file
View File

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"
version="1.0">
<!-- Import the HTML chunking stylesheet -->
<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
<xsl:param name="html.stylesheet" select="'reference.css'"/>
<xsl:param name="navig.graphics" select="1"/>
<xsl:param name="navig.graphics.extension" select="'.png'"/>
<xsl:param name="chapter.autolabel" select="0"/>
<xsl:param name="use.id.as.filename" select="1"/>
<xsl:param name="refentry.generate.name" select="0"/>
<xsl:param name="refentry.generate.title" select="1"/>
<xsl:param name="html.extra.head.links" select="1"/>
<xsl:param name="make.year.ranges" select="1"/>
<xsl:template name="header.navigation">
<table border="1" cellpadding="2" bgcolor="#007F7F">
<tr>
<td bgcolor="#FFFFFF">
<img src="../../c++boost.gif"
alt="c++boost.gif (8819 bytes)" width="277" height="86"/>
</td>
<td>
<a href="../../index.htm">
<font color="#FFFFFF" size="4" face="Arial">Home</font>
</a>
</td>
<td>
<a href="libraries.html">
<font color="#FFFFFF" size="4" face="Arial">Libraries</font>
</a>
</td>
<td>
<a href="../../people/people.htm">
<font color="#FFFFFF" size="4" face="Arial">People</font>
</a>
</td>
<td>
<a href="../../more/faq.htm">
<font color="#FFFFFF" size="4" face="Arial">FAQ</font>
</a>
</td>
<td>
<a href="../../more/index.htm">
<font color="#FFFFFF" size="4" face="Arial">More</font>
</a>
</td>
</tr>
</table>
</xsl:template>
<xsl:template name="format.cvs.revision">
<xsl:param name="text"/>
<!-- Remove the "$Date: " -->
<xsl:variable name="text.noprefix"
select="substring-after($text, '$Date: ')"/>
<!-- Grab the year -->
<xsl:variable name="year" select="substring-before($text.noprefix, '/')"/>
<xsl:variable name="text.noyear"
select="substring-after($text.noprefix, '/')"/>
<!-- Grab the month -->
<xsl:variable name="month" select="substring-before($text.noyear, '/')"/>
<xsl:variable name="text.nomonth"
select="substring-after($text.noyear, '/')"/>
<!-- Grab the year -->
<xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
<xsl:variable name="text.noday"
select="substring-after($text.nomonth, ' ')"/>
<!-- Get the time -->
<xsl:variable name="time" select="substring-before($text.noday, ' ')"/>
<xsl:variable name="month.name">
<xsl:choose>
<xsl:when test="$month=1">January</xsl:when>
<xsl:when test="$month=2">February</xsl:when>
<xsl:when test="$month=3">March</xsl:when>
<xsl:when test="$month=4">April</xsl:when>
<xsl:when test="$month=5">May</xsl:when>
<xsl:when test="$month=6">June</xsl:when>
<xsl:when test="$month=7">July</xsl:when>
<xsl:when test="$month=8">August</xsl:when>
<xsl:when test="$month=9">September</xsl:when>
<xsl:when test="$month=10">October</xsl:when>
<xsl:when test="$month=11">November</xsl:when>
<xsl:when test="$month=12">December</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
$time, ' GMT')"/>
</xsl:template>
<xsl:template match="copyright" mode="boost.footer">
<xsl:if test="position() &gt; 1">
<br/>
</xsl:if>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Copyright'"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:call-template name="dingbat">
<xsl:with-param name="dingbat">copyright</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:call-template name="copyright.years">
<xsl:with-param name="years" select="year"/>
<xsl:with-param name="print.ranges" select="$make.year.ranges"/>
<xsl:with-param name="single.year.ranges"
select="$make.single.year.ranges"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:apply-templates select="holder" mode="titlepage.mode"/>
</xsl:template>
<xsl:template name="user.footer.content">
<table width="100%">
<tr>
<td align="left">
<small>
<xsl:variable name="revision-nodes"
select="ancestor-or-self::*
[not (attribute::rev:last-revision='')]"/>
<xsl:if test="count($revision-nodes)">
<xsl:variable name="revision-node"
select="$revision-nodes[last()]"/>
<xsl:text>Last revised: </xsl:text>
<xsl:call-template name="format.cvs.revision">
<xsl:with-param name="text"
select="string($revision-node/attribute::rev:last-revision)"/>
</xsl:call-template>
</xsl:if>
</small>
</td>
<td align="right">
<small>
<xsl:apply-templates select="ancestor::*/*/copyright"
mode="boost.footer"/>
</small>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="variablelist">
<p><xsl:apply-templates mode="boost.variablelist"/></p>
</xsl:template>
<xsl:template match="varlistentry" mode="boost.variablelist">
<xsl:if test="position() &gt; 1">
<br/>
</xsl:if>
<b><xsl:apply-templates select="term"/></b>:
<xsl:apply-templates select="listitem/*|listitem/text()"/>
</xsl:template>
</xsl:stylesheet>

11
xsl/index.xsl Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="class-index">
</xsl:template>
<xsl:template match="function-index">
</xsl:template>
</xsl:stylesheet>

118
xsl/library.xsl Normal file
View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:key name="library-categories" match="library"
use="libraryinfo/librarycategory/@name"/>
<xsl:template match="librarylist">
<itemizedlist spacing="compact">
<xsl:apply-templates select="//library"
mode="build-library-list">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</itemizedlist>
</xsl:template>
<xsl:template name="library.link">
<xsl:param name="node" select="."/>
<xsl:choose>
<xsl:when test="$node/attribute::html-only = 1">
<xsl:variable name="url">
<xsl:choose>
<xsl:when test="$node/attribute::url">
<xsl:value-of select="$node/attribute::url"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('../../libs/',
$node/attribute::dirname,
'/index.html')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<ulink>
<xsl:attribute name="url">
<xsl:value-of select="$url"/>
</xsl:attribute>
<xsl:value-of select="$node/attribute::name"/>
</ulink>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="internal-link">
<xsl:with-param name="to">
<xsl:choose>
<xsl:when test="$node/attribute::id">
<xsl:value-of select="$node/attribute::id"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="generate-id($node)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="text" select="string($node/attribute::name)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="library" mode="build-library-list">
<listitem>
<simpara>
<xsl:call-template name="library.link"/>
<xsl:text> - </xsl:text>
<xsl:apply-templates select="libraryinfo/librarypurpose"
mode="build-library-list"/>
</simpara>
</listitem>
</xsl:template>
<xsl:template match="librarypurpose" mode="build-library-list">
<xsl:apply-templates/>
<xsl:text>, from </xsl:text>
<xsl:apply-templates select="../author" mode="display-author-list"/>
</xsl:template>
<xsl:template match="author" mode="display-author-list">
<xsl:if test="(position() &gt; 1) and (count(../author) &gt; 2)">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="(position() = count(../author)) and (position() &gt; 1)">
<xsl:if test="position() &lt; 3">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:text>and </xsl:text>
</xsl:if>
<xsl:apply-templates select="firstname/text()"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="surname/text()"/>
<xsl:if test="(position() = count(../author))">
<xsl:text>.</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="librarycategorylist">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="librarycategorydef">
<section>
<title><xsl:apply-templates/></title>
<xsl:variable name="name" select="@name"/>
<itemizedlist spacing="compact">
<xsl:apply-templates select="key('library-categories', $name)"
mode="build-library-list">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</itemizedlist>
</section>
</xsl:template>
<xsl:template match="libraryinfo">
<chapterinfo>
<xsl:apply-templates select="author|copyright|legalnotice"/>
</chapterinfo>
</xsl:template>
<xsl:template match="librarypurpose|librarycategory"/>
</xsl:stylesheet>

282
xsl/lookup.xsl Normal file
View File

@ -0,0 +1,282 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- Generate an ID for the entity referenced -->
<xsl:template name="generate.id">
<xsl:param name="node" select="."/>
<xsl:apply-templates select="$node" mode="generate.id"/>
</xsl:template>
<xsl:template match="*" mode="generate.id">
<xsl:value-of select="generate-id(.)"/>
</xsl:template>
<!-- Strip the qualifiers off a qualified name and return the unqualified
name. For instance, "boost::python::function" would become just
"function". -->
<xsl:template name="strip-qualifiers">
<xsl:param name="name"/>
<xsl:choose>
<xsl:when test="contains($name, '::')">
<xsl:call-template name="strip-qualifiers">
<xsl:with-param name="name" select="substring-after($name, '::')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Build the fully-qualified name of the given node -->
<xsl:template name="fully-qualified-name">
<xsl:param name="node"/>
<xsl:param name="separator" select="'::'"/>
<xsl:apply-templates select="$node" mode="fully-qualified-name">
<xsl:with-param name="separator" select="$separator"/>
</xsl:apply-templates>
</xsl:template>
<!-- Hack to make the node we are building the current node so that the
ancestor:: syntax will work -->
<xsl:template match="*" mode="fully-qualified-name">
<xsl:param name="separator" select="'::'"/>
<xsl:call-template name="build-fully-qualified-name">
<xsl:with-param name="separator" select="$separator"/>
</xsl:call-template>
</xsl:template>
<!-- The real routine that builds a fully-qualified name for the current
node. -->
<xsl:template name="build-fully-qualified-name">
<xsl:param name="separator" select="'::'"/>
<!-- The depth of qualified name element that we will print now-->
<xsl:param name="depth" select="1"/>
<!-- Determine the set of ancestor namespaces -->
<xsl:variable name="ancestors"
select="ancestor::namespace|ancestor::class"/>
<xsl:choose>
<xsl:when test="$depth &gt; count($ancestors)">
<xsl:apply-templates select="." mode="print-name"/>
</xsl:when>
<xsl:otherwise>
<xsl:if test="name($ancestors[$depth])='namespace' or
count(ancestor::free-function-group)=0">
<xsl:apply-templates select="$ancestors[$depth]" mode="print-name"/>
<xsl:value-of select="$separator"/>
</xsl:if>
<xsl:call-template name="build-fully-qualified-name">
<xsl:with-param name="separator" select="$separator"/>
<xsl:with-param name="depth" select="$depth + 1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Print the name of the current node -->
<xsl:template match="*" mode="print-name">
<xsl:value-of select="@name"/>
</xsl:template>
<xsl:template name="name-matches-node">
<!-- The name we are looking for -->
<xsl:param name="name"/>
<!-- The name to display -->
<xsl:param name="display-name" select="$name"/>
<!-- The context in which this name occurs -->
<xsl:param name="context"/>
<!-- The node that we are checking against -->
<xsl:param name="node"/>
<!-- The mode we are in. Can be one of:
matches: emits the matches as they are found (for debugging)
link: link to the node that was found
-->
<xsl:param name="mode" select="'matches'"/>
<!-- The index into the list of using directives for the context node -->
<xsl:param name="index" select="1"/>
<!-- The prefix we should append to the name when checking this node -->
<xsl:param name="prefix" select="''"/>
<!-- The fully-qualified name of the node we are checking against -->
<xsl:variable name="fully-qualified-name">
<xsl:call-template name="fully-qualified-name">
<xsl:with-param name="node" select="$node"/>
</xsl:call-template>
</xsl:variable>
<!-- The set of using directives for this context node -->
<xsl:variable name="directives"
select="$context/ancestor::*/using-namespace |
$context/ancestor::namespace |
$context/ancestor::*/using-class |
$context/ancestor::class"/>
<!-- The name of the current directive -->
<xsl:variable name="this-context">
<xsl:apply-templates select="$directives[$index]" mode="print-name"/>
</xsl:variable>
<!-- Check if we have a match -->
<xsl:variable name="have-match"
select="$fully-qualified-name = concat($prefix, $name)"/>
<xsl:if test="$have-match">
<xsl:choose>
<xsl:when test="$mode='matches'">
Match in namespace ::<xsl:value-of select="$prefix"/>
</xsl:when>
<xsl:when test="$mode='link'">
<xsl:call-template name="internal-link">
<xsl:with-param name="to">
<xsl:call-template name="generate.id">
<xsl:with-param name="node" select="$node"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="text" select="$display-name"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:if>
<xsl:if test="(not($index &gt; count($directives))) and
(not($have-match) or ($mode = 'matches'))">
<xsl:variable name="first-branch">
<xsl:if test="not ($prefix = '')">
<!-- Recurse and append the current context node to the prefix -->
<xsl:call-template name="name-matches-node">
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="display-name" select="$display-name"/>
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="node" select="$node"/>
<xsl:with-param name="mode" select="$mode"/>
<xsl:with-param name="index" select="$index + 1"/>
<xsl:with-param name="prefix"
select="concat($prefix, $this-context, '::')"/>
</xsl:call-template>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="string($first-branch) != ''">
<xsl:copy-of select="$first-branch"/>
</xsl:when>
<xsl:otherwise>
<!-- Recurse with just the current context node -->
<xsl:call-template name="name-matches-node">
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="display-name" select="$display-name"/>
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="node" select="$node"/>
<xsl:with-param name="mode" select="$mode"/>
<xsl:with-param name="index" select="$index + 1"/>
<xsl:with-param name="prefix"
select="concat($this-context, '::')"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<!-- Count the number of nodes in the set that match the given name and
lookup context -->
<xsl:template name="count-matches">
<xsl:param name="name"/>
<xsl:param name="context"/>
<xsl:param name="nodes"/>
<xsl:variable name="match-string">
<xsl:for-each select="$nodes">
<xsl:variable name="does-match">
<xsl:call-template name="name-matches-node">
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="context" select="$context"/>
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="not($does-match='')">X</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="string-length($match-string)"/>
</xsl:template>
<xsl:template name="cxx-link-name">
<!-- The actual lookup node -->
<xsl:param name="lookup"/>
<!-- The type of name to lookup (e.g., class) -->
<xsl:param name="type"/>
<!-- The name we are looking for -->
<xsl:param name="name"/>
<!-- The name we will display -->
<xsl:param name="display-name"/>
<!-- The name we are looking for (unqualified)-->
<xsl:param name="unqualified name"/>
<!-- The list of nodes that match the lookup node in both name and type -->
<xsl:param name="nodes"/>
<!-- Count the number of nodes that match -->
<xsl:variable name="matches">
<xsl:call-template name="count-matches">
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="context" select="$lookup"/>
<xsl:with-param name="nodes" select="$nodes"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$matches = 0">
<xsl:message>
<xsl:text>Cannot find </xsl:text>
<xsl:value-of select="$type"/>
<xsl:text> named '</xsl:text>
<xsl:value-of select="$name"/>
<xsl:text>'</xsl:text>
</xsl:message>
<xsl:value-of select="$display-name"/>
</xsl:when>
<xsl:when test="$matches = 1">
<xsl:for-each select="$nodes">
<xsl:call-template name="name-matches-node">
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="display-name" select="$display-name"/>
<xsl:with-param name="context" select="$lookup"/>
<xsl:with-param name="node" select="."/>
<xsl:with-param name="mode" select="'link'"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Reference to </xsl:text>
<xsl:value-of select="$type"/>
<xsl:text> '</xsl:text>
<xsl:value-of select="$name"/>
<xsl:text>' is ambiguous. Found:</xsl:text>
<xsl:for-each select="$nodes">
<xsl:call-template name="name-matches-node">
<xsl:with-param name="name" select="$name"/>
<xsl:with-param name="context" select="$lookup"/>
<xsl:with-param name="node" select="."/>
<xsl:with-param name="mode" select="'matches'"/>
</xsl:call-template>
</xsl:for-each>
</xsl:message>
<xsl:value-of select="$display-name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

95
xsl/reference.xsl Normal file
View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:include href="annotation.xsl"/>
<xsl:include href="template.xsl"/>
<xsl:include href="function.xsl"/>
<xsl:include href="type.xsl"/>
<xsl:include href="source-highlight.xsl"/>
<xsl:include href="utility.xsl"/>
<xsl:include href="lookup.xsl"/>
<xsl:include href="library.xsl"/>
<xsl:include href="index.xsl"/>
<xsl:include href="error.xsl"/>
<xsl:include href="testing/testsuite.xsl"/>
<xsl:template name="namespace-synopsis">
<xsl:param name="indentation" select="0"/>
<!-- Open namespace-->
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="concat('namespace ',@name)"/>
</xsl:call-template>
<xsl:text> {</xsl:text>
<!-- Emit namespace types -->
<xsl:apply-templates select="class|class-specialization|
struct|struct-specialization|
union|union-specialization|
typedef|enum" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation + 2"/>
</xsl:apply-templates>
<!-- Emit namespace functions -->
<xsl:apply-templates
select="free-function-group|function|overloaded-function"
mode="synopsis">
<xsl:with-param name="indentation" select="$indentation + 2"/>
</xsl:apply-templates>
<!-- Emit namespaces -->
<xsl:apply-templates select="namespace" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation + 2"/>
</xsl:apply-templates>
<!-- Close namespace -->
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:text>}</xsl:text>
</xsl:template>
<!-- Emit namespace synopsis -->
<xsl:template match="namespace" mode="synopsis">
<xsl:param name="indentation" select="0"/>
<xsl:choose>
<xsl:when test="count(ancestor::namespace)=0">
<xsl:call-template name="synopsis">
<xsl:with-param name="text">
<xsl:call-template name="namespace-synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="namespace-synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Emit namespace reference -->
<xsl:template match="namespace" mode="reference">
<xsl:apply-templates select="class|class-specialization|
struct|struct-specialization|
union|union-specialization|
namespace|typedef|enum|
free-function-group"
mode="reference">
<xsl:with-param name="indentation" select="0"/>
</xsl:apply-templates>
<xsl:apply-templates select="enum|function|overloaded-function"
mode="namespace-reference"/>
</xsl:template>
<!-- Eat extra documentation when in the synopsis or reference sections -->
<xsl:template match="para|section" mode="synopsis"/>
<xsl:template match="para|section" mode="reference"/>
</xsl:stylesheet>

125
xsl/source-highlight.xsl Normal file
View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="boost.syntax.highlight">1</xsl:param>
<xsl:template name="source-highlight">
<xsl:param name="text" select="."/>
<xsl:choose>
<xsl:when test="$boost.syntax.highlight='1'">
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="$text"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Perform C++ keyword highlighting on the given text -->
<xsl:template name="highlight-text">
<xsl:param name="text" select="."/>
<xsl:param name="keywords"
select="'asm auto bool break case catch char class const const_cast continue default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new operator private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while'"/>
<xsl:param name="best-match" select="''"/>
<!-- Determine the current keyword -->
<xsl:variable name="keyword">
<xsl:choose>
<xsl:when test="contains($keywords, ' ')">
<xsl:value-of select="substring-before($keywords, ' ')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$keywords"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Determine the set of keywords that are left -->
<xsl:variable name="keywords-left">
<xsl:if test="contains($keywords, ' ')">
<xsl:value-of select="substring-after($keywords, ' ')"/>
</xsl:if>
</xsl:variable>
<!-- The set of characters that can be identifiers -->
<xsl:variable name="id-chars" select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'"/>
<xsl:variable name="X" select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'"/>
<xsl:choose>
<!-- Have we exhausted all keywords without finding any to highlight? -->
<xsl:when test="$keyword='' and $best-match=''">
<!-- Just copy the text -->
<xsl:copy-of select="$text"/>
</xsl:when>
<!-- Have we exhausted all keywords, but have one to highlight? If so,
make sure we didn't just find part of an identifier. -->
<xsl:when
test="$keyword='' and
not (starts-with(translate(substring-after($text, $best-match),
$id-chars, $X), 'X')) and
not (substring(translate(substring-before($text, $best-match),
$id-chars, $X),
string-length(substring-before($text,
$best-match)),
1) = 'X')">
<!-- Copy text before this keyword -->
<xsl:value-of select="substring-before($text, $best-match)"/>
<!-- Highlight the keyword -->
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="$best-match"/>
</xsl:call-template>
<!-- Recurse on the rest of the text -->
<xsl:call-template name="highlight-text">
<xsl:with-param name="text"
select="substring-after($text, $best-match)"/>
</xsl:call-template>
</xsl:when>
<!-- We thought we had a keyword to highlight, but it was part of an
identifier. So output all of the text up to (but not including!)
the last letter of the identifier, and try again to
highlight. -->
<xsl:when test="$keyword=''">
<xsl:value-of select="substring-before($text, $best-match)"/>
<xsl:value-of
select="substring($best-match, 1, string-length($best-match)-1)"/>
<xsl:call-template name="highlight-text">
<xsl:with-param name="text"
select="concat(substring($best-match, string-length($best-match),
1), substring-after($text, $best-match))"/>
</xsl:call-template>
</xsl:when>
<!-- Does the text contain this keyword with a better match than we
previously had? -->
<xsl:when
test="contains($text, $keyword) and
(($best-match = '') or
(string-length(substring-before($text, $keyword)) &lt;
string-length(substring-before($text, $best-match))))">
<!-- Recurse with the current keyword as the new best match -->
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="$text"/>
<xsl:with-param name="keywords" select="$keywords-left"/>
<xsl:with-param name="best-match" select="$keyword"/>
</xsl:call-template>
</xsl:when>
<!-- Text does not contain this keyword. Just recurse normally -->
<xsl:otherwise>
<xsl:call-template name="highlight-text">
<xsl:with-param name="text" select="$text"/>
<xsl:with-param name="keywords" select="$keywords-left"/>
<xsl:with-param name="best-match" select="$best-match"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

421
xsl/template.xsl Normal file
View File

@ -0,0 +1,421 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- Determine the length of a template header synopsis -->
<xsl:template name="template.synopsis.length">
<xsl:variable name="text">
<xsl:apply-templates select="template" mode="synopsis">
<xsl:with-param name="indentation" select="0"/>
<xsl:with-param name="wrap" select="false()"/>
<xsl:with-param name="highlight" select="false()"/>
</xsl:apply-templates>
</xsl:variable>
<xsl:value-of select="string-length($text)"/>
</xsl:template>
<!-- Determine the length of a template header reference -->
<xsl:template name="template.reference.length">
<xsl:choose>
<xsl:when test="not(template)">
0
</xsl:when>
<xsl:when test="template/*/@comment|template/*/purpose">
<!-- TBD: The resulting value need only be greater than the number of
columns. We chose to add 17 because it's funny for C++
programmers. :) -->
<xsl:value-of select="$max-columns + 17"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="template.synopsis.length"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Output a template header in synopsis mode -->
<xsl:template match="template" mode="synopsis">
<xsl:param name="indentation" select="0"/>
<xsl:param name="wrap" select="true()"/>
<xsl:param name="highlight" select="true()"/>
<xsl:call-template name="template.synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="wrap" select="$wrap"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:call-template>
</xsl:template>
<!-- Output a template header in reference mode -->
<xsl:template match="template" mode="reference">
<xsl:param name="indentation" select="0"/>
<xsl:param name="highlight" select="true()"/>
<xsl:call-template name="template.reference">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:call-template>
</xsl:template>
<!-- Emit a template header synopsis -->
<xsl:template name="template.synopsis">
<xsl:param name="indentation" select="0"/>
<xsl:param name="wrap" select="true()"/>
<xsl:param name="highlight" select="true()"/>
<xsl:choose>
<xsl:when test="$highlight">
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="'template'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>template</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&lt;</xsl:text>
<xsl:call-template name="template.synopsis.parameters">
<xsl:with-param name="indentation" select="$indentation + 9"/>
<xsl:with-param name="wrap" select="$wrap"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:call-template>
<xsl:text>&gt; </xsl:text>
</xsl:template>
<!-- Display a list of template parameters for a synopsis (no comments) -->
<xsl:template name="template.synopsis.parameters">
<xsl:param name="indentation"/>
<xsl:param name="wrap" select="true()"/>
<xsl:param name="highlight" select="true()"/>
<xsl:param name="column" select="$indentation"/>
<xsl:param name="prefix" select="''"/>
<xsl:param name="parameters" select="template-type-parameter|template-varargs|template-nontype-parameter"/>
<xsl:param name="first-on-line" select="true()"/>
<xsl:if test="$parameters">
<!-- Emit the prefix (either a comma-space, or empty if this is
the first parameter) -->
<xsl:value-of select="$prefix"/>
<!-- Get the actual parameter and its attributes -->
<xsl:variable name="parameter" select="$parameters[position()=1]"/>
<xsl:variable name="rest" select="$parameters[position()!=1]"/>
<!-- Compute the actual text of this parameter -->
<xsl:variable name="text">
<xsl:call-template name="template.parameter">
<xsl:with-param name="parameter" select="$parameter"/>
<xsl:with-param name="is-last" select="not(rest)"/>
<xsl:with-param name="highlight" select="false()"/>
</xsl:call-template>
</xsl:variable>
<!-- Where will this template parameter finish? -->
<xsl:variable name="end-column"
select="$column + string-length($prefix) + string-length($text)"/>
<!-- Should the text go on this line or on the next? -->
<xsl:choose>
<xsl:when test="$first-on-line or ($end-column &lt; $max-columns) or
not($wrap)">
<!-- Print on this line -->
<xsl:call-template name="template.parameter">
<xsl:with-param name="parameter" select="$parameter"/>
<xsl:with-param name="is-last" select="not($rest)"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:call-template>
<!-- Recurse -->
<xsl:call-template name="template.synopsis.parameters">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="wrap" select="$wrap"/>
<xsl:with-param name="highlight" select="$highlight"/>
<xsl:with-param name="column" select="$end-column"/>
<xsl:with-param name="prefix" select="', '"/>
<xsl:with-param name="parameters" select="$rest"/>
<xsl:with-param name="first-on-line" select="false()"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- Print on next line -->
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="template.parameter">
<xsl:with-param name="parameter" select="$parameter"/>
<xsl:with-param name="is-last" select="not($rest)"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:call-template>
<xsl:call-template name="template.synopsis.parameters">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="wrap" select="$wrap"/>
<xsl:with-param name="highlight" select="$highlight"/>
<xsl:with-param name="column"
select="$indentation + string-length($text)"/>
<xsl:with-param name="prefix" select="', '"/>
<xsl:with-param name="parameters" select="$rest"/>
<xsl:with-param name="first-on-line" select="false()"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<!-- Emit a template header reference -->
<xsl:template name="template.reference">
<xsl:param name="indentation" select="0"/>
<xsl:param name="highlight" select="true()"/>
<xsl:if test="template-type-parameter|template-varargs|template-nontype-parameter">
<xsl:choose>
<xsl:when test="$highlight">
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="'template'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>template</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&lt;</xsl:text>
<xsl:call-template name="template.reference.parameters">
<xsl:with-param name="indentation" select="$indentation + 9"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:call-template>
<xsl:text>&gt; </xsl:text>
</xsl:if>
</xsl:template>
<!-- Display a set of template parameters for a reference -->
<xsl:template name="template.reference.parameters">
<xsl:param name="indentation"/>
<xsl:param name="highlight" select="true()"/>
<xsl:param name="parameters" select="template-type-parameter|template-varargs|template-nontype-parameter"/>
<xsl:choose>
<xsl:when test="$parameters/@comment|$parameters/purpose">
<xsl:call-template name="template.reference.parameters.comments">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="template.synopsis.parameters">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="wrap" select="true()"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Output template parameters when there are comments with the parameters.
For clarity, we output each template parameter on a separate line. -->
<xsl:template name="template.reference.parameters.comments">
<xsl:param name="indentation"/>
<xsl:param name="highlight" select="true()"/>
<xsl:param name="parameters" select="template-type-parameter|template-varargs|template-nontype-parameter"/>
<xsl:if test="$parameters">
<!-- Get the actual parameter and its attributes -->
<xsl:variable name="parameter" select="$parameters[position()=1]"/>
<xsl:variable name="rest" select="$parameters[position()!=1]"/>
<!-- Display the parameter -->
<xsl:call-template name="template.parameter">
<xsl:with-param name="parameter" select="$parameter"/>
<xsl:with-param name="is-last" select="not($rest)"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:call-template>
<xsl:if test="$rest">
<xsl:text>, </xsl:text>
</xsl:if>
<!-- Display the comment -->
<xsl:if test="$parameter/@comment|$parameter/purpose">
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:choose>
<xsl:when test="@comment">
<xsl:message>
<xsl:text>Warning: 'comment' attribute of template parameter is deprecated. Use 'purpose' element.</xsl:text>
<xsl:call-template name="print.warning.context"/>
</xsl:message>
<xsl:value-of select="concat(' // ',$parameter/@comment)"/>
</xsl:when>
<xsl:otherwise>
<xsl:text> // </xsl:text>
<xsl:apply-templates select="purpose"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
<!-- Indent the next line -->
<xsl:if test="$parameter/@comment or $parameter/purpose or $rest">
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
</xsl:if>
<!-- Recurse to print the rest of the parameters -->
<xsl:call-template name="template.reference.parameters.comments">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="highlight" select="$highlight"/>
<xsl:with-param name="parameters" select="$rest"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Print a template parameter -->
<xsl:template name="template.parameter">
<xsl:param name="parameter"/>
<xsl:param name="is-last"/>
<xsl:param name="highlight" select="true()"/>
<xsl:apply-templates select="$parameter"
mode="print.parameter">
<xsl:with-param name="parameter" select="$parameter"/>
<xsl:with-param name="is-last" select="$is-last"/>
<xsl:with-param name="highlight" select="$highlight"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="template-type-parameter" mode="print.parameter">
<xsl:param name="parameter"/>
<xsl:param name="is-last"/>
<xsl:param name="highlight"/>
<xsl:choose>
<xsl:when test="$highlight">
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="'typename'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>typename</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
<xsl:value-of select="$parameter/@name"/>
<xsl:variable name="def">
<xsl:choose>
<xsl:when test="$parameter/@default">
<xsl:message>
<xsl:text>Warning: 'default' attribute of template parameter element is deprecated. Use 'default' element.</xsl:text>
<xsl:call-template name="print.warning.context"/>
</xsl:message>
<xsl:choose>
<xsl:when test="$highlight and false()">
<xsl:call-template name="source-highlight">
<xsl:with-param name="text">
<xsl:value-of select="$parameter/@default"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$parameter/@default"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$parameter/default">
<xsl:choose>
<xsl:when test="$highlight">
<xsl:apply-templates
select="$parameter/default/*|$parameter/default/text()"
mode="annotation"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string($parameter/default)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:if test="not($def='')">
<xsl:text> = </xsl:text>
<xsl:copy-of select="$def"/>
<!-- If this is the last parameter, add an extra space to
avoid printing >> -->
<xsl:if
test="$is-last and (substring($def, string-length($def))='&gt;')">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template match="template-nontype-parameter" mode="print.parameter">
<xsl:param name="parameter"/>
<xsl:param name="is-last"/>
<xsl:param name="highlight"/>
<xsl:choose>
<xsl:when test="$highlight">
<xsl:call-template name="source-highlight">
<xsl:with-param name="text">
<xsl:apply-templates
select="$parameter/type/*|$parameter/type/text()"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$parameter/type/*|$parameter/type/text()"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
<xsl:value-of select="$parameter/@name"/>
<xsl:variable name="def">
<xsl:if test="$parameter/default">
<xsl:choose>
<xsl:when test="$highlight">
<xsl:apply-templates
select="$parameter/default/*|$parameter/default/text()"
mode="annotation"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string($parameter/default)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:if test="not($def='')">
<xsl:text> = </xsl:text>
<xsl:copy-of select="$def"/>
<!-- If this is the last parameter, add an extra space to
avoid printing >> -->
<xsl:if
test="$is-last and (substring($def, string-length($def))='&gt;')">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template match="template-varargs" mode="print.parameter">
<xsl:text>...</xsl:text>
</xsl:template>
<xsl:template match="specialization">
<xsl:text>&lt;</xsl:text>
<xsl:apply-templates select="template-arg"/>
<xsl:text>&gt;</xsl:text>
</xsl:template>
<xsl:template match="template-arg">
<xsl:if test="position() &gt; 1">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:apply-templates mode="annotation"/>
</xsl:template>
</xsl:stylesheet>

236
xsl/testing/Jamfile.xsl Normal file
View File

@ -0,0 +1,236 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:include href="http://docbook.sourceforge.net/release/xsl/current/html/chunker.xsl"/>
<xsl:include href="http://docbook.sourceforge.net/release/xsl/current/common/common.xsl"/>
<!-- The root of the Boost directory -->
<xsl:param name="boost.root"/>
<!-- The number of columns in a source file line -->
<xsl:param name="boost.source.columns" select="78"/>
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:if test="$boost.root">
<!-- Output testsuite Jamfiles -->
<xsl:apply-templates select="//testsuite" mode="Jamfile"/>
<!-- Output any source files that are written in XML -->
<xsl:apply-templates select="//source" mode="testsuite.generate"/>
</xsl:if>
<xsl:if test="not($boost.root)">
<xsl:message>
Please set the XSL stylesheet parameter "boost.root" to the top-level
Boost directory (i.e., BOOST_ROOT)
</xsl:message>
</xsl:if>
</xsl:template>
<xsl:template match="testsuite" mode="Jamfile">
<xsl:variable name="subproject"
select="concat('libs/',ancestor::library/attribute::dirname,'/test')"/>
<xsl:variable name="filename"
select="concat($boost.root,'/libs/',ancestor::library/attribute::dirname,
'/test/Jamfile')"/>
<xsl:call-template name="write.text.chunk">
<xsl:with-param name="filename" select="$filename"/>
<xsl:with-param name="content">
<xsl:call-template name="source.print.header">
<xsl:with-param name="prefix" select="'#'"/>
</xsl:call-template>
# Testing Jamfile autogenerated from XML source
subproject <xsl:value-of select="$subproject"/> ;
# bring in rules for testing
SEARCH on testing.jam = $(BOOST_BUILD_PATH) ;
include testing.jam ;
# Make tests run by default.
DEPENDS all : test ;
{
# look in BOOST_ROOT for sources first, just in this Jamfile
local SEARCH_SOURCE = $(BOOST_ROOT) $(SEARCH_SOURCE) ;
test-suite <xsl:value-of select="ancestor::library/attribute::dirname"/>
: <xsl:apply-templates mode="Jamfile"/> ;
}
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="compile-test|link-test|run-test|compile-fail-test|link-fail-test|run-fail-test"
mode="Jamfile">
<xsl:variable name="fullname"
select="concat(substring-before(local-name(.), '-test'), ' libs/',
ancestor::library/attribute::dirname, '/test/',
@filename)"/>
<xsl:text>[ </xsl:text>
<xsl:value-of select="$fullname"/>
<xsl:apply-templates select="lib" mode="Jamfile"/>
<xsl:text> : </xsl:text>
<!-- ... -->
<xsl:text> : </xsl:text>
<!-- ... -->
<xsl:text> : </xsl:text>
<xsl:apply-templates select="requirement" mode="Jamfile"/>
<!-- ... -->
<xsl:text> : </xsl:text>
<xsl:if test="@name">
<xsl:value-of select="@name"/>
</xsl:if>
<xsl:text> ]</xsl:text>
</xsl:template>
<xsl:template match="lib" mode="Jamfile">
<xsl:text> &lt;lib&gt;</xsl:text><xsl:value-of select="text()"/>
</xsl:template>
<xsl:template match="requirement" mode="Jamfile">
<xsl:if test="count(preceding-sibling::requirement) &gt; 0">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="concat('&lt;', @name, '&gt;')"/>
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="source" mode="testsuite.generate">
<xsl:variable name="filename"
select="concat($boost.root,'/libs/',ancestor::library/attribute::dirname,
'/test/',../@filename)"/>
<xsl:variable name="prefix" select="'//'"/>
<xsl:call-template name="write.text.chunk">
<xsl:with-param name="filename" select="$filename"/>
<xsl:with-param name="content">
<xsl:call-template name="source.print.header">
<xsl:with-param name="prefix" select="'//'"/>
</xsl:call-template>
<!-- Source code -->
<xsl:apply-templates mode="testsuite.generate"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="snippet" mode="testsuite.generate">
<xsl:variable name="snippet-name" select="@name"/>
<xsl:value-of select="//programlisting[@name=$snippet-name]"/>
</xsl:template>
<!-- Prints a header to a source file containing the library name,
copyright information, license information, and a link to the Boost
web site. The text is output using the "prefix" parameter at the
beginning of each line (it should denote a single-line comment) and
will only print up to boost.source.columns characters per line
(including the prefix). -->
<xsl:template name="source.print.header">
<xsl:param name="prefix"/>
<!-- Library name -->
<xsl:value-of select="concat($prefix, ' ',
ancestor::library/attribute::name,
' library')"/>
<xsl:text>&#10;</xsl:text>
<!-- Copyrights -->
<xsl:apply-templates select="ancestor::library/libraryinfo/copyright"
mode="testsuite.generate">
<xsl:with-param name="prefix" select="$prefix"/>
</xsl:apply-templates>
<!-- Legal notice -->
<xsl:apply-templates select="ancestor::library/libraryinfo/legalnotice"
mode="testsuite.generate">
<xsl:with-param name="prefix" select="$prefix"/>
</xsl:apply-templates>
<xsl:text>&#10;&#10;</xsl:text>
<!-- For more information... -->
<xsl:value-of
select="concat($prefix,
' For more information, see http://www.boost.org/')"/>
<xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="copyright" mode="testsuite.generate">
<xsl:param name="prefix"/>
<xsl:text>&#10;</xsl:text>
<xsl:value-of select="concat($prefix, ' Copyright (C) ')"/>
<xsl:call-template name="copyright.years">
<xsl:with-param name="years" select="year"/>
<xsl:with-param name="print.ranges" select="1"/>
<xsl:with-param name="single.year.ranges" select="1"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:apply-templates select="holder" mode="titlepage.mode"/>
</xsl:template>
<xsl:template match="legalnotice" mode="testsuite.generate">
<xsl:param name="prefix"/>
<xsl:variable name="text" select="normalize-space(.)"/>
<xsl:text>&#10;&#10;</xsl:text>
<xsl:value-of select="concat($prefix, ' ')"/>
<xsl:call-template name="source.print.legalnotice">
<xsl:with-param name="prefix" select="$prefix"/>
<xsl:with-param name="text" select="$text"/>
<xsl:with-param name="column" select="string-length($prefix) + 1"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="source.print.legalnotice">
<xsl:param name="prefix"/>
<xsl:param name="text"/>
<xsl:param name="column"/>
<xsl:if test="contains($text, ' ') or string-length($text) &gt; 0">
<xsl:variable name="word">
<xsl:choose>
<xsl:when test="contains($text, ' ')">
<xsl:value-of select="substring-before($text, ' ')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="rest" select="substring-after($text, ' ')"/>
<xsl:choose>
<xsl:when
test="$column + string-length($word) &gt; $boost.source.columns">
<xsl:text>&#10;</xsl:text>
<xsl:value-of select="concat($prefix, ' ')"/>
<xsl:call-template name="source.print.legalnotice">
<xsl:with-param name="prefix" select="$prefix"/>
<xsl:with-param name="text" select="$text"/>
<xsl:with-param name="column" select="string-length($prefix) + 1"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($word, ' ')"/>
<xsl:call-template name="source.print.legalnotice">
<xsl:with-param name="prefix" select="$prefix"/>
<xsl:with-param name="text" select="$rest"/>
<xsl:with-param name="column"
select="$column + string-length($word) + 1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template match="*" mode="testsuite.generate"/>
</xsl:stylesheet>

104
xsl/testing/testsuite.xsl Normal file
View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="testsuite">
<section>
<xsl:if test="@id">
<xsl:attribute name="id">
<xsl:value-of select="@id"/>
</xsl:attribute>
</xsl:if>
<title>Testsuite</title>
<xsl:if test="compile-test|link-test|run-test">
<section>
<xsl:if test="@id">
<xsl:attribute name="id">
<xsl:value-of select="@id"/>
<xsl:text>.acceptance</xsl:text>
</xsl:attribute>
</xsl:if>
<title>Acceptance tests</title>
<informaltable>
<tgroup cols="3">
<colspec colnum="2" colwidth="1in"/>
<thead>
<row>
<entry>Test</entry>
<entry>Type</entry>
<entry>Description</entry>
<entry>If failing...</entry>
</row>
</thead>
<tbody>
<xsl:apply-templates select="compile-test|link-test|run-test"/>
</tbody>
</tgroup>
</informaltable>
</section>
</xsl:if>
<xsl:if test="compile-fail-test|link-fail-test|run-fail-test">
<section>
<xsl:if test="@id">
<xsl:attribute name="id">
<xsl:value-of select="@id"/>
<xsl:text>.negative</xsl:text>
</xsl:attribute>
</xsl:if>
<title>Negative tests</title>
<informaltable>
<tgroup cols="3">
<colspec colnum="2" colwidth="1in"/>
<thead>
<row>
<entry>Test</entry>
<entry>Type</entry>
<entry>Description</entry>
<entry>If failing...</entry>
</row>
</thead>
<tbody>
<xsl:apply-templates
select="compile-fail-test|link-fail-test|run-fail-test"/>
</tbody>
</tgroup>
</informaltable>
</section>
</xsl:if>
</section>
</xsl:template>
<xsl:template match="compile-test|link-test|run-test|
compile-fail-test|link-fail-test|run-fail-test">
<row>
<entry>
<simpara>
<ulink>
<xsl:attribute name="url">
<xsl:value-of
select="concat('../../libs/',
ancestor::library/attribute::dirname, '/test/',
@filename)"/>
</xsl:attribute>
<xsl:value-of select="@filename"/>
</ulink>
</simpara>
</entry>
<entry>
<simpara>
<xsl:value-of select="substring-before(local-name(.), '-test')"/>
</simpara>
</entry>
<entry><xsl:apply-templates select="purpose/*"/></entry>
<entry><xsl:apply-templates select="if-fails/*"/></entry>
</row>
</xsl:template>
<xsl:template match="snippet">
<xsl:variable name="snippet-name" select="@name"/>
<xsl:apply-templates select="//programlisting[@name=$snippet-name]"/>
</xsl:template>
</xsl:stylesheet>

886
xsl/type.xsl Normal file
View File

@ -0,0 +1,886 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:strip-space elements="inherit"/>
<!-- When true, the stylesheet will emit compact definitions of
enumerations when the enumeration does not have any detailed
description. A compact definition renders the enum definition along
with a comment for the purpose of the enum (if it exists) directly
within the synopsis. A non-compact definition will create a
separate refentry element for the enum. -->
<xsl:param name="boost.compact.enum">1</xsl:param>
<xsl:template match="class|struct|union" mode="generate.id">
<xsl:value-of select="local-name(.)"/>
<xsl:text>.</xsl:text>
<xsl:call-template name="fully-qualified-name">
<xsl:with-param name="node" select="."/>
<xsl:with-param name="separator" select="'.'"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="enum" mode="generate.id">
<xsl:text>enum.</xsl:text>
<xsl:call-template name="fully-qualified-name">
<xsl:with-param name="node" select="."/>
<xsl:with-param name="separator" select="'.'"/>
</xsl:call-template>
</xsl:template>
<!-- Display the full name of the current node, e.g., "Class
template function". -->
<xsl:template name="type.display.name">
<xsl:choose>
<xsl:when test="contains(local-name(.), 'class')">
<xsl:text>Class </xsl:text>
</xsl:when>
<xsl:when test="contains(local-name(.), 'struct')">
<xsl:text>Struct </xsl:text>
</xsl:when>
<xsl:when test="contains(local-name(.), 'union')">
<xsl:text>Union </xsl:text>
</xsl:when>
<xsl:when test="local-name(.)='enum'">
<xsl:text>Type </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:message>
Unknown type element "<xsl:value-of select="local-name(.)"/>" in type.display.name
</xsl:message>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="template and count(template/*) &gt; 0">
<xsl:text>template </xsl:text>
</xsl:if>
<xsl:call-template name="monospaced">
<xsl:with-param name="text">
<xsl:value-of select="@name"/>
<xsl:apply-templates select="specialization"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- Determine the class key for the given node -->
<xsl:template name="type.class.key">
<xsl:param name="node" select="."/>
<xsl:choose>
<xsl:when test="contains(local-name($node), '-specialization')">
<xsl:value-of select="substring-before(local-name($node), '-')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="local-name($node)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Emit class synopsis -->
<xsl:template match="class|class-specialization|
struct|struct-specialization|
union|union-specialization" mode="synopsis">
<xsl:param name="indentation"/>
<!-- The keyword used to declare this class type, e.g., class,
struct, or union. -->
<xsl:variable name="class-key">
<xsl:call-template name="type.class.key"/>
</xsl:variable>
<!-- Spacing -->
<xsl:if test="not (local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() &gt; 1)">
<xsl:text>&#10;</xsl:text>
</xsl:if>
<xsl:text>&#10;</xsl:text>
<!-- Calculate how long this declaration would be if we put it all
on one line -->
<xsl:variable name="full-decl-string">
<xsl:apply-templates select="template" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="wrap" select="false()"/>
</xsl:apply-templates>
<xsl:value-of select="$class-key"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:apply-templates select="specialization"/>
<xsl:text>;</xsl:text>
</xsl:variable>
<xsl:choose>
<xsl:when test="(string-length($full-decl-string) +
string-length($indentation)) &lt; $max-columns">
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="internal-link">
<xsl:with-param name="to">
<xsl:call-template name="generate.id">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="text">
<xsl:apply-templates select="template" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
<xsl:value-of select="$class-key"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:apply-templates select="specialization"/>
<xsl:text>;</xsl:text>
</xsl:with-param>
<xsl:with-param name="highlight" select="true()"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- Template header -->
<xsl:if test="template">
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:apply-templates select="template" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:apply-templates>
<xsl:text>&#10;</xsl:text>
<!-- Indent class templates' names in the synopsis -->
<xsl:text> </xsl:text>
</xsl:if>
<!-- Class name -->
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="$class-key"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:call-template name="internal-link">
<xsl:with-param name="to">
<xsl:call-template name="generate.id">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="text" select="string(@name)"/>
</xsl:call-template>
<xsl:apply-templates select="specialization"/>
<xsl:text>;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<!-- Free functions associated with the class -->
<xsl:apply-templates select="free-function-group" mode="header-synopsis">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="class" select="@name"/>
</xsl:apply-templates>
</xsl:template>
<!-- Emit a typedef synopsis -->
<xsl:template name="type.typedef.display.aligned">
<xsl:param name="indentation"/>
<xsl:param name="max-type-length"/>
<xsl:param name="max-name-length"/>
<!-- Padding for the typedef types -->
<xsl:variable name="type-padding">
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$max-type-length"/>
</xsl:call-template>
</xsl:variable>
<!-- Padding for the typedef names -->
<xsl:variable name="name-padding">
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$max-name-length"/>
</xsl:call-template>
</xsl:variable>
<xsl:text>&#10;</xsl:text>
<xsl:choose>
<!-- Create a vertical ellipsis -->
<xsl:when test="@name = '...'">
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation + 3"/>
</xsl:call-template>
<xsl:text>.&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation + 3"/>
</xsl:call-template>
<xsl:text>.&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation + 3"/>
</xsl:call-template>
<xsl:text>.</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="'typedef'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<!-- Length of the type -->
<xsl:variable name="type-length">
<xsl:choose>
<xsl:when test="@type">
<xsl:message>
<xsl:text>Warning: `type' attribute of `typedef' element is deprecated. Use 'type' element instead.</xsl:text>
<xsl:call-template name="print.warning.context"/>
</xsl:message>
<xsl:value-of select="string-length(@type)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string-length(type)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Emit the type -->
<xsl:choose>
<xsl:when test="@type">
<xsl:value-of select="@type"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="type/*|type/text()"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$max-type-length &gt; 0">
<xsl:value-of select="substring($type-padding, 1,
$max-type-length - $type-length)"/>
<xsl:text> </xsl:text>
<xsl:value-of select="substring(concat(@name, ';', $name-padding),
1, $max-name-length)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(' ',@name,';')"/>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="purpose">
<xsl:choose>
<xsl:when test="@comment">
<xsl:message>
<xsl:text>Warning: `comment' attribute of `typedef' element is deprecated. Use `purpose' element instead.</xsl:text>
<xsl:call-template name="print.warning.context"/>
</xsl:message>
<xsl:value-of select="@comment"/>
</xsl:when>
<xsl:when test="purpose">
<xsl:apply-templates select="purpose"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:if test="@comment or purpose">
<xsl:text> </xsl:text>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
<xsl:copy-of select="$purpose"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="typedef" mode="synopsis">
<xsl:param name="indentation"/>
<xsl:param name="max-type-length" select="0"/>
<xsl:param name="max-name-length" select="0"/>
<!-- Spacing -->
<xsl:if test="not (local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() &gt; 1)">
<xsl:text>&#10;</xsl:text>
</xsl:if>
<xsl:call-template name="type.typedef.display.aligned">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="max-type-length" select="$max-type-length"/>
<xsl:with-param name="max-name-length" select="$max-name-length"/>
</xsl:call-template>
</xsl:template>
<!-- TBD: Implement this -->
<xsl:template match="typedef" mode="reference"/>
<!-- Emit a list of static constants -->
<xsl:template match="static-constant" mode="synopsis">
<xsl:param name="indentation"/>
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="source-highlight">
<xsl:with-param name="text" select="concat('static const ', @type, ' ',
@name, ' = ', @value,';')"/>
</xsl:call-template>
<xsl:if test="@comment">
<xsl:text> </xsl:text>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text" select="concat('// ', @comment)"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Emit a list of base classes -->
<xsl:template match="inherit">
<xsl:choose>
<xsl:when test="position()=1">
<xsl:text> : </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>, </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="@access"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:apply-templates mode="annotation">
<xsl:with-param name="highlight" select="true()"/>
</xsl:apply-templates>
</xsl:template>
<!-- Find the maximum length of the types in typedefs -->
<xsl:template name="find-max-type-length">
<xsl:param name="typedefs" select="typedef"/>
<xsl:param name="max-length" select="0"/>
<xsl:param name="want-name" select="false()"/>
<xsl:choose>
<xsl:when test="$typedefs">
<xsl:variable name="typedef" select="$typedefs[position()=1]"/>
<xsl:variable name="rest" select="$typedefs[position()!=1]"/>
<!-- Find the length of the type -->
<xsl:variable name="length">
<xsl:choose>
<xsl:when test="$typedef/@name != '...'">
<xsl:choose>
<xsl:when test="$want-name">
<xsl:value-of select="string-length($typedef/@name) + 1"/>
</xsl:when>
<xsl:when test="$typedef/@type">
<xsl:value-of select="string-length($typedef/@type)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string-length($typedef/type)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
0
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Pass on the larger length -->
<xsl:choose>
<xsl:when test="$length &gt; $max-length">
<xsl:call-template name="find-max-type-length">
<xsl:with-param name="typedefs" select="$rest"/>
<xsl:with-param name="max-length" select="$length"/>
<xsl:with-param name="want-name" select="$want-name"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="find-max-type-length">
<xsl:with-param name="typedefs" select="$rest"/>
<xsl:with-param name="max-length" select="$max-length"/>
<xsl:with-param name="want-name" select="$want-name"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$max-length"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="constructor" mode="synopsis">
<xsl:param name="indentation"/>
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="context" select="../@name"/>
<xsl:with-param name="is-reference" select="false()"/>
<xsl:with-param name="constructor-for" select="../@name"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="copy-assignment" mode="synopsis">
<xsl:param name="indentation"/>
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="context" select="../@name"/>
<xsl:with-param name="is-reference" select="false()"/>
<xsl:with-param name="copy-assign-for" select="../@name"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="destructor" mode="synopsis">
<xsl:param name="indentation"/>
<xsl:call-template name="function">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="context" select="../@name"/>
<xsl:with-param name="is-reference" select="false()"/>
<xsl:with-param name="destructor-for" select="../@name"/>
</xsl:call-template>
</xsl:template>
<!-- Emit class reference documentation -->
<xsl:template match="class|class-specialization|
struct|struct-specialization|
union|union-specialization" mode="reference">
<!-- The keyword used to declare this class type, e.g., class,
struct, or union. -->
<xsl:variable name="class-key">
<xsl:call-template name="type.class.key"/>
</xsl:variable>
<xsl:call-template name="separator"/>
<xsl:call-template name="reference-documentation">
<xsl:with-param name="refname">
<xsl:call-template name="fully-qualified-name">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
<xsl:apply-templates select="specialization"/>
</xsl:with-param>
<xsl:with-param name="purpose" select="./purpose"/>
<xsl:with-param name="anchor">
<xsl:call-template name="generate.id">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="name">
<xsl:call-template name="type.display.name"/>
</xsl:with-param>
<xsl:with-param name="synopsis">
<!-- Template header -->
<xsl:if test="template">
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="0"/>
</xsl:call-template>
<xsl:apply-templates select="template" mode="reference">
<xsl:with-param name="indentation" select="0"/>
</xsl:apply-templates>
</xsl:if>
<xsl:text>&#10;</xsl:text>
<!-- Class name -->
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="0"/>
</xsl:call-template>
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="$class-key"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:apply-templates select="specialization"/>
<!-- Base class list -->
<xsl:apply-templates select="inherit"/>
<!-- Opening brace and public designator -->
<xsl:text> {&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="0"/>
</xsl:call-template>
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="'public'"/>
</xsl:call-template>
<xsl:text>:</xsl:text>
<!-- Typedefs -->
<xsl:if test="typedef">
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="2"/>
</xsl:call-template>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text" select="'// types'"/>
</xsl:call-template>
<xsl:variable name="max-type-length">
<xsl:call-template name="find-max-type-length"/>
</xsl:variable>
<xsl:variable name="max-name-length">
<xsl:call-template name="find-max-type-length">
<xsl:with-param name="want-name" select="true()"/>
</xsl:call-template>
</xsl:variable>
<xsl:apply-templates select="typedef" mode="synopsis">
<xsl:with-param name="indentation" select="2"/>
<xsl:with-param name="max-type-length"
select="$max-type-length"/>
<xsl:with-param name="max-name-length"
select="$max-name-length"/>
</xsl:apply-templates>
</xsl:if>
<!-- Static constants -->
<xsl:if test="static-constant">
<xsl:text>&#10;</xsl:text>
<xsl:if test="typedef">
<xsl:text>&#10;</xsl:text>
</xsl:if>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="2"/>
</xsl:call-template>
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text" select="'// static constants'"/>
</xsl:call-template>
<xsl:apply-templates select="static-constant" mode="synopsis">
<xsl:with-param name="indentation" select="2"/>
</xsl:apply-templates>
</xsl:if>
<!-- Construct/Copy/Destruct -->
<xsl:call-template name="construct-copy-destruct-synopsis">
<xsl:with-param name="indentation" select="2"/>
</xsl:call-template>
<!-- Member functions -->
<xsl:apply-templates
select="member-function-group|method|overloaded-method"
mode="synopsis">
<xsl:with-param name="indentation" select="2"/>
</xsl:apply-templates>
<!-- Data members -->
<xsl:apply-templates select="data-member" mode="synopsis">
<xsl:with-param name="indentation" select="2"/>
</xsl:apply-templates>
<!-- Closing brace -->
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="0"/>
</xsl:call-template>
<xsl:text>};</xsl:text>
<!-- Associated free functions -->
<xsl:apply-templates select="free-function-group" mode="synopsis">
<xsl:with-param name="indentation" select="0"/>
<xsl:with-param name="class" select="@name"/>
</xsl:apply-templates>
</xsl:with-param>
<xsl:with-param name="text">
<!-- Paragraphs go into the top of the "Description" section. -->
<xsl:if test="para">
<xsl:message>
<xsl:text>Warning: Use of 'para' elements in 'class' element is deprecated.&#10;Wrap them in a 'description' element.</xsl:text>
<xsl:call-template name="print.warning.context"/>
</xsl:message>
<xsl:apply-templates select="para" mode="annotation"/>
</xsl:if>
<xsl:apply-templates select="description"/>
<xsl:call-template name="construct-copy-destruct-reference"/>
<xsl:apply-templates
select="member-function-group|method|overloaded-method"
mode="reference"/>
<xsl:apply-templates select="free-function-group" mode="reference">
<xsl:with-param name="class" select="@name"/>
</xsl:apply-templates>
<!-- Specializations of this class -->
<!-- TBD: fix this. We should key off the class name and match
fully-qualified names -->
<xsl:variable name="name" select="@name"/>
<xsl:if test="local-name(.)='class' and
../class-specialization[@name=$name]">
<refsect2>
<title>Specializations</title>
<itemizedlist>
<xsl:apply-templates
select="../class-specialization[@name=$name]"
mode="specialization-list"/>
</itemizedlist>
</refsect2>
</xsl:if>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- Output a link to a specialization -->
<xsl:template match="class-specialization|
struct-specialization|
union-specialization" mode="specialization-list">
<listitem>
<para>
<xsl:call-template name="internal-link">
<xsl:with-param name="to">
<xsl:call-template name="generate.id">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="text">
<xsl:call-template name="type.display.name"/>
</xsl:with-param>
</xsl:call-template>
</para>
</listitem>
</xsl:template>
<!-- Data member synopsis -->
<xsl:template match="data-member" mode="synopsis">
<xsl:param name="indentation"/>
<!-- Spacing -->
<xsl:if
test="not(local-name(preceding-sibling::*[position()=1])=local-name(.))">
<xsl:text>&#10;</xsl:text>
</xsl:if>
<!-- Indent -->
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:apply-templates select="type/*|type/text()" mode="annotation"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>;</xsl:text>
</xsl:template>
<!-- Enumeration synopsis -->
<xsl:template match="enum" mode="synopsis">
<xsl:param name="indentation"/>
<!-- Spacing -->
<xsl:if
test="(not (local-name(preceding-sibling::*[position()=1])=local-name(.))
and (position() &gt; 1)) or
not (para or not ($boost.compact.enum=1))">
<xsl:text>&#10;</xsl:text>
</xsl:if>
<!-- Indent -->
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:choose>
<!-- When there is a detailed description, we only put the
declaration in the synopsis and will put detailed documentation
in either a <refentry/> or in class documentation. -->
<xsl:when test="para or not ($boost.compact.enum=1)">
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="'enum'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:call-template name="internal-link">
<xsl:with-param name="to">
<xsl:call-template name="generate.id">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="text" select="string(@name)"/>
<xsl:with-param name="higlhight" select="false()"/>
</xsl:call-template>
</xsl:when>
<!-- When there is no detailed description, we put the enum
definition within the synopsis. The purpose of the enum (if
available) is formatted as a comment prior to the
definition. This way, we do not create a separate block of text
for what is generally a very small amount of information. -->
<xsl:otherwise>
<xsl:if test="purpose">
<xsl:call-template name="highlight-comment">
<xsl:with-param name="text">
<xsl:text>// </xsl:text>
<xsl:apply-templates select="purpose/*" mode="annotation"/>
</xsl:with-param>
</xsl:call-template>
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="'enum'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:call-template name="anchor">
<xsl:with-param name="to">
<xsl:call-template name="generate.id">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="text" select="@name"/>
<xsl:with-param name="higlhight" select="false()"/>
</xsl:call-template>
<xsl:text> { </xsl:text>
<xsl:call-template name="type.enum.list.compact">
<xsl:with-param name="indentation"
select="$indentation + string-length(@name) + 8"/>
</xsl:call-template>
<xsl:text> }</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>;</xsl:text>
</xsl:template>
<!-- Enumeration reference at namespace level -->
<xsl:template match="enum" mode="namespace-reference">
<xsl:if test="para or not ($boost.compact.enum=1)">
<xsl:call-template name="reference-documentation">
<xsl:with-param name="name">
<xsl:call-template name="type.display.name"/>
</xsl:with-param>
<xsl:with-param name="refname">
<xsl:call-template name="fully-qualified-name">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="purpose" select="purpose"/>
<xsl:with-param name="anchor">
<xsl:call-template name="generate.id">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="synopsis">
<xsl:call-template name="type.enum.display"/>
</xsl:with-param>
<xsl:with-param name="text">
<xsl:apply-templates select="para"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Enumeration reference -->
<xsl:template match="enum" mode="reference"/>
<!-- Output an enumeration along with its values -->
<xsl:template name="type.enum.display">
<!-- Spacing -->
<xsl:if test="position() &gt; 1">
<xsl:text>&#10;</xsl:text>
</xsl:if>
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="highlight-keyword">
<xsl:with-param name="keyword" select="'enum'"/>
</xsl:call-template>
<!-- Header -->
<xsl:variable name="header" select="concat(' ', @name, ' { ')"/>
<xsl:value-of select="$header"/>
<!-- Print the enumeration values -->
<xsl:call-template name="type.enum.list.compact">
<xsl:with-param name="indentation" select="4 + string-length($header)"/>
</xsl:call-template>
<xsl:text> };</xsl:text>
</xsl:template>
<!-- List enumeration values in a compact form e.g.,
enum Name { value1 = foo, value2 = bar, ... };
This routine prints only the enumeration values; the caller is
responsible for printing everything outside the braces
(inclusive). -->
<xsl:template name="type.enum.list.compact">
<xsl:param name="indentation"/>
<!-- Internal: The column we are on -->
<xsl:param name="column" select="$indentation"/>
<!-- Internal: The list of enumeration values -->
<xsl:param name="values" select="enumvalue"/>
<!-- Internal: a prefix that we need to print prior to printing
this value. -->
<xsl:param name="prefix" select="''"/>
<xsl:if test="$values">
<xsl:variable name="value" select="$values[position()=1]"/>
<xsl:variable name="rest" select="$values[position() &gt; 1]"/>
<!-- Compute the string to be printed for this value -->
<xsl:variable name="result">
<xsl:value-of select="$prefix"/>
<xsl:value-of select="$value/attribute::name"/>
<xsl:if test="$values/attribute">
<xsl:text> = </xsl:text>
<xsl:value-of select="string($values/attribute)"/>
</xsl:if>
</xsl:variable>
<!-- The column we will end on, assuming that this value fits on
this line -->
<xsl:variable name="end" select="$column + string-length($result)"/>
<xsl:choose>
<!-- If the enumeration value fits on this line, put it there -->
<xsl:when test="$end &lt; $max-columns">
<xsl:value-of select="$prefix"/>
<xsl:value-of select="$value/attribute::name"/>
<xsl:if test="$value/default">
<xsl:text> = </xsl:text>
<xsl:apply-templates
select="$value/default/*|$value/default/text()"/>
</xsl:if>
<xsl:call-template name="type.enum.list.compact">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="column" select="$end"/>
<xsl:with-param name="values" select="$rest"/>
<xsl:with-param name="prefix" select="', '"/>
</xsl:call-template>
</xsl:when>
<!-- This enumeration value doesn't fit on this line, so print
it on the next line -->
<xsl:otherwise>
<xsl:value-of select="$prefix"/>
<xsl:text>&#10;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:value-of select="$value/attribute::name"/>
<xsl:if test="$value/default">
<xsl:text> = </xsl:text>
<xsl:apply-templates
select="$value/default/*|$value/default/text()"/>
</xsl:if>
<xsl:variable name="end" select="$indentation
+ string-length($result)
- string-length($prefix)"/>
<xsl:call-template name="type.enum.list.compact">
<xsl:with-param name="indentation" select="$indentation"/>
<xsl:with-param name="column" select="$end"/>
<xsl:with-param name="values" select="$rest"/>
<xsl:with-param name="prefix" select="', '"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

18
xsl/utility.xsl Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- Indent the current line-->
<xsl:template name="indent">
<xsl:param name="indentation"/>
<xsl:if test="$indentation > 0">
<xsl:text>&nbsp;</xsl:text>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>