• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
4   Copyright (c) 2007 Frank Mori Hess <fmhess@users.sourceforge.net>
5
6   Distributed under the Boost Software License, Version 1.0.
7   (See accompanying file LICENSE_1_0.txt or copy at
8   http://www.boost.org/LICENSE_1_0.txt)
9  -->
10<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11                version="1.0">
12
13  <xsl:include href="global.xsl"/>
14  <xsl:strip-space elements="inherit purpose"/>
15
16  <!-- When true, the stylesheet will emit compact definitions of
17       enumerations when the enumeration does not have any detailed
18       description. A compact definition renders the enum definition along
19       with a comment for the purpose of the enum (if it exists) directly
20       within the synopsis. A non-compact definition will create a
21       separate refentry element for the enum. -->
22  <xsl:param name="boost.compact.enum">1</xsl:param>
23
24  <!-- When true, the stylesheet will emit compact definitions of
25       typedefs when the typedef does not have any detailed
26       description. -->
27  <xsl:param name="boost.compact.typedef">1</xsl:param>
28
29  <xsl:template match="class|struct|union" mode="generate.id">
30    <xsl:call-template name="fully-qualified-id">
31      <xsl:with-param name="node" select="."/>
32    </xsl:call-template>
33  </xsl:template>
34
35  <xsl:template match="class-specialization|struct-specialization|union-specialization" mode="generate.id">
36    <xsl:call-template name="fully-qualified-id">
37      <xsl:with-param name="node" select="."/>
38    </xsl:call-template>
39  </xsl:template>
40
41  <xsl:template match="typedef" mode="generate.id">
42    <xsl:call-template name="fully-qualified-id">
43      <xsl:with-param name="node" select="."/>
44    </xsl:call-template>
45  </xsl:template>
46
47  <xsl:template match="enum" mode="generate.id">
48    <xsl:call-template name="fully-qualified-id">
49      <xsl:with-param name="node" select="."/>
50    </xsl:call-template>
51  </xsl:template>
52
53  <xsl:template match="enumvalue" mode="generate.id">
54    <xsl:call-template name="fully-qualified-id">
55      <xsl:with-param name="node" select="parent::enum"/>
56    </xsl:call-template>
57    <xsl:text>.</xsl:text>
58    <xsl:value-of select="@name"/>
59  </xsl:template>
60
61  <!-- Display the full name of the current node, e.g., "Class
62       template function". -->
63  <xsl:template name="type.display.name">
64    <xsl:choose>
65      <xsl:when test="contains(local-name(.), 'class')">
66        <xsl:text>Class </xsl:text>
67      </xsl:when>
68      <xsl:when test="contains(local-name(.), 'struct')">
69        <xsl:text>Struct </xsl:text>
70      </xsl:when>
71      <xsl:when test="contains(local-name(.), 'union')">
72        <xsl:text>Union </xsl:text>
73      </xsl:when>
74      <xsl:when test="local-name(.)='enum'">
75        <xsl:text>Type </xsl:text>
76      </xsl:when>
77      <xsl:otherwise>
78        <xsl:message>
79Unknown type element "<xsl:value-of select="local-name(.)"/>" in type.display.name
80        </xsl:message>
81      </xsl:otherwise>
82    </xsl:choose>
83    <xsl:if test="template and count(template/*) &gt; 0">
84      <xsl:text>template </xsl:text>
85    </xsl:if>
86    <xsl:call-template name="monospaced">
87      <xsl:with-param name="text">
88        <xsl:value-of select="@name"/>
89        <xsl:apply-templates select="specialization"/>
90      </xsl:with-param>
91    </xsl:call-template>
92  </xsl:template>
93
94  <!-- Determine the class key for the given node -->
95  <xsl:template name="type.class.key">
96    <xsl:param name="node" select="."/>
97    <xsl:choose>
98      <xsl:when test="contains(local-name($node), '-specialization')">
99        <xsl:value-of select="substring-before(local-name($node), '-')"/>
100      </xsl:when>
101      <xsl:otherwise>
102        <xsl:value-of select="local-name($node)"/>
103      </xsl:otherwise>
104    </xsl:choose>
105  </xsl:template>
106
107  <!-- Emit class synopsis -->
108  <xsl:template match="class|class-specialization|
109                       struct|struct-specialization|
110                       union|union-specialization" mode="synopsis">
111    <xsl:param name="indentation"/>
112
113    <!-- The keyword used to declare this class type, e.g., class,
114         struct, or union. -->
115    <xsl:variable name="class-key">
116      <xsl:call-template name="type.class.key"/>
117    </xsl:variable>
118
119    <!-- Spacing -->
120    <xsl:if test="not (local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() &gt; 1)">
121      <xsl:text>&#10;</xsl:text>
122    </xsl:if>
123
124    <xsl:text>&#10;</xsl:text>
125
126    <!-- Calculate how long this declaration would be if we put it all
127         on one line -->
128    <xsl:variable name="full-decl-string">
129      <xsl:apply-templates select="template" mode="synopsis">
130        <xsl:with-param name="indentation" select="$indentation"/>
131        <xsl:with-param name="wrap" select="false()"/>
132      </xsl:apply-templates>
133      <xsl:value-of select="$class-key"/>
134      <xsl:text> </xsl:text>
135      <xsl:value-of select="@name"/>
136      <xsl:apply-templates select="specialization"/>
137      <xsl:call-template name="highlight-text">
138        <xsl:with-param name="text" select="';'"/>
139      </xsl:call-template>
140    </xsl:variable>
141
142    <xsl:choose>
143      <xsl:when test="(string-length($full-decl-string) +
144                       string-length($indentation)) &lt; $max-columns">
145        <xsl:call-template name="indent">
146          <xsl:with-param name="indentation" select="$indentation"/>
147        </xsl:call-template>
148        <xsl:apply-templates select="template" mode="synopsis">
149          <xsl:with-param name="indentation" select="$indentation"/>
150        </xsl:apply-templates>
151
152        <xsl:call-template name="highlight-keyword">
153          <xsl:with-param name="keyword" select="$class-key"/>
154        </xsl:call-template>
155        <xsl:text> </xsl:text>
156        <xsl:call-template name="internal-link">
157          <xsl:with-param name="to">
158            <xsl:call-template name="generate.id"/>
159          </xsl:with-param>
160          <xsl:with-param name="text">
161            <xsl:value-of select="@name"/>
162          </xsl:with-param>
163        </xsl:call-template>
164        <xsl:apply-templates select="specialization"/>
165        <xsl:call-template name="highlight-special">
166          <xsl:with-param name="text" select="';'"/>
167        </xsl:call-template>
168      </xsl:when>
169
170      <xsl:otherwise>
171        <!-- Template header -->
172        <xsl:if test="template">
173          <xsl:call-template name="indent">
174            <xsl:with-param name="indentation" select="$indentation"/>
175          </xsl:call-template>
176          <xsl:apply-templates select="template" mode="synopsis">
177            <xsl:with-param name="indentation" select="$indentation"/>
178          </xsl:apply-templates>
179          <xsl:text>&#10;</xsl:text>
180
181          <!-- Indent class templates' names in the synopsis -->
182          <xsl:text>  </xsl:text>
183        </xsl:if>
184
185        <!-- Class name -->
186        <xsl:call-template name="indent">
187          <xsl:with-param name="indentation" select="$indentation"/>
188        </xsl:call-template>
189        <xsl:call-template name="highlight-keyword">
190          <xsl:with-param name="keyword" select="$class-key"/>
191        </xsl:call-template>
192        <xsl:text> </xsl:text>
193        <xsl:call-template name="internal-link">
194          <xsl:with-param name="to">
195            <xsl:call-template name="generate.id">
196              <xsl:with-param name="node" select="."/>
197            </xsl:call-template>
198          </xsl:with-param>
199          <xsl:with-param name="text" select="string(@name)"/>
200        </xsl:call-template>
201        <xsl:apply-templates select="specialization"/>
202        <xsl:call-template name="highlight-special">
203          <xsl:with-param name="text" select="';'"/>
204        </xsl:call-template>
205      </xsl:otherwise>
206    </xsl:choose>
207
208    <!-- Free functions associated with the class -->
209    <xsl:apply-templates select="free-function-group" mode="header-synopsis">
210      <xsl:with-param name="indentation" select="$indentation"/>
211      <xsl:with-param name="class" select="@name"/>
212    </xsl:apply-templates>
213  </xsl:template>
214
215  <!-- Emit a typedef synopsis -->
216  <xsl:template name="type.typedef.display.aligned">
217    <xsl:param name="compact"/>
218    <xsl:param name="indentation"/>
219    <xsl:param name="is-reference"/>
220    <xsl:param name="max-type-length"/>
221    <xsl:param name="max-name-length"/>
222
223    <!-- What type of link the typedef name should have. This shall
224         be one of 'anchor' (the typedef output will be the target of
225         links), 'link' (the typedef output will link to a definition), or
226         'none' (the typedef output will not be either a link or a link
227         target) -->
228    <xsl:param name="link-type">
229      <xsl:choose>
230        <xsl:when test="$is-reference">
231          <xsl:text>anchor</xsl:text>
232        </xsl:when>
233        <xsl:otherwise>
234          <xsl:text>link</xsl:text>
235        </xsl:otherwise>
236      </xsl:choose>
237    </xsl:param>
238
239    <!-- The id we should link to or anchor as -->
240    <xsl:param name="link-to">
241      <xsl:call-template name="generate.id"/>
242    </xsl:param>
243
244    <!-- The id we should link to or anchor as -->
245    <xsl:param name="typedef-name">
246      <xsl:value-of select="@name"/>
247    </xsl:param>
248
249    <!-- Padding for the typedef types -->
250    <xsl:variable name="type-padding">
251      <xsl:call-template name="indent">
252        <xsl:with-param name="indentation" select="$max-type-length"/>
253      </xsl:call-template>
254    </xsl:variable>
255
256    <!-- Padding for the typedef names -->
257    <xsl:variable name="name-padding">
258      <xsl:call-template name="indent">
259        <xsl:with-param name="indentation" select="$max-name-length"/>
260      </xsl:call-template>
261    </xsl:variable>
262
263    <xsl:text>&#10;</xsl:text>
264    <xsl:choose>
265      <!-- Create a vertical ellipsis -->
266      <xsl:when test="@name = '...'">
267        <xsl:call-template name="indent">
268          <xsl:with-param name="indentation" select="$indentation + 3"/>
269        </xsl:call-template>
270        <xsl:text>.&#10;</xsl:text>
271        <xsl:call-template name="indent">
272          <xsl:with-param name="indentation" select="$indentation + 3"/>
273        </xsl:call-template>
274        <xsl:text>.&#10;</xsl:text>
275        <xsl:call-template name="indent">
276          <xsl:with-param name="indentation" select="$indentation + 3"/>
277        </xsl:call-template>
278        <xsl:text>.</xsl:text>
279      </xsl:when>
280      <xsl:otherwise>
281        <xsl:call-template name="indent">
282          <xsl:with-param name="indentation" select="$indentation"/>
283        </xsl:call-template>
284        <xsl:call-template name="highlight-keyword">
285          <xsl:with-param name="keyword" select="'typedef'"/>
286        </xsl:call-template>
287        <xsl:text> </xsl:text>
288
289        <!-- Length of the type -->
290        <xsl:variable name="type-length">
291          <xsl:choose>
292            <xsl:when test="@type">
293              <xsl:message>
294                <xsl:text>Warning: `type' attribute of `typedef' element is deprecated. Use 'type' element instead.</xsl:text>
295              </xsl:message>
296              <xsl:call-template name="print.warning.context"/>
297              <xsl:value-of select="string-length(@type)"/>
298            </xsl:when>
299            <xsl:otherwise>
300              <xsl:value-of select="string-length(type)"/>
301            </xsl:otherwise>
302          </xsl:choose>
303        </xsl:variable>
304
305        <!-- Emit the type -->
306        <xsl:choose>
307          <xsl:when test="@type">
308            <xsl:value-of select="@type"/>
309          </xsl:when>
310          <xsl:otherwise>
311            <xsl:apply-templates select="type/*|type/text()"
312              mode="highlight"/>
313            <!--
314            <xsl:call-template name="source-highlight">
315              <xsl:with-param name="text">
316                <xsl:apply-templates select="type/*|type/text()"/>
317              </xsl:with-param>
318            </xsl:call-template>
319            -->
320          </xsl:otherwise>
321        </xsl:choose>
322
323        <xsl:choose>
324          <xsl:when test="$max-type-length &gt; 0">
325            <xsl:value-of select="substring($type-padding, 1,
326                                            $max-type-length - $type-length)"/>
327            <xsl:text> </xsl:text>
328            <xsl:variable name="truncated-typedef-name" select="substring(@name,
329              1, $max-name-length)"/>
330            <xsl:call-template name="link-or-anchor">
331              <xsl:with-param name="to" select="$link-to"/>
332              <xsl:with-param name="text" select="$truncated-typedef-name"/>
333              <xsl:with-param name="link-type" select="$link-type"/>
334              <xsl:with-param name="highlight" select="true()"/>
335            </xsl:call-template>
336            <xsl:call-template name="highlight-text">
337              <xsl:with-param name="text" select="substring(concat(';', $name-padding),
338                1, $max-name-length - string-length($truncated-typedef-name))"/>
339            </xsl:call-template>
340          </xsl:when>
341          <xsl:otherwise>
342            <xsl:text> </xsl:text>
343            <xsl:call-template name="link-or-anchor">
344              <xsl:with-param name="to" select="$link-to"/>
345              <xsl:with-param name="text" select="$typedef-name"/>
346              <xsl:with-param name="link-type" select="$link-type"/>
347              <xsl:with-param name="highlight" select="true()"/>
348            </xsl:call-template>
349            <xsl:call-template name="highlight-special">
350              <xsl:with-param name="text" select="';'"/>
351            </xsl:call-template>
352          </xsl:otherwise>
353        </xsl:choose>
354
355        <xsl:if test="$compact and purpose">
356          <xsl:text>  </xsl:text>
357          <xsl:call-template name="highlight-comment">
358            <xsl:with-param name="text">
359              <xsl:text>// </xsl:text>
360              <xsl:apply-templates select="purpose" mode="comment"/>
361            </xsl:with-param>
362          </xsl:call-template>
363        </xsl:if>
364      </xsl:otherwise>
365    </xsl:choose>
366  </xsl:template>
367
368  <xsl:template match="typedef" mode="synopsis">
369    <xsl:param name="indentation"/>
370    <xsl:param name="max-type-length" select="0"/>
371    <xsl:param name="max-name-length" select="0"/>
372    <xsl:param name="allow-anchor" select="true()"/>
373
374    <!-- True if we should compact this typedef -->
375    <xsl:variable name="compact"
376      select="not (para|description) and ($boost.compact.typedef='1')"/>
377
378    <xsl:choose>
379      <xsl:when test="$compact">
380        <!-- Spacing -->
381        <xsl:if test="not (local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() &gt; 1)">
382          <xsl:text>&#10;</xsl:text>
383        </xsl:if>
384
385        <xsl:call-template name="type.typedef.display.aligned">
386          <xsl:with-param name="compact" select="$compact"/>
387          <xsl:with-param name="indentation" select="$indentation"/>
388          <xsl:with-param name="is-reference" select="$allow-anchor"/>
389          <xsl:with-param name="max-type-length" select="$max-type-length"/>
390          <xsl:with-param name="max-name-length" select="$max-name-length"/>
391        </xsl:call-template>
392      </xsl:when>
393      <xsl:otherwise>
394        <xsl:call-template name="type.typedef.display.aligned">
395          <xsl:with-param name="compact" select="$compact"/>
396          <xsl:with-param name="indentation" select="$indentation"/>
397          <xsl:with-param name="is-reference" select="false()"/>
398          <xsl:with-param name="max-type-length" select="$max-type-length"/>
399          <xsl:with-param name="max-name-length" select="$max-name-length"/>
400        </xsl:call-template>
401      </xsl:otherwise>
402    </xsl:choose>
403  </xsl:template>
404
405  <!-- Emit a typedef reference entry -->
406  <xsl:template match="typedef" mode="namespace-reference">
407    <!-- True if this typedef was compacted -->
408    <xsl:variable name="compact"
409      select="not (para|description) and ($boost.compact.typedef='1')"/>
410
411    <xsl:if test="not ($compact)">
412      <xsl:call-template name="reference-documentation">
413        <xsl:with-param name="refname" select="@name"/>
414        <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
415        <xsl:with-param name="anchor">
416          <xsl:call-template name="generate.id"/>
417        </xsl:with-param>
418        <xsl:with-param name="name">
419          <xsl:text>Type definition </xsl:text>
420          <xsl:call-template name="monospaced">
421            <xsl:with-param name="text" select="@name"/>
422          </xsl:call-template>
423        </xsl:with-param>
424        <xsl:with-param name="synopsis">
425          <xsl:call-template name="header-link"/>
426          <xsl:call-template name="type.typedef.display.aligned">
427            <xsl:with-param name="compact" select="false()"/>
428            <xsl:with-param name="indentation" select="0"/>
429            <xsl:with-param name="is-reference" select="true()"/>
430            <xsl:with-param name="link-type" select="'none'"/>
431          </xsl:call-template>
432        </xsl:with-param>
433        <xsl:with-param name="text">
434          <xsl:apply-templates select="description"/>
435        </xsl:with-param>
436      </xsl:call-template>
437    </xsl:if>
438  </xsl:template>
439
440  <xsl:template match="typedef" mode="reference">
441    <!-- True if this typedef was compacted -->
442    <xsl:variable name="compact"
443      select="not (para|description) and ($boost.compact.typedef='1')"/>
444
445    <xsl:if test="not ($compact)">
446      <listitem>
447        <para>
448          <xsl:call-template name="type.typedef.display.aligned">
449            <xsl:with-param name="compact" select="false()"/>
450            <xsl:with-param name="indentation" select="0"/>
451            <xsl:with-param name="is-reference" select="true()"/>
452            <xsl:with-param name="link-type" select="'anchor'"/>
453          </xsl:call-template>
454        </para>
455        <xsl:apply-templates select="description"/>
456      </listitem>
457    </xsl:if>
458  </xsl:template>
459
460  <!-- Emit a list of static constants -->
461  <xsl:template match="static-constant" mode="synopsis">
462    <xsl:param name="indentation"/>
463    <xsl:text>&#10;</xsl:text>
464
465    <xsl:call-template name="indent">
466      <xsl:with-param name="indentation" select="$indentation"/>
467    </xsl:call-template>
468    <xsl:call-template name="source-highlight">
469      <xsl:with-param name="text" select="'static const '"/>
470    </xsl:call-template>
471
472    <xsl:apply-templates select="type" mode="highlight"/>
473
474    <xsl:if test="not(@name = '')">
475      <xsl:text> </xsl:text>
476      <xsl:call-template name="source-highlight">
477        <xsl:with-param name="text" select="@name"/>
478      </xsl:call-template>
479    </xsl:if>
480
481    <xsl:text> = </xsl:text>
482
483    <xsl:call-template name="source-highlight">
484      <xsl:with-param name="text">
485        <xsl:apply-templates select="default/*|default/text()"/>
486      </xsl:with-param>
487    </xsl:call-template>
488    <xsl:call-template name="highlight-special">
489      <xsl:with-param name="text" select="';'"/>
490    </xsl:call-template>
491
492    <xsl:if test="purpose">
493      <xsl:text>  </xsl:text>
494      <xsl:call-template name="highlight-comment">
495        <xsl:with-param name="text">
496          <xsl:text>// </xsl:text>
497          <xsl:apply-templates select="purpose" mode="comment"/>
498        </xsl:with-param>
499      </xsl:call-template>
500    </xsl:if>
501  </xsl:template>
502
503  <!-- Format base classes on a single line -->
504  <xsl:template name="print.base.classes.single">
505    <xsl:apply-templates select="inherit"/>
506  </xsl:template>
507
508  <xsl:template name="print.base.classes.multi">
509    <xsl:param name="indentation"/>
510
511    <xsl:variable name="n" select="count(inherit)"/>
512    <xsl:for-each select="inherit">
513      <!-- Indentation -->
514      <xsl:if test="position() &gt; 1">
515        <xsl:call-template name="indent">
516          <xsl:with-param name="indentation" select="$indentation"/>
517        </xsl:call-template>
518      </xsl:if>
519
520      <!-- Output the access specifier -->
521      <xsl:variable name="access">
522        <xsl:choose>
523          <xsl:when test="@access">
524            <xsl:value-of select="@access"/>
525          </xsl:when>
526          <xsl:when test="parent::class|parent::class-specialization">
527            <xsl:text>private</xsl:text>
528          </xsl:when>
529          <xsl:otherwise>
530            <xsl:text>public</xsl:text>
531          </xsl:otherwise>
532        </xsl:choose>
533      </xsl:variable>
534      <xsl:call-template name="highlight-keyword">
535        <xsl:with-param name="keyword" select="@access"/>
536      </xsl:call-template>
537      <xsl:text> </xsl:text>
538
539      <!-- Output the type -->
540      <xsl:choose>
541        <xsl:when test="type">
542          <xsl:apply-templates select="type/*|type/text()" mode="annotation">
543            <xsl:with-param name="highlight" select="true()"/>
544          </xsl:apply-templates>
545        </xsl:when>
546        <xsl:otherwise>
547          <xsl:message>
548            <xsl:text>Warning: missing 'type' element inside 'inherit'</xsl:text>
549          </xsl:message>
550          <xsl:call-template name="print.warning.context"/>
551          <xsl:apply-templates mode="annotation"/>
552        </xsl:otherwise>
553      </xsl:choose>
554
555      <xsl:if test="@pack=1"><xsl:text>...</xsl:text></xsl:if>
556
557      <!-- Output a comma if not at the end -->
558      <xsl:if test="position() &lt; $n">
559        <xsl:text>,</xsl:text>
560      </xsl:if>
561
562      <!-- Output a comment if we have one -->
563      <xsl:if test="purpose">
564        <xsl:choose>
565          <xsl:when test="position() &lt; $n">
566            <xsl:text>  </xsl:text>
567          </xsl:when>
568          <xsl:otherwise>
569            <xsl:text>   </xsl:text>
570          </xsl:otherwise>
571        </xsl:choose>
572        <xsl:call-template name="highlight-comment">
573          <xsl:with-param name="text">
574            <xsl:text>// </xsl:text>
575            <xsl:apply-templates select="purpose"
576              mode="comment"/>
577          </xsl:with-param>
578        </xsl:call-template>
579      </xsl:if>
580
581      <xsl:if test="position() &lt; $n">
582        <xsl:text>&#10;</xsl:text>
583      </xsl:if>
584    </xsl:for-each>
585  </xsl:template>
586
587  <xsl:template name="print.base.classes">
588    <xsl:param name="indentation" select="0"/>
589    <xsl:param name="base-indentation" select="0"/>
590
591    <xsl:variable name="single-line-candidate" select="not(inherit/purpose)"/>
592    <xsl:variable name="single-line">
593      <xsl:if test="$single-line-candidate">
594        <xsl:call-template name="print.base.classes.single"/>
595      </xsl:if>
596    </xsl:variable>
597
598    <xsl:choose>
599      <xsl:when test="$single-line-candidate and
600                      (string-length($single-line) + $indentation + 3
601                        &lt; $max-columns)">
602        <xsl:call-template name="highlight-text">
603          <xsl:with-param name="text" select="' : '"/>
604        </xsl:call-template>
605        <xsl:call-template name="print.base.classes.single"/>
606        <xsl:call-template name="highlight-text">
607          <xsl:with-param name="text" select="' {'"/>
608        </xsl:call-template>
609      </xsl:when>
610      <xsl:when test="$single-line-candidate and
611                      (string-length($single-line) + $base-indentation + 2
612                        &lt; $max-columns)">
613        <xsl:call-template name="highlight-text">
614          <xsl:with-param name="text" select="' :&#10;'"/>
615        </xsl:call-template>
616        <xsl:call-template name="indent">
617          <xsl:with-param name="indentation" select="$base-indentation + 2"/>
618        </xsl:call-template>
619        <xsl:call-template name="print.base.classes.single"/>
620        <xsl:text>&#10;</xsl:text>
621        <xsl:call-template name="indent">
622          <xsl:with-param name="indentation" select="$base-indentation"/>
623        </xsl:call-template>
624        <xsl:call-template name="highlight-special">
625          <xsl:with-param name="text" select="'{'"/>
626        </xsl:call-template>
627      </xsl:when>
628      <xsl:otherwise>
629        <xsl:call-template name="highlight-text">
630          <xsl:with-param name="text" select="' : '"/>
631        </xsl:call-template>
632        <xsl:call-template name="print.base.classes.multi">
633          <xsl:with-param name="indentation" select="$indentation + 3"/>
634        </xsl:call-template>
635        <xsl:text>&#10;</xsl:text>
636        <xsl:call-template name="indent">
637          <xsl:with-param name="indentation" select="$base-indentation"/>
638        </xsl:call-template>
639        <xsl:call-template name="highlight-text">
640          <xsl:with-param name="text" select="'{'"/>
641        </xsl:call-template>
642      </xsl:otherwise>
643    </xsl:choose>
644  </xsl:template>
645
646  <!-- Emit a list of base classes without comments and on a single line -->
647  <xsl:template match="inherit">
648    <xsl:choose>
649      <xsl:when test="position()=1">
650      </xsl:when>
651      <xsl:otherwise>
652        <xsl:text>, </xsl:text>
653      </xsl:otherwise>
654    </xsl:choose>
655    <xsl:call-template name="highlight-keyword">
656      <xsl:with-param name="keyword" select="@access"/>
657    </xsl:call-template>
658    <xsl:text> </xsl:text>
659    <xsl:apply-templates mode="annotation">
660      <xsl:with-param name="highlight" select="true()"/>
661    </xsl:apply-templates>
662    <xsl:if test="@pack=1"><xsl:text>...</xsl:text></xsl:if>
663  </xsl:template>
664
665  <!-- Find the maximum length of the types in typedefs -->
666  <xsl:template name="find-max-type-length">
667    <xsl:param name="typedefs" select="typedef"/>
668    <xsl:param name="max-length" select="0"/>
669    <xsl:param name="want-name" select="false()"/>
670
671    <xsl:choose>
672      <xsl:when test="$typedefs">
673        <xsl:variable name="typedef" select="$typedefs[position()=1]"/>
674        <xsl:variable name="rest" select="$typedefs[position()!=1]"/>
675
676        <!-- Find the length of the type -->
677        <xsl:variable name="length">
678          <xsl:choose>
679            <xsl:when test="$typedef/@name != '...'">
680              <xsl:choose>
681                <xsl:when test="$want-name">
682                  <xsl:value-of select="string-length($typedef/@name) + 1"/>
683                </xsl:when>
684                <xsl:when test="$typedef/@type">
685                  <xsl:value-of select="string-length($typedef/@type)"/>
686                </xsl:when>
687                <xsl:otherwise>
688                  <xsl:value-of select="string-length($typedef/type)"/>
689                </xsl:otherwise>
690              </xsl:choose>
691            </xsl:when>
692            <xsl:otherwise>
693              0
694            </xsl:otherwise>
695          </xsl:choose>
696        </xsl:variable>
697
698        <!-- Pass on the larger length -->
699        <xsl:choose>
700          <xsl:when test="$length &gt; $max-length">
701            <xsl:call-template name="find-max-type-length">
702              <xsl:with-param name="typedefs" select="$rest"/>
703              <xsl:with-param name="max-length" select="$length"/>
704              <xsl:with-param name="want-name" select="$want-name"/>
705            </xsl:call-template>
706          </xsl:when>
707          <xsl:otherwise>
708            <xsl:call-template name="find-max-type-length">
709              <xsl:with-param name="typedefs" select="$rest"/>
710              <xsl:with-param name="max-length" select="$max-length"/>
711              <xsl:with-param name="want-name" select="$want-name"/>
712            </xsl:call-template>
713          </xsl:otherwise>
714        </xsl:choose>
715      </xsl:when>
716      <xsl:otherwise>
717        <xsl:value-of select="$max-length"/>
718      </xsl:otherwise>
719    </xsl:choose>
720  </xsl:template>
721
722  <xsl:template match="constructor" mode="synopsis">
723    <xsl:param name="indentation"/>
724    <xsl:call-template name="function">
725      <xsl:with-param name="indentation" select="$indentation"/>
726      <xsl:with-param name="context" select="../@name"/>
727      <xsl:with-param name="is-reference" select="false()"/>
728      <xsl:with-param name="constructor-for">
729        <xsl:call-template name="object-name"/>
730      </xsl:with-param>
731    </xsl:call-template>
732  </xsl:template>
733
734  <xsl:template match="copy-assignment" mode="synopsis">
735    <xsl:param name="indentation"/>
736    <xsl:call-template name="function">
737      <xsl:with-param name="indentation" select="$indentation"/>
738      <xsl:with-param name="context" select="../@name"/>
739      <xsl:with-param name="is-reference" select="false()"/>
740      <xsl:with-param name="copy-assign-for">
741        <xsl:call-template name="object-name"/>
742      </xsl:with-param>
743    </xsl:call-template>
744  </xsl:template>
745
746  <xsl:template match="destructor" mode="synopsis">
747    <xsl:param name="indentation"/>
748    <xsl:call-template name="function">
749      <xsl:with-param name="indentation" select="$indentation"/>
750      <xsl:with-param name="context" select="../@name"/>
751      <xsl:with-param name="is-reference" select="false()"/>
752      <xsl:with-param name="destructor-for">
753        <xsl:call-template name="object-name"/>
754      </xsl:with-param>
755    </xsl:call-template>
756  </xsl:template>
757
758  <xsl:template name="class-members-synopsis">
759    <xsl:param name="indentation" select="0"/>
760    <!-- Used to suppress anchors in nested synopsis, so we don't get multiple anchors -->
761    <xsl:param name="allow-synopsis-anchors" select="false()"/>
762
763    <!-- Typedefs -->
764    <xsl:if test="typedef">
765      <xsl:text>&#10;</xsl:text>
766      <xsl:call-template name="indent">
767        <xsl:with-param name="indentation" select="$indentation + 2"/>
768      </xsl:call-template>
769      <xsl:call-template name="highlight-comment">
770        <xsl:with-param name="text">
771          <xsl:text>// </xsl:text>
772          <!-- True if there are any non-compacted typedefs -->
773          <xsl:variable name="have-typedef-references"
774            select="typedef and ((typedef/para|typedef/description) or ($boost.compact.typedef='0'))"/>
775          <xsl:choose>
776            <xsl:when test="$have-typedef-references">
777              <xsl:call-template name="internal-link">
778                <xsl:with-param name="to">
779                  <xsl:call-template name="generate.id"/>
780                  <xsl:text>types</xsl:text>
781                </xsl:with-param>
782                <xsl:with-param name="text" select="'types'"/>
783              </xsl:call-template>
784            </xsl:when>
785            <xsl:otherwise>
786              <xsl:text>types</xsl:text>
787            </xsl:otherwise>
788          </xsl:choose>
789        </xsl:with-param>
790      </xsl:call-template>
791
792      <xsl:variable name="max-type-length">
793        <xsl:call-template name="find-max-type-length"/>
794      </xsl:variable>
795      <xsl:variable name="max-name-length">
796        <xsl:call-template name="find-max-type-length">
797          <xsl:with-param name="want-name" select="true()"/>
798        </xsl:call-template>
799      </xsl:variable>
800      <xsl:apply-templates select="typedef" mode="synopsis">
801        <xsl:with-param name="indentation" select="$indentation + 2"/>
802        <xsl:with-param name="max-type-length"
803          select="$max-type-length"/>
804        <xsl:with-param name="max-name-length"
805          select="$max-name-length"/>
806        <xsl:with-param name="allow-anchor" select="$allow-synopsis-anchors"/>
807      </xsl:apply-templates>
808    </xsl:if>
809
810    <!-- Static constants -->
811    <xsl:if test="static-constant">
812      <xsl:text>&#10;</xsl:text>
813      <xsl:if test="typedef">
814        <xsl:text>&#10;</xsl:text>
815      </xsl:if>
816      <xsl:call-template name="indent">
817        <xsl:with-param name="indentation" select="$indentation + 2"/>
818      </xsl:call-template>
819      <xsl:call-template name="highlight-comment">
820        <xsl:with-param name="text" select="'// static constants'"/>
821      </xsl:call-template>
822      <xsl:apply-templates select="static-constant" mode="synopsis">
823        <xsl:with-param name="indentation" select="$indentation + 2"/>
824      </xsl:apply-templates>
825    </xsl:if>
826
827    <!-- Nested classes/structs/unions -->
828    <xsl:if test="class|class-specialization|struct|struct-specialization|union|union-specialization">
829      <xsl:text>&#10;</xsl:text>
830      <xsl:if test="typedef|static-constant">
831        <xsl:text>&#10;</xsl:text>
832      </xsl:if>
833      <xsl:call-template name="indent">
834        <xsl:with-param name="indentation" select="$indentation + 2"/>
835      </xsl:call-template>
836      <xsl:call-template name="highlight-comment">
837        <xsl:with-param name="text" select="'// member classes/structs/unions'"/>
838      </xsl:call-template>
839      <xsl:apply-templates select="class|class-specialization|
840                                 struct|struct-specialization|
841                                 union|union-specialization"
842        mode="reference">
843        <xsl:with-param name="indentation" select="$indentation + 2"/>
844      </xsl:apply-templates>
845    </xsl:if>
846
847    <!-- Enums -->
848    <xsl:apply-templates select="enum" mode="synopsis">
849      <xsl:with-param name="indentation" select="$indentation + 2"/>
850    </xsl:apply-templates>
851
852    <!-- Construct/Copy/Destruct -->
853    <xsl:call-template name="construct-copy-destruct-synopsis">
854      <xsl:with-param name="indentation" select="$indentation + 2"/>
855    </xsl:call-template>
856
857    <!-- Member functions -->
858    <xsl:apply-templates
859      select="method-group|method|overloaded-method"
860      mode="synopsis">
861      <xsl:with-param name="indentation" select="$indentation + 2"/>
862    </xsl:apply-templates>
863
864    <!-- Data members -->
865    <xsl:if test="data-member">
866      <xsl:text>&#10;&#10;</xsl:text>
867      <xsl:call-template name="indent">
868        <xsl:with-param name="indentation" select="$indentation + 2"/>
869      </xsl:call-template>
870      <xsl:call-template name="highlight-comment">
871        <xsl:with-param name="text">
872          <xsl:text>// </xsl:text>
873          <xsl:choose>
874            <xsl:when test="data-member/description">
875              <xsl:call-template name="internal-link">
876                <xsl:with-param name="to">
877                  <xsl:call-template name="generate.id"/>
878                  <xsl:text>public-data-members</xsl:text>
879                </xsl:with-param>
880                <xsl:with-param name="text" select="'public data members'"/>
881              </xsl:call-template>
882            </xsl:when>
883            <xsl:otherwise>
884              <xsl:text>public data members</xsl:text>
885            </xsl:otherwise>
886          </xsl:choose>
887        </xsl:with-param>
888      </xsl:call-template>
889      <xsl:apply-templates select="data-member" mode="synopsis">
890        <xsl:with-param name="indentation" select="$indentation + 2"/>
891      </xsl:apply-templates>
892    </xsl:if>
893  </xsl:template>
894
895  <xsl:template name="print-access-specification">
896    <xsl:param name="indentation" select="0"/>
897    <xsl:param name="specification" select="'public'"/>
898
899    <xsl:text>&#10;</xsl:text>
900    <xsl:call-template name="indent">
901      <xsl:with-param name="indentation" select="$indentation"/>
902    </xsl:call-template>
903    <xsl:call-template name="highlight-keyword">
904      <xsl:with-param name="keyword" select="$specification"/>
905    </xsl:call-template>
906    <xsl:call-template name="highlight-special">
907      <xsl:with-param name="text" select="':'"/>
908    </xsl:call-template>
909  </xsl:template>
910
911  <xsl:template match="access" mode="synopsis">
912    <xsl:param name="indentation" select="0"/>
913    <xsl:param name="allow-synopsis-anchors" select="false()"/>
914
915    <xsl:call-template name="print-access-specification">
916      <xsl:with-param name="indentation" select="$indentation"/>
917      <xsl:with-param name="specification" select="@name"/>
918    </xsl:call-template>
919    <xsl:call-template name="class-members-synopsis">
920      <xsl:with-param name="indentation" select="$indentation"/>
921      <xsl:with-param name="allow-synopsis-anchors" select="$allow-synopsis-anchors"/>
922    </xsl:call-template>
923  </xsl:template>
924
925  <xsl:template name="class-type-synopsis">
926    <xsl:param name="indentation" select="0"/>
927    <xsl:param name="allow-synopsis-anchors" select="false()"/>
928
929    <!-- The keyword used to declare this class type, e.g., class,
930         struct, or union. -->
931    <xsl:variable name="class-key">
932      <xsl:call-template name="type.class.key"/>
933    </xsl:variable>
934
935    <xsl:if test="ancestor::class|ancestor::class-specialization|
936                  ancestor::struct|ancestor::struct-specialization|
937                  ancestor::union|ancestor::union-specialization">
938      <xsl:text>&#10;</xsl:text>
939
940      <!-- If this nested class has a "purpose" element, use it as a
941           comment. -->
942      <xsl:if test="purpose">
943        <xsl:text>&#10;</xsl:text>
944        <xsl:variable name="spaces">
945          <xsl:call-template name="indent">
946            <xsl:with-param name="indentation" select="$indentation"/>
947          </xsl:call-template>
948        </xsl:variable>
949        <xsl:copy-of select="$spaces"/>
950        <xsl:call-template name="highlight-comment">
951          <xsl:with-param name="text">
952            <xsl:text>// </xsl:text>
953            <xsl:apply-templates select="purpose" mode="comment">
954              <xsl:with-param name="wrap" select="true()"/>
955              <xsl:with-param name="prefix" select="concat($spaces, '// ')"/>
956            </xsl:apply-templates>
957          </xsl:with-param>
958        </xsl:call-template>
959        <xsl:text>&#10;</xsl:text>
960      </xsl:if>
961    </xsl:if>
962
963    <!-- Template header -->
964    <xsl:if test="template">
965      <xsl:call-template name="indent">
966        <xsl:with-param name="indentation" select="$indentation"/>
967      </xsl:call-template>
968      <xsl:apply-templates select="template" mode="reference">
969        <xsl:with-param name="indentation" select="$indentation"/>
970      </xsl:apply-templates>
971    </xsl:if>
972    <xsl:text>&#10;</xsl:text>
973
974    <!-- Class name -->
975    <xsl:call-template name="indent">
976      <xsl:with-param name="indentation" select="$indentation"/>
977    </xsl:call-template>
978    <xsl:call-template name="highlight-keyword">
979      <xsl:with-param name="keyword" select="$class-key"/>
980    </xsl:call-template>
981    <xsl:text> </xsl:text>
982
983    <!--  Make the class name a link to the class reference page (useful for nested classes) -->
984    <xsl:call-template name="internal-link">
985      <xsl:with-param name="to">
986        <xsl:call-template name="generate.id">
987          <xsl:with-param name="node" select="."/>
988        </xsl:call-template>
989      </xsl:with-param>
990      <xsl:with-param name="text">
991        <xsl:value-of select="@name"/>
992      </xsl:with-param>
993    </xsl:call-template>
994
995    <xsl:apply-templates select="specialization"/>
996
997    <xsl:choose>
998      <xsl:when test="inherit">
999        <!-- Base class list (with opening brace) -->
1000        <xsl:call-template name="print.base.classes">
1001          <xsl:with-param name="indentation"
1002            select="string-length($class-key) + string-length(@name)
1003                    + $indentation + 1"/>
1004          <xsl:with-param name="base-indentation" select="$indentation"/>
1005        </xsl:call-template>
1006      </xsl:when>
1007      <xsl:otherwise>
1008        <!-- Opening brace -->
1009        <xsl:call-template name="highlight-text">
1010          <xsl:with-param name="text" select="' {'"/>
1011        </xsl:call-template>
1012      </xsl:otherwise>
1013    </xsl:choose>
1014
1015    <!-- Default public designator for members not inside explicit <access> elements -->
1016    <xsl:if test="contains(local-name(.), 'class')">
1017      <xsl:if test="count(static-constant|typedef|enum|
1018        copy-assignment|constructor|destructor|method-group|
1019        method|overloaded-method|data-member|
1020        class|class-specialization|
1021        struct|struct-specialization|
1022        union|union-specialization) &gt; 0">
1023        <xsl:call-template name="print-access-specification">
1024          <xsl:with-param name="indentation" select="$indentation"/>
1025        </xsl:call-template>
1026      </xsl:if>
1027    </xsl:if>
1028
1029    <xsl:call-template name="class-members-synopsis">
1030      <xsl:with-param name="indentation" select="$indentation"/>
1031      <xsl:with-param name="allow-synopsis-anchors" select="$allow-synopsis-anchors"/>
1032    </xsl:call-template>
1033
1034    <xsl:apply-templates select="access" mode="synopsis">
1035      <xsl:with-param name="indentation" select="$indentation"/>
1036      <xsl:with-param name="allow-synopsis-anchors" select="$allow-synopsis-anchors"/>
1037    </xsl:apply-templates>
1038
1039    <!-- Closing brace -->
1040    <xsl:text>&#10;</xsl:text>
1041    <xsl:call-template name="indent">
1042      <xsl:with-param name="indentation" select="$indentation"/>
1043    </xsl:call-template>
1044    <xsl:call-template name="highlight-text">
1045      <xsl:with-param name="text" select="'};'"/>
1046    </xsl:call-template>
1047  </xsl:template>
1048
1049  <!-- Emit nested class reference documentation -->
1050  <xsl:template match="class|class-specialization|
1051                       struct|struct-specialization|
1052                       union|union-specialization" mode="reference">
1053    <xsl:param name="indentation"/>
1054
1055    <xsl:call-template name="class-type-synopsis">
1056      <xsl:with-param name="indentation" select="$indentation"/>
1057    </xsl:call-template>
1058  </xsl:template>
1059
1060  <!-- Document template parameters -->
1061  <xsl:template name="class-templates-reference">
1062    <xsl:if test="(template/template-type-parameter/purpose|
1063                  template/template-nontype-parameter/purpose)
1064                  and not($template.param.brief)">
1065      <refsect2>
1066        <title>Template Parameters</title>
1067        <orderedlist>
1068          <xsl:for-each select="template/template-type-parameter|
1069                template/template-nontype-parameter">
1070            <listitem>
1071              <para>
1072                <xsl:variable name="link-to">
1073                  <xsl:call-template name="generate.id"/>
1074                </xsl:variable>
1075
1076                <xsl:call-template name="preformatted">
1077                  <xsl:with-param name="text">
1078                    <xsl:call-template name="template.parameter">
1079                      <xsl:with-param name="parameter" select="."/>
1080                      <xsl:with-param name="highlight" select="true()"/>
1081                    </xsl:call-template>
1082                  </xsl:with-param>
1083                </xsl:call-template>
1084              </para>
1085              <xsl:if test="purpose">
1086                <para>
1087                  <xsl:apply-templates select="purpose/*"/>
1088                </para>
1089              </xsl:if>
1090            </listitem>
1091          </xsl:for-each>
1092        </orderedlist>
1093      </refsect2>
1094    </xsl:if>
1095  </xsl:template>
1096
1097  <xsl:template name="member-typedefs-reference">
1098    <!-- True if there are any non-compacted typedefs -->
1099    <xsl:variable name="have-typedef-references"
1100      select="typedef and ((typedef/para|typedef/description) or ($boost.compact.typedef='0'))"/>
1101    <xsl:if test="$have-typedef-references">
1102      <xsl:call-template name="member-documentation">
1103        <xsl:with-param name="name">
1104          <xsl:call-template name="anchor">
1105            <xsl:with-param name="to">
1106              <xsl:call-template name="generate.id"/>
1107              <xsl:text>types</xsl:text>
1108            </xsl:with-param>
1109            <xsl:with-param name="text" select="''"/>
1110          </xsl:call-template>
1111          <xsl:call-template name="monospaced">
1112            <xsl:with-param name="text">
1113              <xsl:call-template name="object-name"/>
1114            </xsl:with-param>
1115          </xsl:call-template>
1116          <xsl:text> </xsl:text>
1117          <xsl:call-template name="access-name"/>
1118          <xsl:text> types</xsl:text>
1119        </xsl:with-param>
1120        <xsl:with-param name="text">
1121          <orderedlist>
1122            <xsl:apply-templates select="typedef" mode="reference"/>
1123          </orderedlist>
1124        </xsl:with-param>
1125      </xsl:call-template>
1126    </xsl:if>
1127 </xsl:template>
1128
1129  <xsl:template name="data-member-reference">
1130    <xsl:if test="data-member/description">
1131      <xsl:call-template name="member-documentation">
1132        <xsl:with-param name="name">
1133          <xsl:call-template name="anchor">
1134            <xsl:with-param name="to">
1135              <xsl:call-template name="generate.id"/>
1136              <xsl:text>public-data-members</xsl:text>
1137            </xsl:with-param>
1138            <xsl:with-param name="text" select="''"/>
1139          </xsl:call-template>
1140          <xsl:call-template name="monospaced">
1141            <xsl:with-param name="text">
1142              <xsl:call-template name="object-name"/>
1143            </xsl:with-param>
1144          </xsl:call-template>
1145          <xsl:text> </xsl:text>
1146          <xsl:call-template name="access-name"/>
1147          <xsl:text> public data members</xsl:text>
1148        </xsl:with-param>
1149        <xsl:with-param name="text">
1150          <orderedlist>
1151            <xsl:apply-templates select="data-member" mode="reference"/>
1152          </orderedlist>
1153        </xsl:with-param>
1154      </xsl:call-template>
1155    </xsl:if>
1156  </xsl:template>
1157
1158  <xsl:template name="class-members-reference">
1159
1160    <xsl:call-template name="member-typedefs-reference"/>
1161
1162    <xsl:call-template name="construct-copy-destruct-reference"/>
1163
1164    <xsl:apply-templates
1165      select="method-group|method|overloaded-method"
1166      mode="reference"/>
1167
1168    <xsl:call-template name="data-member-reference"/>
1169
1170    <!-- Emit reference docs for nested classes -->
1171    <xsl:apply-templates
1172      select="class|class-specialization|
1173              struct|struct-specialization|
1174              union|union-specialization"
1175      mode="namespace-reference"/>
1176
1177    <!-- Emit reference docs for nested enums -->
1178    <xsl:apply-templates
1179      select="enum"
1180      mode="namespace-reference"/>
1181  </xsl:template>
1182
1183  <xsl:template match="access" mode="namespace-reference">
1184    <xsl:call-template name="class-members-reference"/>
1185  </xsl:template>
1186
1187  <!-- Emit namespace-level class reference documentation -->
1188  <xsl:template match="class|class-specialization|
1189                       struct|struct-specialization|
1190                       union|union-specialization" mode="namespace-reference">
1191    <xsl:param name="indentation" select="0"/>
1192
1193    <xsl:call-template name="separator"/>
1194    <xsl:call-template name="reference-documentation">
1195      <xsl:with-param name="refname">
1196        <xsl:call-template name="fully-qualified-name">
1197          <xsl:with-param name="node" select="."/>
1198        </xsl:call-template>
1199      </xsl:with-param>
1200      <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
1201      <xsl:with-param name="anchor">
1202        <xsl:call-template name="generate.id">
1203          <xsl:with-param name="node" select="."/>
1204        </xsl:call-template>
1205      </xsl:with-param>
1206      <xsl:with-param name="name">
1207        <xsl:call-template name="type.display.name"/>
1208      </xsl:with-param>
1209      <xsl:with-param name="synopsis">
1210        <xsl:call-template name="header-link"/>
1211        <xsl:call-template name="class-type-synopsis">
1212          <xsl:with-param name="indentation" select="$indentation"/>
1213          <xsl:with-param name="allow-synopsis-anchors" select="true()"/>
1214        </xsl:call-template>
1215        <!-- Associated free functions -->
1216        <xsl:apply-templates select="free-function-group"
1217          mode="synopsis">
1218          <xsl:with-param name="indentation" select="$indentation"/>
1219          <xsl:with-param name="class" select="@name"/>
1220        </xsl:apply-templates>
1221      </xsl:with-param>
1222      <xsl:with-param name="text">
1223        <!-- Paragraphs go into the top of the "Description" section. -->
1224        <xsl:if test="para">
1225          <xsl:message>
1226            <xsl:text>Warning: Use of 'para' elements in 'class' element is deprecated.&#10;Wrap them in a 'description' element.</xsl:text>
1227          </xsl:message>
1228          <xsl:call-template name="print.warning.context"/>
1229          <xsl:apply-templates select="para" mode="annotation"/>
1230        </xsl:if>
1231        <xsl:apply-templates select="description"/>
1232        <xsl:call-template name="class-templates-reference"/>
1233        <xsl:call-template name="class-members-reference"/>
1234        <xsl:apply-templates select="access" mode="namespace-reference"/>
1235
1236        <xsl:apply-templates select="free-function-group" mode="reference">
1237          <xsl:with-param name="class" select="@name"/>
1238        </xsl:apply-templates>
1239
1240        <!-- Specializations of this class -->
1241        <!-- TBD: fix this. We should key off the class name and match
1242             fully-qualified names -->
1243        <xsl:variable name="name" select="@name"/>
1244        <xsl:if test="local-name(.)='class' and
1245                      ../class-specialization[@name=$name]">
1246          <refsect2>
1247            <title>Specializations</title>
1248            <itemizedlist>
1249              <xsl:apply-templates
1250                select="../class-specialization[@name=$name]"
1251                mode="specialization-list"/>
1252            </itemizedlist>
1253          </refsect2>
1254        </xsl:if>
1255      </xsl:with-param>
1256    </xsl:call-template>
1257  </xsl:template>
1258
1259  <!-- Output a link to a specialization -->
1260  <xsl:template match="class-specialization|
1261                       struct-specialization|
1262                       union-specialization" mode="specialization-list">
1263    <listitem>
1264      <para>
1265        <xsl:call-template name="internal-link">
1266          <xsl:with-param name="to">
1267            <xsl:call-template name="generate.id">
1268              <xsl:with-param name="node" select="."/>
1269            </xsl:call-template>
1270          </xsl:with-param>
1271          <xsl:with-param name="text">
1272            <xsl:call-template name="type.display.name"/>
1273          </xsl:with-param>
1274        </xsl:call-template>
1275      </para>
1276    </listitem>
1277  </xsl:template>
1278
1279  <!-- Data member synopsis -->
1280  <xsl:template match="data-member" mode="synopsis">
1281    <xsl:param name="indentation"/>
1282
1283    <xsl:choose>
1284      <xsl:when test="ancestor::class|ancestor::class-specialization|
1285                      ancestor::struct|ancestor::struct-specialization|
1286                      ancestor::union|ancestor::union-specialization">
1287
1288        <!-- Spacing -->
1289        <xsl:if
1290          test="not(local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() &gt; 1)">
1291          <xsl:text>&#10;</xsl:text>
1292        </xsl:if>
1293
1294        <!-- Indent -->
1295        <xsl:text>&#10;</xsl:text>
1296        <xsl:call-template name="indent">
1297          <xsl:with-param name="indentation" select="$indentation"/>
1298        </xsl:call-template>
1299
1300        <xsl:if test="@specifiers">
1301          <xsl:call-template name="highlight-keyword">
1302            <xsl:with-param name="keyword" select="@specifiers"/>
1303          </xsl:call-template>
1304          <xsl:text> </xsl:text>
1305        </xsl:if>
1306
1307        <xsl:apply-templates select="type" mode="highlight"/>
1308        <xsl:text> </xsl:text>
1309        <xsl:choose>
1310          <xsl:when test="description">
1311            <xsl:variable name="link-to">
1312              <xsl:call-template name="generate.id"/>
1313            </xsl:variable>
1314            <xsl:call-template name="link-or-anchor">
1315              <xsl:with-param name="to" select="$link-to"/>
1316              <xsl:with-param name="text" select="@name"/>
1317              <xsl:with-param name="link-type" select="'link'"/>
1318              <xsl:with-param name="highlight" select="true()"/>
1319            </xsl:call-template>
1320          </xsl:when>
1321          <xsl:otherwise>
1322            <xsl:call-template name="highlight-identifier">
1323              <xsl:with-param name="identifier" select="@name"/>
1324            </xsl:call-template>
1325          </xsl:otherwise>
1326        </xsl:choose>
1327        <xsl:call-template name="highlight-text">
1328          <xsl:with-param name="text" select="';'"/>
1329        </xsl:call-template>
1330
1331      </xsl:when>
1332      <xsl:otherwise>
1333       <xsl:call-template name="global-synopsis">
1334         <xsl:with-param name="indentation" select="$indentation"/>
1335       </xsl:call-template>
1336      </xsl:otherwise>
1337    </xsl:choose>
1338
1339    <!-- If there is a <purpose>, then add it as an
1340         inline comment immediately following the data
1341         member definition in the synopsis -->
1342    <xsl:if test="purpose">
1343      <xsl:call-template name="indent">
1344        <xsl:with-param name="indentation" select="$indentation"/>
1345      </xsl:call-template>
1346      <xsl:call-template name="highlight-comment">
1347        <xsl:with-param name="text">
1348          <xsl:text>// </xsl:text>
1349          <xsl:apply-templates select="purpose/*|purpose/text()"
1350            mode="purpose"/>
1351        </xsl:with-param>
1352      </xsl:call-template>
1353    </xsl:if>
1354  </xsl:template>
1355
1356  <!-- Data member reference -->
1357  <xsl:template match="data-member" mode="reference">
1358    <xsl:choose>
1359      <xsl:when test="ancestor::class|ancestor::class-specialization|
1360                      ancestor::struct|ancestor::struct-specialization|
1361                      ancestor::union|ancestor::union-specialization">
1362        <xsl:if test="description">
1363          <listitem>
1364            <para>
1365              <xsl:variable name="link-to">
1366                <xsl:call-template name="generate.id"/>
1367              </xsl:variable>
1368
1369              <xsl:call-template name="preformatted">
1370                <xsl:with-param name="text">
1371                  <xsl:if test="@specifiers">
1372                    <xsl:call-template name="highlight-keyword">
1373                      <xsl:with-param name="keyword" select="@specifiers"/>
1374                    </xsl:call-template>
1375                    <xsl:text> </xsl:text>
1376                  </xsl:if>
1377
1378                  <xsl:apply-templates select="type" mode="highlight"/>
1379                  <xsl:text> </xsl:text>
1380                  <xsl:call-template name="link-or-anchor">
1381                    <xsl:with-param name="to" select="$link-to"/>
1382                    <xsl:with-param name="text" select="@name"/>
1383                    <xsl:with-param name="link-type" select="'anchor'"/>
1384                    <xsl:with-param name="highlight" select="true()"/>
1385                  </xsl:call-template>
1386                  <xsl:call-template name="highlight-special">
1387                    <xsl:with-param name="text" select="';'"/>
1388                  </xsl:call-template>
1389                </xsl:with-param>
1390              </xsl:call-template>
1391            </para>
1392            <xsl:apply-templates select="description"/>
1393          </listitem>
1394        </xsl:if>
1395      </xsl:when>
1396      <xsl:otherwise>
1397        <xsl:call-template name="global-reference"/>
1398      </xsl:otherwise>
1399    </xsl:choose>
1400  </xsl:template>
1401
1402  <!-- Enumeration synopsis -->
1403  <xsl:template match="enum" mode="synopsis">
1404    <xsl:param name="indentation"/>
1405
1406    <!-- Spacing -->
1407    <xsl:if
1408      test="(not (local-name(preceding-sibling::*[position()=1])=local-name(.))
1409             and (position() &gt; 1)) or
1410            not (para or description or not ($boost.compact.enum=1))">
1411      <xsl:text>&#10;</xsl:text>
1412    </xsl:if>
1413
1414    <!-- Indent -->
1415    <xsl:text>&#10;</xsl:text>
1416    <xsl:call-template name="indent">
1417      <xsl:with-param name="indentation" select="$indentation"/>
1418    </xsl:call-template>
1419
1420    <xsl:choose>
1421      <!-- When there is a detailed description, we only put the
1422           declaration in the synopsis and will put detailed documentation
1423           in either a <refentry/> or in class documentation. -->
1424      <xsl:when test="para or description or not ($boost.compact.enum=1)">
1425        <xsl:call-template name="highlight-keyword">
1426          <xsl:with-param name="keyword" select="'enum'"/>
1427        </xsl:call-template>
1428
1429        <xsl:text> </xsl:text>
1430
1431        <xsl:call-template name="internal-link">
1432          <xsl:with-param name="to">
1433            <xsl:call-template name="generate.id">
1434              <xsl:with-param name="node" select="."/>
1435            </xsl:call-template>
1436          </xsl:with-param>
1437          <xsl:with-param name="text" select="string(@name)"/>
1438          <xsl:with-param name="higlhight" select="false()"/>
1439        </xsl:call-template>
1440      </xsl:when>
1441      <!-- When there is no detailed description, we put the enum
1442           definition within the synopsis. The purpose of the enum (if
1443           available) is formatted as a comment prior to the
1444           definition. This way, we do not create a separate block of text
1445           for what is generally a very small amount of information. -->
1446      <xsl:otherwise>
1447        <xsl:if test="purpose">
1448          <xsl:call-template name="highlight-comment">
1449            <xsl:with-param name="text">
1450              <xsl:text>// </xsl:text>
1451              <xsl:apply-templates select="purpose" mode="comment"/>
1452            </xsl:with-param>
1453          </xsl:call-template>
1454
1455          <xsl:text>&#10;</xsl:text>
1456          <xsl:call-template name="indent">
1457            <xsl:with-param name="indentation" select="$indentation"/>
1458          </xsl:call-template>
1459        </xsl:if>
1460
1461        <xsl:call-template name="highlight-keyword">
1462          <xsl:with-param name="keyword" select="'enum'"/>
1463        </xsl:call-template>
1464
1465        <xsl:text> </xsl:text>
1466
1467        <xsl:call-template name="anchor">
1468          <xsl:with-param name="to">
1469            <xsl:call-template name="generate.id">
1470              <xsl:with-param name="node" select="."/>
1471            </xsl:call-template>
1472          </xsl:with-param>
1473          <xsl:with-param name="text" select="@name"/>
1474          <xsl:with-param name="higlhight" select="false()"/>
1475        </xsl:call-template>
1476
1477        <xsl:call-template name="highlight-text">
1478          <xsl:with-param name="text" select="' { '"/>
1479        </xsl:call-template>
1480        <xsl:call-template name="type.enum.list.compact">
1481          <xsl:with-param name="indentation"
1482            select="$indentation + string-length(@name) + 8"/>
1483          <xsl:with-param name="compact" select="true()"/>
1484        </xsl:call-template>
1485        <xsl:call-template name="highlight-text">
1486          <xsl:with-param name="text" select="' }'"/>
1487        </xsl:call-template>
1488      </xsl:otherwise>
1489    </xsl:choose>
1490    <xsl:call-template name="highlight-text">
1491      <xsl:with-param name="text" select="';'"/>
1492    </xsl:call-template>
1493  </xsl:template>
1494
1495  <!-- Enumeration reference at namespace level -->
1496  <xsl:template match="enum" mode="namespace-reference">
1497    <xsl:if test="para or description or not ($boost.compact.enum=1)">
1498      <xsl:call-template name="reference-documentation">
1499        <xsl:with-param name="name">
1500          <xsl:call-template name="type.display.name"/>
1501        </xsl:with-param>
1502        <xsl:with-param name="refname">
1503          <xsl:call-template name="fully-qualified-name">
1504            <xsl:with-param name="node" select="."/>
1505          </xsl:call-template>
1506        </xsl:with-param>
1507        <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
1508        <xsl:with-param name="anchor">
1509          <xsl:call-template name="generate.id">
1510            <xsl:with-param name="node" select="."/>
1511          </xsl:call-template>
1512        </xsl:with-param>
1513        <xsl:with-param name="synopsis">
1514          <xsl:call-template name="header-link"/>
1515          <xsl:call-template name="type.enum.display"/>
1516        </xsl:with-param>
1517
1518        <xsl:with-param name="text">
1519          <!-- Paragraphs go into the top of the "Description" section. -->
1520          <xsl:if test="para">
1521            <xsl:message>
1522              <xsl:text>Warning: Use of 'para' elements in 'enum' element is deprecated.&#10;Wrap them in a 'description' element.</xsl:text>
1523            </xsl:message>
1524            <xsl:call-template name="print.warning.context"/>
1525            <xsl:apply-templates select="para" mode="annotation"/>
1526          </xsl:if>
1527          <xsl:apply-templates select="description"/>
1528          <xsl:if test="enumvalue/purpose | enumvalue/description">
1529            <variablelist spacing="compact">
1530              <xsl:apply-templates select="enumvalue" mode="reference"/>
1531            </variablelist>
1532          </xsl:if>
1533        </xsl:with-param>
1534
1535      </xsl:call-template>
1536    </xsl:if>
1537  </xsl:template>
1538
1539  <!-- Output an enumeration along with its values -->
1540  <xsl:template name="type.enum.display">
1541    <!-- Spacing -->
1542    <xsl:if test="position() &gt; 1">
1543      <xsl:text>&#10;</xsl:text>
1544    </xsl:if>
1545
1546    <xsl:text>&#10;</xsl:text>
1547
1548    <xsl:call-template name="highlight-keyword">
1549      <xsl:with-param name="keyword" select="'enum'"/>
1550    </xsl:call-template>
1551
1552    <!-- Header -->
1553    <xsl:variable name="header" select="concat(' ', @name, ' { ')"/>
1554    <xsl:call-template name="highlight-text">
1555      <xsl:with-param name="text" select="$header"/>
1556    </xsl:call-template>
1557
1558    <!-- Print the enumeration values -->
1559    <xsl:call-template name="type.enum.list.compact">
1560      <xsl:with-param name="indentation" select="4 + string-length($header)"/>
1561    </xsl:call-template>
1562
1563    <xsl:call-template name="highlight-text">
1564      <xsl:with-param name="text" select="' };'"/>
1565    </xsl:call-template>
1566  </xsl:template>
1567
1568  <!-- List enumeration values in a compact form e.g.,
1569       enum Name { value1 = foo, value2 = bar, ... };
1570       This routine prints only the enumeration values; the caller is
1571       responsible for printing everything outside the braces
1572       (inclusive). -->
1573  <xsl:template name="type.enum.list.compact">
1574    <xsl:param name="indentation"/>
1575    <xsl:param name="compact" select="false()"/>
1576
1577    <!-- Internal: The column we are on -->
1578    <xsl:param name="column" select="$indentation"/>
1579
1580    <!-- Internal: The index of the current enumvalue
1581         we're processing -->
1582    <xsl:param name="pos" select="1"/>
1583
1584    <!-- Internal: a prefix that we need to print prior to printing
1585         this value. -->
1586    <xsl:param name="prefix" select="''"/>
1587
1588    <xsl:if test="not($pos &gt; count(enumvalue))">
1589      <xsl:variable name="value" select="enumvalue[position()=$pos]"/>
1590
1591      <!-- Compute the string to be printed for this value -->
1592      <xsl:variable name="result">
1593        <xsl:value-of select="$prefix"/>
1594        <xsl:value-of select="$value/attribute::name"/>
1595
1596        <xsl:if test="$value/default">
1597          <xsl:text> = </xsl:text>
1598          <xsl:value-of select="$value/default/*|$value/default/text()"/>
1599        </xsl:if>
1600      </xsl:variable>
1601
1602      <!-- The column we will end on, assuming that this value fits on
1603           this line -->
1604      <xsl:variable name="end" select="$column + string-length($result)"/>
1605
1606      <!-- The column we will actually end on -->
1607      <xsl:variable name="end2">
1608        <xsl:choose>
1609          <!-- If the enumeration value fits on this line, put it there -->
1610          <xsl:when test="$end &lt; $max-columns">
1611            <xsl:value-of select="$end"/>
1612          </xsl:when>
1613          <xsl:otherwise>
1614            <xsl:value-of select="$indentation
1615                                + string-length($result)
1616                                - string-length($prefix)"/>
1617          </xsl:otherwise>
1618        </xsl:choose>
1619      </xsl:variable>
1620
1621      <xsl:value-of select="$prefix"/>
1622
1623      <!-- If the enumeration value doesn't fit on this line,
1624           put it on a new line -->
1625      <xsl:if test="not($end &lt; $max-columns)">
1626        <xsl:text>&#10;</xsl:text>
1627        <xsl:call-template name="indent">
1628          <xsl:with-param name="indentation" select="$indentation"/>
1629        </xsl:call-template>
1630      </xsl:if>
1631
1632      <!-- If the enumeration value has a description, link it
1633           to its description. -->
1634      <xsl:choose>
1635        <xsl:when test="($value/purpose or $value/description) and not($compact)">
1636          <xsl:call-template name="internal-link">
1637            <xsl:with-param name="to">
1638              <xsl:call-template name="generate.id">
1639                <xsl:with-param name="node" select="$value"/>
1640              </xsl:call-template>
1641            </xsl:with-param>
1642            <xsl:with-param name="text" select="$value/attribute::name"/>
1643          </xsl:call-template>
1644        </xsl:when>
1645        <xsl:otherwise>
1646          <xsl:value-of select="$value/attribute::name"/>
1647        </xsl:otherwise>
1648      </xsl:choose>
1649
1650      <!-- If the enumeration value has a default,
1651           print it. -->
1652      <xsl:if test="$value/default">
1653        <xsl:text> = </xsl:text>
1654        <xsl:apply-templates
1655          select="$value/default/*|$value/default/text()"/>
1656      </xsl:if>
1657
1658      <!-- Recursively generate the rest of the enumeration list -->
1659      <xsl:call-template name="type.enum.list.compact">
1660        <xsl:with-param name="indentation" select="$indentation"/>
1661        <xsl:with-param name="compact" select="$compact"/>
1662        <xsl:with-param name="column" select="$end2"/>
1663        <xsl:with-param name="pos" select="$pos + 1"/>
1664        <xsl:with-param name="prefix" select="', '"/>
1665      </xsl:call-template>
1666    </xsl:if>
1667  </xsl:template>
1668
1669  <!-- Enumeration reference at namespace level -->
1670  <xsl:template match="enumvalue" mode="reference">
1671    <xsl:if test="purpose or description">
1672      <varlistentry>
1673        <term>
1674          <xsl:call-template name="monospaced">
1675            <xsl:with-param name="text" select="@name"/>
1676          </xsl:call-template>
1677          <!-- Note: the anchor must come after the text here, and not
1678               before it; otherwise, FOP goes into an infinite loop. -->
1679          <xsl:call-template name="anchor">
1680            <xsl:with-param name="to">
1681              <xsl:call-template name="generate.id"/>
1682            </xsl:with-param>
1683            <xsl:with-param name="text" select="''"/>
1684          </xsl:call-template>
1685        </term>
1686        <listitem>
1687          <xsl:apply-templates select="purpose|description" mode="comment"/>
1688        </listitem>
1689      </varlistentry>
1690    </xsl:if>
1691  </xsl:template>
1692
1693</xsl:stylesheet>
1694