• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="utf-8"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
4<!--
5  This is a modified work. Original copyright:
6
7  Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
8
9  Distributed under the Boost Software License, Version 1.0. (See accompanying
10  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11-->
12
13<!-- CONFIG_TEMPLATE -->
14
15<xsl:output method="text"/>
16<xsl:strip-space elements="*"/>
17<xsl:preserve-space elements="para"/>
18
19
20<xsl:variable name="newline">
21<xsl:text>
22</xsl:text>
23</xsl:variable>
24
25<!--
26  Loop over all top-level documentation elements (i.e. classes, functions,
27  variables and typedefs at namespace scope). The elements are sorted by name.
28  Anything in a "detail" namespace or with "_handler" in the name is skipped.
29-->
30<xsl:template match="/doxygen">
31  <xsl:text>[/
32    Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
33
34    Distributed under the Boost Software License, Version 1.0. (See accompanying
35    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
36]
37
38</xsl:text>
39  <xsl:for-each select="
40      compounddef[@kind = 'class' or @kind = 'struct'] |
41      compounddef[@kind = 'namespace']/sectiondef/memberdef">
42    <xsl:sort select="concat((. | ancestor::*)/compoundname, '::', name, ':x')"/>
43    <xsl:sort select="name"/>
44    <xsl:choose>
45      <xsl:when test="@kind='class' or @kind='struct'">
46        <xsl:if test="not(contains(compoundname, '::detail'))">
47          <xsl:call-template name="class"/>
48        </xsl:if>
49      </xsl:when>
50      <xsl:otherwise>
51        <xsl:if test="not(contains(ancestor::*/compoundname, '::detail'))">
52          <xsl:call-template name="namespace-memberdef"/>
53        </xsl:if>
54      </xsl:otherwise>
55    </xsl:choose>
56  </xsl:for-each>
57</xsl:template>
58
59<!--========== Utilities ==========-->
60
61<!-- 4 spaces used for indentation -->
62<xsl:variable name="tabspaces">
63<xsl:text>    </xsl:text>
64</xsl:variable>
65
66<!-- Indent the current line with count number of tabspaces -->
67<xsl:template name="indent">
68  <xsl:param name="count"/>
69  <xsl:if test="$count &gt; 0">
70    <xsl:value-of select="$tabspaces"/>
71    <xsl:call-template name="indent">
72      <xsl:with-param name="count" select="$count - 1"/>
73    </xsl:call-template>
74  </xsl:if>
75</xsl:template>
76
77<!-- Remove the top-most namespace from identifier -->
78<xsl:template name="strip-one-ns">
79  <xsl:param name="name"/>
80  <xsl:choose>
81    <xsl:when test="contains($name, '::')">
82      <xsl:value-of select="substring-after($name, '::')"/>
83    </xsl:when>
84    <xsl:otherwise>
85      <xsl:value-of select="$name"/>
86    </xsl:otherwise>
87  </xsl:choose>
88</xsl:template>
89
90<!-- Remove the doc-ns from an identifier, if present -->
91<xsl:template name="strip-doc-ns">
92  <xsl:param name="name"/>
93  <xsl:choose>
94    <xsl:when test="starts-with($name, concat($doc-ns, '::'))">
95      <xsl:value-of select="substring-after($name, concat($doc-ns, '::'))"/>
96    </xsl:when>
97    <xsl:otherwise>
98      <xsl:value-of select="$name"/>
99    </xsl:otherwise>
100  </xsl:choose>
101</xsl:template>
102
103<!-- Remove all namespace qualifiers from an identifier -->
104<xsl:template name="strip-ns">
105  <xsl:param name="name"/>
106  <xsl:choose>
107    <xsl:when test="contains($name, '::') and contains($name, '&lt;')">
108      <xsl:choose>
109        <xsl:when test="string-length(substring-before($name, '::')) &lt; string-length(substring-before($name, '&lt;'))">
110          <xsl:call-template name="strip-ns">
111            <xsl:with-param name="name" select="substring-after($name, '::')"/>
112          </xsl:call-template>
113        </xsl:when>
114        <xsl:otherwise>
115          <xsl:value-of select="$name"/>
116        </xsl:otherwise>
117      </xsl:choose>
118    </xsl:when>
119    <xsl:when test="contains($name, '::')">
120      <xsl:call-template name="strip-ns">
121        <xsl:with-param name="name" select="substring-after($name, '::')"/>
122      </xsl:call-template>
123    </xsl:when>
124    <xsl:otherwise>
125      <xsl:value-of select="$name"/>
126    </xsl:otherwise>
127  </xsl:choose>
128</xsl:template>
129
130<!-- Reformats '*', '&', and '...' in parameters, e.g. "void const*" -->
131<xsl:template name="cleanup-param">
132  <xsl:param name="name"/>
133  <xsl:variable name="clean">
134    <xsl:value-of select="$name"/>
135  </xsl:variable>
136  <xsl:choose>
137    <xsl:when test="' *' = substring($clean, string-length($clean) - 1)">
138      <xsl:value-of select="substring($clean, 1, string-length($clean) - 2)"/>
139      <xsl:text>*</xsl:text>
140    </xsl:when>
141    <xsl:when test="' &amp;' = substring($clean, string-length($clean) - 1)">
142      <xsl:value-of select="substring($clean, 1, string-length($clean) - 2)"/>
143      <xsl:text>&amp;</xsl:text>
144    </xsl:when>
145    <xsl:when test="' &amp;...' = substring($clean, string-length($clean) - 4)">
146      <xsl:value-of select="substring($clean, 1, string-length($clean) - 5)"/>
147      <xsl:text>&amp;...</xsl:text>
148    </xsl:when>
149    <xsl:when test="' &amp;&amp;' = substring($clean, string-length($clean) - 2)">
150      <xsl:value-of select="substring($clean, 1, string-length($clean) - 3)"/>
151      <xsl:text>&amp;&amp;</xsl:text>
152    </xsl:when>
153    <xsl:when test="' &amp;&amp;...' = substring($clean, string-length($clean) - 5)">
154      <xsl:value-of select="substring($clean, 1, string-length($clean) - 6)"/>
155      <xsl:text>&amp;&amp;...</xsl:text>
156    </xsl:when>
157    <xsl:otherwise>
158      <xsl:value-of select="$clean"/>
159    </xsl:otherwise>
160  </xsl:choose>
161</xsl:template>
162
163<xsl:template name="cleanup-type">
164  <xsl:param name="name"/>
165  <xsl:variable name="type">
166    <xsl:choose>
167      <xsl:when test="contains($name, 'BOOST_ASIO_DECL ')">
168        <xsl:value-of select="substring-after($name, 'BOOST_ASIO_DECL ')"/>
169      </xsl:when>
170      <xsl:when test="contains($name, 'BOOST_ASIO_DECL')">
171        <xsl:value-of select="substring-after($name, 'BOOST_ASIO_DECL')"/>
172      </xsl:when>
173      <xsl:when test="$name = 'virtual'"></xsl:when>
174      <xsl:otherwise>
175        <xsl:value-of select="$name"/>
176      </xsl:otherwise>
177    </xsl:choose>
178  </xsl:variable>
179  <xsl:variable name="cleaned">
180    <xsl:choose>
181      <xsl:when test="$type='__implementation_defined__'">
182        <xsl:text>``['implementation-defined]``</xsl:text>
183      </xsl:when>
184      <xsl:when test="$type='__see_below__'">
185        <xsl:text>``['see-below]``</xsl:text>
186      </xsl:when>
187      <xsl:when test="$type='__deduced__'">
188        <xsl:text>``__deduced__``</xsl:text>
189      </xsl:when>
190      <xsl:when test="$type='void_or_deduced'">
191        <xsl:text>``__deduced__``</xsl:text>
192      </xsl:when>
193      <xsl:otherwise>
194        <xsl:value-of select="$type"/>
195      </xsl:otherwise>
196    </xsl:choose>
197  </xsl:variable>
198  <xsl:call-template name="cleanup-param">
199    <xsl:with-param name="name" select="$cleaned"/>
200  </xsl:call-template>
201</xsl:template>
202
203<xsl:template name="make-id">
204  <xsl:param name="name"/>
205  <xsl:choose>
206    <!--
207    <xsl:when test="contains($name, 'boost::system::')">
208      <xsl:call-template name="make-id">
209        <xsl:with-param name="name"
210         select="substring-after($name, 'boost::system::')"/>
211      </xsl:call-template>
212    </xsl:when>
213    <xsl:when test="contains($name, 'boost::asio::error::')">
214      <xsl:call-template name="make-id">
215        <xsl:with-param name="name"
216         select="concat(substring-before($name, 'boost::asio::error::'), substring-after($name, 'boost::asio::error::'))"/>
217      </xsl:call-template>
218    </xsl:when>
219  -->
220    <xsl:when test="contains($name, '::')">
221      <xsl:call-template name="make-id">
222        <xsl:with-param name="name"
223         select="concat(substring-before($name, '::'), '__', substring-after($name, '::'))"/>
224      </xsl:call-template>
225    </xsl:when>
226    <xsl:when test="contains($name, '=')">
227      <xsl:call-template name="make-id">
228        <xsl:with-param name="name"
229         select="concat(substring-before($name, '='), '_eq_', substring-after($name, '='))"/>
230      </xsl:call-template>
231    </xsl:when>
232    <xsl:when test="contains($name, '!')">
233      <xsl:call-template name="make-id">
234        <xsl:with-param name="name"
235         select="concat(substring-before($name, '!'), '_not_', substring-after($name, '!'))"/>
236      </xsl:call-template>
237    </xsl:when>
238    <xsl:when test="contains($name, '-&gt;')">
239      <xsl:call-template name="make-id">
240        <xsl:with-param name="name"
241         select="concat(substring-before($name, '-&gt;'), '_arrow_', substring-after($name, '-&gt;'))"/>
242      </xsl:call-template>
243    </xsl:when>
244    <xsl:when test="contains($name, '&lt;')">
245      <xsl:call-template name="make-id">
246        <xsl:with-param name="name"
247         select="concat(substring-before($name, '&lt;'), '_lt_', substring-after($name, '&lt;'))"/>
248      </xsl:call-template>
249    </xsl:when>
250    <xsl:when test="contains($name, '&gt;')">
251      <xsl:call-template name="make-id">
252        <xsl:with-param name="name"
253         select="concat(substring-before($name, '&gt;'), '_gt_', substring-after($name, '&gt;'))"/>
254      </xsl:call-template>
255    </xsl:when>
256    <xsl:when test="starts-with($name, '~')">
257      <xsl:call-template name="make-id">
258        <xsl:with-param name="name"
259         select="concat(substring-after($name, '~'), '_dtor_')"/>
260      </xsl:call-template>
261    </xsl:when>
262    <xsl:when test="contains($name, '[')">
263      <xsl:call-template name="make-id">
264        <xsl:with-param name="name"
265         select="concat(substring-before($name, '['), '_lb_', substring-after($name, '['))"/>
266      </xsl:call-template>
267    </xsl:when>
268    <xsl:when test="contains($name, ']')">
269      <xsl:call-template name="make-id">
270        <xsl:with-param name="name"
271         select="concat(substring-before($name, ']'), '_rb_', substring-after($name, ']'))"/>
272      </xsl:call-template>
273    </xsl:when>
274    <xsl:when test="contains($name, '(')">
275      <xsl:call-template name="make-id">
276        <xsl:with-param name="name"
277         select="concat(substring-before($name, '('), '_lp_', substring-after($name, '('))"/>
278      </xsl:call-template>
279    </xsl:when>
280    <xsl:when test="contains($name, ')')">
281      <xsl:call-template name="make-id">
282        <xsl:with-param name="name"
283         select="concat(substring-before($name, ')'), '_rp_', substring-after($name, ')'))"/>
284      </xsl:call-template>
285    </xsl:when>
286    <xsl:when test="contains($name, '+')">
287      <xsl:call-template name="make-id">
288        <xsl:with-param name="name"
289         select="concat(substring-before($name, '+'), '_plus_', substring-after($name, '+'))"/>
290      </xsl:call-template>
291    </xsl:when>
292    <xsl:when test="contains($name, '-')">
293      <xsl:call-template name="make-id">
294        <xsl:with-param name="name"
295         select="concat(substring-before($name, '-'), '_minus_', substring-after($name, '-'))"/>
296      </xsl:call-template>
297    </xsl:when>
298    <xsl:when test="contains($name, '*')">
299      <xsl:call-template name="make-id">
300        <xsl:with-param name="name"
301         select="concat(substring-before($name, '*'), '_star_', substring-after($name, '*'))"/>
302      </xsl:call-template>
303    </xsl:when>
304    <xsl:when test="contains($name, '/')">
305      <xsl:call-template name="make-id">
306        <xsl:with-param name="name"
307         select="concat(substring-before($name, '/'), '_slash_', substring-after($name, '/'))"/>
308      </xsl:call-template>
309    </xsl:when>
310    <xsl:when test="contains($name, '~')">
311      <xsl:call-template name="make-id">
312        <xsl:with-param name="name"
313         select="concat(substring-before($name, '~'), '_', substring-after($name, '~'))"/>
314      </xsl:call-template>
315    </xsl:when>
316    <xsl:when test="contains($name, ' ')">
317      <xsl:call-template name="make-id">
318        <xsl:with-param name="name"
319         select="concat(substring-before($name, ' '), '_', substring-after($name, ' '))"/>
320      </xsl:call-template>
321    </xsl:when>
322    <xsl:otherwise>
323      <xsl:value-of select="$name"/>
324    </xsl:otherwise>
325  </xsl:choose>
326</xsl:template>
327
328<!--=========================================================================-->
329
330<!-- Markup -->
331
332<xsl:template match="para" mode="markup">
333<xsl:value-of select="$newline"/>
334<xsl:apply-templates mode="markup"/>
335<!--<xsl:value-of select="$newline"/>-->
336</xsl:template>
337
338<xsl:template match="para" mode="markup-nested">
339  <xsl:apply-templates mode="markup-nested"/>
340</xsl:template>
341
342<!-- @par Command -->
343<xsl:template match="title" mode="markup">
344  <xsl:variable name="title">
345    <xsl:value-of select="."/>
346  </xsl:variable>
347  <xsl:if test="string-length($title) &gt; 0">
348    <xsl:text>[heading </xsl:text>
349    <xsl:value-of select="."/>
350    <xsl:text>]</xsl:text>
351  </xsl:if>
352</xsl:template>
353
354<xsl:template match="ulink" mode="markup">
355  <xsl:text>[@</xsl:text>
356  <xsl:value-of select="@url"/>
357  <xsl:text> </xsl:text>
358  <xsl:value-of select="."/>
359  <xsl:text>]</xsl:text>
360</xsl:template>
361
362<!-- Program listings -->
363<xsl:template match="programlisting" mode="markup">
364  <xsl:text>&#xd;```&#xd;</xsl:text>
365  <xsl:apply-templates mode="codeline"/>
366  <xsl:text>```&#xd;</xsl:text>
367</xsl:template>
368
369<xsl:template match="programlisting" mode="markup-nested">
370  <xsl:text>[role red error.programlisting]</xsl:text>
371  <!--
372  <xsl:value-of select="$newline"/>
373  <xsl:text>``</xsl:text>
374  <xsl:value-of select="$newline"/>
375  <xsl:apply-templates mode="codeline"/>
376  <xsl:if test="substring(., string-length(.)) = $newline">
377    <xsl:value-of select="$newline"/>
378  </xsl:if>
379  <xsl:text>``</xsl:text>
380  <xsl:value-of select="$newline"/>
381-->
382</xsl:template>
383
384<xsl:template match="codeline" mode="codeline">
385  <xsl:if test="string-length(.) &gt; 0">
386    <xsl:text>  </xsl:text>
387  </xsl:if>
388  <xsl:apply-templates mode="codeline"/>
389  <xsl:value-of select="$newline"/>
390</xsl:template>
391
392<xsl:template match="sp" mode="markup">
393  <xsl:text> </xsl:text>
394</xsl:template>
395
396<xsl:template match="sp" mode="markup-nested">
397  <xsl:text> </xsl:text>
398</xsl:template>
399
400<xsl:template match="sp" mode="codeline">
401  <xsl:text> </xsl:text>
402</xsl:template>
403
404<xsl:template match="linebreak" mode="markup">
405  <xsl:text>&#xd;&#xd;</xsl:text>
406</xsl:template>
407
408<xsl:template match="linebreak" mode="markup-nested">
409  <xsl:text>&#xd;&#xd;</xsl:text>
410</xsl:template>
411
412<!-- Backtick-quoted string -->
413<xsl:template match="computeroutput" mode="markup">
414  <xsl:text>`</xsl:text>
415  <xsl:value-of select="."/>
416  <xsl:text>`</xsl:text>
417</xsl:template>
418<xsl:template match="computeroutput" mode="markup-nested">
419  <xsl:text>`</xsl:text>
420  <xsl:value-of select="."/>
421  <xsl:text>`</xsl:text>
422</xsl:template>
423
424<!-- Ensure the list starts on its own line -->
425<xsl:template match="orderedlist | itemizedlist" mode="markup">
426  <xsl:value-of select="$newline" />
427  <xsl:apply-templates mode="markup"/>
428  <xsl:value-of select="$newline" />
429</xsl:template>
430
431<!-- Properly format a list item to ensure proper nesting and styling -->
432<xsl:template match="listitem" mode="markup">
433  <!-- The first listitem in a group was put on a newline by the
434       rule above, so only indent the later siblings -->
435  <xsl:if test="position() &gt; 1">
436    <xsl:value-of select="$newline" />
437  </xsl:if>
438  <!-- Indent the listitem based on the list nesting level -->
439  <xsl:call-template name="indent">
440     <xsl:with-param name="count" select="count(ancestor::orderedlist | ancestor::itemizedlist )-1" />
441  </xsl:call-template>
442  <xsl:if test="parent::orderedlist">
443    <xsl:text># </xsl:text>
444  </xsl:if>
445  <xsl:if test="parent::itemizedlist">
446    <xsl:text>* </xsl:text>
447  </xsl:if>
448  <!-- Doxygen injects a <para></para> element around the listitem contents
449       so this rule extracts the contents and formats that directly to avoid
450       introducing extra newlines from formatting para -->
451  <xsl:apply-templates select="para/node()" mode="markup"/>
452</xsl:template>
453
454<xsl:template match="bold" mode="markup">[*<xsl:apply-templates mode="markup"/>]</xsl:template>
455
456<xsl:template match="emphasis" mode="markup">['<xsl:apply-templates mode="markup"/>]</xsl:template>
457
458<!-- Parameter, Exception, or Template parameter list -->
459<xsl:template match="parameterlist" mode="markup">
460  <xsl:choose>
461    <xsl:when test="@kind='exception'">
462      <xsl:text>[heading Exceptions]&#xd;</xsl:text>
463      <xsl:text>[table [[Type][Thrown On]]&#xd;</xsl:text>
464    </xsl:when>
465    <xsl:when test="@kind='param'">
466      <xsl:text>[heading Parameters]&#xd;</xsl:text>
467      <xsl:text>[table [[Name][Description]]&#xd;</xsl:text>
468    </xsl:when>
469    <xsl:when test="@kind='templateparam'">
470      <xsl:text>[heading Template Parameters]&#xd;</xsl:text>
471      <xsl:text>[table [[Type][Description]]&#xd;</xsl:text>
472    </xsl:when>
473    <xsl:otherwise>
474      <xsl:text>[table [[Name][Description]]&#xd;</xsl:text>
475    </xsl:otherwise>
476  </xsl:choose>
477  <xsl:apply-templates mode="markup"/>
478  <xsl:text>]&#xd;</xsl:text>
479</xsl:template>
480
481<!-- Parameter, Exception, or Template list items -->
482<xsl:template match="parameteritem" mode="markup">
483  <xsl:text>  [[`</xsl:text>
484  <xsl:value-of select="parameternamelist"/>
485  <xsl:text>`][&#xd;    </xsl:text>
486  <!-- No idea why this was using markup-nested instead of markup -->
487  <xsl:apply-templates select="parameterdescription" mode="markup"/>
488
489  <xsl:text>&#xd;  ]]&#xd;</xsl:text>
490</xsl:template>
491
492<!-- Table support -->
493<xsl:template match="table" mode="markup">
494   <xsl:text>&#xd;[table  &#xd;</xsl:text>
495   <xsl:apply-templates mode="markup"/>
496   <xsl:text>]&#xd;</xsl:text>
497</xsl:template>
498
499<xsl:template match="row" mode="markup">
500   <xsl:text>    [</xsl:text>
501   <xsl:apply-templates mode="markup"/>
502   <xsl:text>]&#xd;</xsl:text>
503</xsl:template>
504
505<xsl:template match="entry" mode="markup">
506   <xsl:text>[</xsl:text>
507   <xsl:apply-templates select="para/node()" mode="markup"/>
508   <xsl:text>]</xsl:text>
509</xsl:template>
510
511
512<xsl:template match="simplesect" mode="markup">
513  <xsl:choose>
514    <xsl:when test="@kind='return'">
515      <xsl:text>[heading Return Value]</xsl:text>
516      <xsl:apply-templates mode="markup"/>
517    </xsl:when>
518    <xsl:when test="@kind='see'">
519      <xsl:text>[heading See Also]&#xd;</xsl:text>
520      <xsl:apply-templates mode="markup"/>
521    </xsl:when>
522    <xsl:when test="@kind='note'">
523      <xsl:text>[heading Remarks]&#xd;</xsl:text>
524      <xsl:apply-templates mode="markup"/>
525    </xsl:when>
526    <xsl:when test="@kind='par'">
527      <xsl:if test="not(starts-with(title, 'Concepts:'))">
528        <xsl:apply-templates mode="markup"/>
529      </xsl:if>
530    </xsl:when>
531    <xsl:otherwise>
532      <xsl:apply-templates mode="markup"/>
533    </xsl:otherwise>
534  </xsl:choose>
535</xsl:template>
536
537
538
539<xsl:template match="text()" mode="markup">
540  <xsl:variable name="text" select="."/>
541  <xsl:variable name="starts-with-whitespace" select="
542      starts-with($text, ' ') or starts-with($text, $newline)"/>
543  <xsl:variable name="preceding-node-name">
544    <xsl:for-each select="preceding-sibling::*">
545      <xsl:if test="position() = last()">
546        <xsl:value-of select="local-name()"/>
547      </xsl:if>
548    </xsl:for-each>
549  </xsl:variable>
550  <xsl:variable name="after-newline" select="
551      $preceding-node-name = 'programlisting' or
552      $preceding-node-name = 'linebreak'"/>
553  <xsl:choose>
554    <xsl:when test="$starts-with-whitespace and $after-newline">
555      <xsl:call-template name="escape-text">
556        <xsl:with-param name="text">
557          <xsl:call-template name="strip-leading-whitespace">
558            <xsl:with-param name="text" select="$text"/>
559          </xsl:call-template>
560        </xsl:with-param>
561      </xsl:call-template>
562    </xsl:when>
563    <xsl:otherwise>
564      <xsl:call-template name="escape-text">
565        <xsl:with-param name="text" select="$text"/>
566      </xsl:call-template>
567    </xsl:otherwise>
568  </xsl:choose>
569</xsl:template>
570
571
572<xsl:template match="text()" mode="markup-nested">
573  <xsl:variable name="text" select="."/>
574  <xsl:variable name="starts-with-whitespace" select="
575      starts-with($text, ' ') or starts-with($text, $newline)"/>
576  <xsl:variable name="preceding-node-name">
577    <xsl:for-each select="preceding-sibling::*">
578      <xsl:if test="position() = last()">
579        <xsl:value-of select="local-name()"/>
580      </xsl:if>
581    </xsl:for-each>
582  </xsl:variable>
583  <xsl:variable name="after-newline" select="
584      $preceding-node-name = 'programlisting' or
585      $preceding-node-name = 'linebreak'"/>
586  <xsl:choose>
587    <xsl:when test="$starts-with-whitespace and $after-newline">
588      <xsl:call-template name="escape-text">
589        <xsl:with-param name="text">
590          <xsl:call-template name="strip-leading-whitespace">
591            <xsl:with-param name="text" select="$text"/>
592          </xsl:call-template>
593        </xsl:with-param>
594      </xsl:call-template>
595    </xsl:when>
596    <xsl:otherwise>
597      <xsl:call-template name="escape-text">
598        <xsl:with-param name="text" select="$text"/>
599      </xsl:call-template>
600    </xsl:otherwise>
601  </xsl:choose>
602</xsl:template>
603
604
605<xsl:template name="strip-leading-whitespace">
606  <xsl:param name="text"/>
607  <xsl:choose>
608    <xsl:when test="starts-with($text, ' ')">
609      <xsl:call-template name="strip-leading-whitespace">
610        <xsl:with-param name="text" select="substring($text, 2)"/>
611      </xsl:call-template>
612    </xsl:when>
613    <xsl:when test="starts-with($text, $newline)">
614      <xsl:call-template name="strip-leading-whitespace">
615        <xsl:with-param name="text" select="substring($text, 2)"/>
616      </xsl:call-template>
617    </xsl:when>
618    <xsl:otherwise>
619      <xsl:value-of select="$text"/>
620    </xsl:otherwise>
621  </xsl:choose>
622</xsl:template>
623
624
625<xsl:template name="escape-text">
626  <xsl:param name="text"/>
627  <xsl:choose>
628    <xsl:when test="contains($text, '_')">
629      <xsl:value-of select="substring-before($text, '_')"/>
630      <xsl:text>\_</xsl:text>
631      <xsl:call-template name="escape-text">
632        <xsl:with-param name="text" select="substring-after($text, '_')"/>
633      </xsl:call-template>
634    </xsl:when>
635    <xsl:otherwise>
636      <xsl:value-of select="$text"/>
637    </xsl:otherwise>
638  </xsl:choose>
639</xsl:template>
640
641
642<xsl:template name="escape-name">
643  <xsl:param name="text"/>
644  <xsl:choose>
645    <xsl:when test="contains($text, '[')">
646      <xsl:value-of select="substring-before($text, '[')"/>
647      <xsl:text>\[</xsl:text>
648      <xsl:call-template name="escape-name">
649        <xsl:with-param name="text" select="substring-after($text, '[')"/>
650      </xsl:call-template>
651    </xsl:when>
652    <xsl:when test="contains($text, ']')">
653      <xsl:value-of select="substring-before($text, ']')"/>
654      <xsl:text>\]</xsl:text>
655      <xsl:call-template name="escape-name">
656        <xsl:with-param name="text" select="substring-after($text, ']')"/>
657      </xsl:call-template>
658    </xsl:when>
659    <xsl:otherwise>
660      <xsl:value-of select="$text"/>
661    </xsl:otherwise>
662  </xsl:choose>
663</xsl:template>
664
665
666
667<xsl:template match="ref[@kindref='member']" mode="markup">
668  <xsl:variable name="name">
669    <xsl:value-of select="."/>
670  </xsl:variable>
671  <xsl:variable name="dox-ref-id" select="@refid"/>
672  <xsl:variable name="dox-enum-id">
673    <xsl:variable name="x" select="@refid"/>
674    <xsl:value-of select="/doxygen//compounddef/sectiondef/memberdef/enumvalue[@id=$x]/../@id"/>
675  </xsl:variable>
676  <xsl:choose>
677    <xsl:when test="string-length($dox-enum-id) &gt; 0">
678      <xsl:variable name="memberdefs" select="/doxygen//compounddef/sectiondef/memberdef/enumvalue[@id=$dox-ref-id]/.."/>
679      <xsl:variable name="ref-name" select="($memberdefs)/../../compoundname"/>
680      <xsl:variable name="dox-name" select="($memberdefs)/name"/>
681      <xsl:variable name="def-kind" select="($memberdefs)/../../compoundname/../@kind"/>
682      <xsl:variable name="ref-id">
683        <xsl:call-template name="make-id">
684          <xsl:with-param name="name" select="concat($ref-name, '::', $dox-name)"/>
685        </xsl:call-template>
686      </xsl:variable>
687      <xsl:variable name="display-name">
688        <xsl:call-template name="strip-doc-ns">
689          <xsl:with-param name="name">
690            <xsl:value-of select="$ref-name"/>
691            <xsl:text>::</xsl:text>
692            <xsl:call-template name="strip-ns">
693              <xsl:with-param name="name" select="$name"/>
694            </xsl:call-template>
695          </xsl:with-param>
696        </xsl:call-template>
697      </xsl:variable>
698      <xsl:if test="$debug &gt; 0">|1a|</xsl:if>
699      <xsl:text>[link </xsl:text>
700      <xsl:value-of select="concat($doc-ref, $ref-id)"/>
701      <xsl:text> `</xsl:text>
702      <xsl:value-of select="$display-name"/>
703      <xsl:text>`]</xsl:text>
704      <xsl:if test="$debug &gt; 1">
705        <xsl:text>&#xd;[heading Debug]&#xd;[table [[name][value]]</xsl:text>
706        <xsl:value-of select="concat('[[name][', $name, ']]&#xd;')"/>
707        <xsl:value-of select="concat('[[refid][', @refid, ']]&#xd;')"/>
708        <xsl:value-of select="concat('[[dox-enum-id][', $dox-enum-id, ']]&#xd;')"/>
709        <xsl:value-of select="concat('[[ref-name][', $ref-name, ']]&#xd;')"/>
710        <xsl:value-of select="concat('[[dox-name][', $dox-name, ']]&#xd;')"/>
711        <xsl:value-of select="concat('[[def-kind][', $def-kind, ']]&#xd;')"/>
712        <xsl:value-of select="concat('[[ref-id][', $ref-id, ']]]&#xd;')"/>
713      </xsl:if>
714    </xsl:when>
715    <xsl:otherwise>
716      <xsl:variable name="memberdefs" select="/doxygen//compounddef/sectiondef/memberdef[@id=$dox-ref-id]"/>
717      <xsl:variable name="def-kind" select="($memberdefs)/../../@kind"/>
718      <xsl:variable name="ref-name" select="($memberdefs)[1]/../../compoundname"/>
719      <xsl:variable name="dox-name" select="($memberdefs)[1]/name"/>
720      <xsl:variable name="ref-id">
721        <xsl:call-template name="make-id">
722          <xsl:with-param name="name" select="$ref-name"/>
723        </xsl:call-template>
724      </xsl:variable>
725      <xsl:variable name="display-name">
726        <xsl:call-template name="strip-doc-ns">
727          <xsl:with-param name="name">
728            <xsl:value-of select="$ref-name"/>
729            <xsl:text>::</xsl:text>
730            <xsl:call-template name="strip-ns">
731              <xsl:with-param name="name" select="$name"/>
732            </xsl:call-template>
733          </xsl:with-param>
734        </xsl:call-template>
735      </xsl:variable>
736      <xsl:choose>
737        <xsl:when test="$def-kind = 'namespace'">
738          <xsl:if test="$debug &gt; 0">|1b|</xsl:if>
739          <xsl:text>[link </xsl:text>
740          <xsl:value-of select="concat($doc-ref, $ref-id, '__', $dox-name)"/>
741          <xsl:text> `</xsl:text>
742          <xsl:value-of select="$display-name"/>
743          <xsl:text>`]</xsl:text>
744        </xsl:when>
745        <xsl:when test="$def-kind = 'class' or $def-kind = 'struct'">
746          <xsl:if test="$debug &gt; 0">|1c|</xsl:if>
747          <xsl:text>[link </xsl:text>
748          <xsl:value-of select="concat($doc-ref, $ref-id, '.', $dox-name)"/>
749          <xsl:text> `</xsl:text>
750          <xsl:value-of select="$display-name"/>
751          <xsl:text>`]</xsl:text>
752        </xsl:when>
753        <xsl:otherwise>
754          <xsl:text>[role red </xsl:text>
755          <xsl:if test="$debug &gt; 0">|1|</xsl:if>
756          <xsl:text></xsl:text>
757          <xsl:value-of select="$display-name"/>
758          <xsl:text>]</xsl:text>
759        </xsl:otherwise>
760      </xsl:choose>
761      <xsl:if test="$debug &gt; 1">
762        <xsl:text>&#xd;[heading Debug]&#xd;[table [[name][value]]</xsl:text>
763        <xsl:value-of select="concat('[[name][', $name, ']]&#xd;')"/>
764        <xsl:value-of select="concat('[[@refid][', @refid, ']]&#xd;')"/>
765        <xsl:value-of select="concat('[[dox-ref-id][', $dox-ref-id, ']]&#xd;')"/>
766        <xsl:value-of select="concat('[[def-kind][', $def-kind, ']]&#xd;')"/>
767        <xsl:value-of select="concat('[[dox-name][', $dox-name, ']]&#xd;')"/>
768        <xsl:value-of select="concat('[[ref-name][', $ref-name, ']]&#xd;')"/>
769        <xsl:value-of select="concat('[[ref-id][', $ref-id, ']]]&#xd;')"/>
770      </xsl:if>
771    </xsl:otherwise>
772  </xsl:choose>
773</xsl:template>
774
775
776
777<xsl:template match="ref[@kindref='compound']" mode="markup">
778  <xsl:variable name="name">
779    <xsl:value-of select="."/>
780  </xsl:variable>
781  <xsl:variable name="dox-ref-id" select="@refid"/>
782  <xsl:variable name="kind" select="(/doxygen//compounddef[@id=$dox-ref-id])[1]/@kind"/>
783  <xsl:variable name="ref-name" select="(/doxygen//compounddef[@id=$dox-ref-id])[1]/compoundname"/>
784  <xsl:variable name="ref-id">
785    <xsl:call-template name="make-id">
786      <xsl:with-param name="name" select="$ref-name"/>
787    </xsl:call-template>
788  </xsl:variable>
789  <xsl:variable name="display-name">
790    <xsl:call-template name="strip-doc-ns">
791      <xsl:with-param name="name" select="$ref-name"/>
792    </xsl:call-template>
793  </xsl:variable>
794  <xsl:choose>
795    <xsl:when test="$kind != 'namespace'">
796      <xsl:if test="$debug &gt; 0">|2|</xsl:if>
797      <xsl:text>[link </xsl:text>
798      <xsl:value-of select="concat($doc-ref, $ref-id)"/>
799      <xsl:text> `</xsl:text>
800      <xsl:value-of select="$display-name"/>
801      <xsl:text>`]</xsl:text>
802    </xsl:when>
803    <xsl:otherwise>
804      <xsl:text>[role red </xsl:text>
805      <xsl:if test="$debug &gt; 0">|2|</xsl:if>
806      <xsl:value-of select="$display-name"/>
807      <xsl:text>]</xsl:text>
808    </xsl:otherwise>
809  </xsl:choose>
810  <xsl:if test="$debug &gt; 1">
811    <xsl:text>[heading Debug]&#xd;[table [[name][value]]</xsl:text>
812    <xsl:value-of select="concat('[[dox-ref-id][', $dox-ref-id, ']]&#xd;')"/>
813    <xsl:value-of select="concat('[[kind][', $kind, ']]&#xd;')"/>
814    <xsl:value-of select="concat('[[ref-name][', $ref-name, ']]&#xd;')"/>
815    <xsl:value-of select="concat('[[ref-id][', $ref-id, ']]&#xd;')"/>
816    <xsl:value-of select="concat('[[display-name][', $display-name, ']]]&#xd;')"/>
817  </xsl:if>
818</xsl:template>
819
820
821
822<xsl:template match="ref[@kindref='compound']" mode="markup-nested">
823  <xsl:variable name="name">
824    <xsl:value-of select="."/>
825  </xsl:variable>
826  <xsl:text>[role red </xsl:text>
827  <xsl:if test="$debug &gt; 0">|6|</xsl:if>
828  <xsl:value-of select="."/>
829  <xsl:text>]</xsl:text>
830</xsl:template>
831
832<xsl:template match="ref[@kindref='member']" mode="markup-nested">
833  <xsl:variable name="name">
834    <xsl:value-of select="."/>
835  </xsl:variable>
836  <xsl:variable name="dox-ref-id" select="@refid"/>
837  <xsl:variable name="memberdefs" select="/doxygen//compounddef/sectiondef/memberdef[@id=$dox-ref-id]"/>
838  <xsl:variable name="def-kind" select="($memberdefs)/../../@kind"/>
839  <xsl:variable name="sec-kind" select="($memberdefs)/../@kind"/>
840  <xsl:choose>
841    <xsl:when test="contains(@refid, 'beast') and count($memberdefs) &gt; 0">
842      <xsl:variable name="dox-compound-name" select="($memberdefs)[1]/../../compoundname"/>
843      <xsl:variable name="dox-name" select="($memberdefs)[1]/name"/>
844      <xsl:variable name="ref-name">
845        <!--
846        <xsl:call-template name="strip-doc-ns">
847          <xsl:with-param name="name" select="$dox-compound-name"/>
848        </xsl:call-template>
849        Replace with the line below
850        -->
851        <xsl:value-of select="$dox-compound-name"/>
852      </xsl:variable>
853      <xsl:variable name="ref-id">
854        <xsl:call-template name="make-id">
855          <xsl:with-param name="name" select="$ref-name"/>
856        </xsl:call-template>
857      </xsl:variable>
858      <xsl:choose>
859        <xsl:when test="$def-kind = 'namespace'">
860          <xsl:text>[link </xsl:text><xsl:value-of select="$doc-ref"/>
861          <xsl:choose>
862            <xsl:when test="string-length($ref-id) &gt; 0">
863              <xsl:value-of select="concat($ref-id,'__',$dox-name)"/>
864            </xsl:when>
865            <xsl:otherwise>
866              <xsl:value-of select="$dox-name"/>
867            </xsl:otherwise>
868          </xsl:choose>
869          <xsl:text> `</xsl:text>
870          <xsl:value-of select="$dox-name"/>
871          <xsl:text>`]</xsl:text>
872        </xsl:when>
873        <xsl:when test="$def-kind = 'class' or $def-kind = 'struct'">
874          <xsl:text>[link </xsl:text><xsl:value-of select="$doc-ref"/>
875          <xsl:value-of select="concat($ref-id,'.',$dox-name)"/>
876          <xsl:text> `</xsl:text>
877          <xsl:value-of select="$name"/>
878          <xsl:text>`]</xsl:text>
879        </xsl:when>
880        <xsl:otherwise>
881          <xsl:text>[role red </xsl:text>
882          <xsl:if test="$debug &gt; 0">|8|</xsl:if>
883          <xsl:value-of select="$name"/>
884          <xsl:text>]</xsl:text>
885        </xsl:otherwise>
886      </xsl:choose>
887    </xsl:when>
888    <xsl:otherwise>
889      <xsl:text>[role red </xsl:text>
890      <xsl:if test="$debug &gt; 0">|9|</xsl:if>
891      <xsl:value-of select="$name"/>
892      <xsl:text>]</xsl:text>
893    </xsl:otherwise>
894  </xsl:choose>
895</xsl:template>
896
897
898
899<xsl:template name="includes">
900  <xsl:param name="file"/>
901  <xsl:text>&#xd;</xsl:text>
902<!-- INCLUDES_TEMPLATE -->
903  <xsl:text>&#xd;</xsl:text>
904</xsl:template>
905
906
907
908<xsl:template name="includes-foot">
909  <xsl:param name="file"/>
910  <xsl:text>&#xd;</xsl:text>
911<!-- INCLUDES_FOOT_TEMPLATE -->
912  <xsl:text>&#xd;</xsl:text>
913</xsl:template>
914
915
916
917<!--========== Class ==========-->
918
919<xsl:template name="class">
920  <xsl:variable name="class-name">
921    <xsl:call-template name="strip-doc-ns">
922      <xsl:with-param name="name" select="compoundname"/>
923    </xsl:call-template>
924  </xsl:variable>
925  <xsl:variable name="unqualified-class-name">
926    <xsl:call-template name="strip-ns">
927      <xsl:with-param name="name" select="compoundname"/>
928    </xsl:call-template>
929  </xsl:variable>
930  <xsl:variable name="class-id">
931    <xsl:call-template name="make-id">
932      <xsl:with-param name="name" select="compoundname"/>
933    </xsl:call-template>
934  </xsl:variable>
935  <xsl:variable name="class-file" select="location/@file"/>
936  <xsl:text>[section:</xsl:text>
937  <xsl:value-of select="$class-id"/>
938  <xsl:text> </xsl:text>
939  <xsl:value-of select="$class-name"/>
940  <xsl:text>]&#xd;</xsl:text>
941  <xsl:apply-templates select="briefdescription" mode="markup"/>
942  <xsl:text>&#xd;[heading Synopsis]&#xd;</xsl:text>
943  <xsl:call-template name="includes">
944    <xsl:with-param name="file" select="$class-file"/>
945  </xsl:call-template>
946  <xsl:text>&#xd;```&#xd;</xsl:text>
947  <xsl:apply-templates select="templateparamlist" mode="class-detail"/>
948  <xsl:value-of select="@kind"/>
949  <xsl:text> </xsl:text>
950  <xsl:value-of select="$unqualified-class-name"/>
951  <xsl:if test="count(basecompoundref[not(contains(.,'::detail'))]) &gt; 0">
952    <xsl:text> :</xsl:text>
953  </xsl:if>
954  <xsl:text>&#xd;</xsl:text>
955  <xsl:for-each select="basecompoundref[not(contains(.,'::detail'))]">
956    <xsl:text>    </xsl:text>
957    <xsl:value-of select="@prot"/><xsl:text> </xsl:text>
958    <xsl:call-template name="strip-doc-ns">
959      <xsl:with-param name="name" select="."/>
960    </xsl:call-template>
961    <xsl:if test="not(position() = last())">
962      <xsl:text>,</xsl:text>
963    </xsl:if>
964    <xsl:text>&#xd;</xsl:text>
965  </xsl:for-each>
966  <xsl:text>```&#xd;</xsl:text>
967  <xsl:call-template name="class-tables">
968    <xsl:with-param name="class-id" select="$class-id"/>
969    <xsl:with-param name="class-name" select="$class-name"/>
970  </xsl:call-template>
971  <xsl:text>&#xd;[heading Description]&#xd;</xsl:text>
972  <xsl:apply-templates select="detaileddescription" mode="markup"/>
973  <xsl:call-template name="class-members">
974    <xsl:with-param name="class-name" select="$class-name"/>
975    <xsl:with-param name="class-id" select="$class-id"/>
976    <xsl:with-param name="class-file" select="$class-file"/>
977  </xsl:call-template>
978  <xsl:call-template name="includes-foot">
979    <xsl:with-param name="file" select="$class-file"/>
980  </xsl:call-template>
981<xsl:text>[endsect]&#xd;&#xd;&#xd;&#xd;</xsl:text>
982</xsl:template>
983
984<xsl:template name="class-tables">
985  <xsl:param name="class-name"/>
986  <xsl:param name="class-id"/>
987  <xsl:if test="
988      count(
989        sectiondef[@kind='public-type'] |
990        innerclass[@prot='public' and not(contains(., '_handler'))]) &gt; 0">
991    <xsl:text>[heading Types]&#xd;</xsl:text>
992    <xsl:text>[table [[Name][Description]]&#xd;</xsl:text>
993    <xsl:for-each select="
994        sectiondef[@kind='public-type']/memberdef |
995        innerclass[@prot='public' and not(contains(., '_handler'))]" >
996      <xsl:sort select="concat(name,  (.)[not(name)])"/>
997      <xsl:text>  [&#xd;</xsl:text>
998      <xsl:choose>
999        <xsl:when test="count(name) &gt; 0">
1000          <xsl:text>    [[link </xsl:text>
1001          <xsl:value-of select="$doc-ref"/>
1002          <xsl:value-of select="$class-id"/>
1003          <xsl:text>.</xsl:text>
1004          <xsl:value-of select="name"/>
1005          <xsl:text> [*</xsl:text>
1006          <xsl:value-of select="name"/>
1007          <xsl:text>]]]&#xd;    [&#xd;      </xsl:text>
1008          <xsl:call-template name="escape-name">
1009            <xsl:with-param name="text" select="briefdescription"/>
1010          </xsl:call-template>
1011          <xsl:text>&#xd;    ]&#xd;</xsl:text>
1012        </xsl:when>
1013        <xsl:otherwise>
1014          <xsl:variable name="type-name">
1015            <xsl:call-template name="strip-ns">
1016              <xsl:with-param name="name" select="."/>
1017            </xsl:call-template>
1018          </xsl:variable>
1019          <xsl:variable name="type-id">
1020            <xsl:call-template name="make-id">
1021              <xsl:with-param name="name" select="."/>
1022            </xsl:call-template>
1023          </xsl:variable>
1024          <xsl:variable name="type-ref-id" select="@refid"/>
1025          <xsl:text>    [[link </xsl:text>
1026          <xsl:value-of select="concat($doc-ref, $type-id)"/>
1027          <xsl:text> [*</xsl:text>
1028          <xsl:value-of select="$type-name"/>
1029          <xsl:text>]]]&#xd;    [&#xd;      </xsl:text>
1030          <xsl:value-of select="(/doxygen//compounddef[@id=$type-ref-id])[1]/briefdescription"/>
1031          <xsl:text>&#xd;    ]&#xd;</xsl:text>
1032        </xsl:otherwise>
1033      </xsl:choose>
1034      <xsl:text>  ]&#xd;</xsl:text>
1035    </xsl:for-each>
1036    <xsl:text>]&#xd;</xsl:text>
1037  </xsl:if>
1038  <xsl:if test="count(sectiondef[@kind='public-func' or @kind='public-static-func']) &gt; 0">
1039    <xsl:text>[heading Member Functions]&#xd;</xsl:text>
1040    <xsl:text>[table [[Name][Description]]&#xd;</xsl:text>
1041    <xsl:for-each select="sectiondef[@kind='public-func' or @kind='public-static-func']/memberdef" >
1042      <xsl:sort select="name"/>
1043      <xsl:variable name="name">
1044        <xsl:value-of select="name"/>
1045      </xsl:variable>
1046      <xsl:variable name="escaped-name">
1047        <xsl:call-template name="escape-name">
1048          <xsl:with-param name="text" select="$name"/>
1049        </xsl:call-template>
1050      </xsl:variable>
1051      <xsl:variable name="id">
1052        <xsl:call-template name="make-id">
1053          <xsl:with-param name="name" select="$name"/>
1054        </xsl:call-template>
1055      </xsl:variable>
1056      <xsl:variable name="doxygen-id">
1057        <xsl:value-of select="@id"/>
1058      </xsl:variable>
1059      <xsl:variable name="overload-count">
1060        <xsl:value-of select="count(../memberdef[name = $name])"/>
1061      </xsl:variable>
1062      <xsl:variable name="overload-position">
1063        <xsl:for-each select="../memberdef[name = $name]">
1064          <xsl:if test="@id = $doxygen-id">
1065            <xsl:value-of select="position()"/>
1066          </xsl:if>
1067        </xsl:for-each>
1068      </xsl:variable>
1069      <xsl:if test="$overload-position = 1">
1070        <xsl:text>  [&#xd;</xsl:text>
1071        <xsl:text>    [[link </xsl:text><xsl:value-of select="$doc-ref"/>
1072        <xsl:value-of select="$class-id"/>.<xsl:value-of select="$id"/>
1073        <xsl:text> [*</xsl:text>
1074        <xsl:value-of select="$escaped-name"/>
1075        <xsl:text>]]]&#xd;    [&#xd;      </xsl:text>
1076        <xsl:value-of select="briefdescription"/>
1077      </xsl:if>
1078      <xsl:if test="not($overload-position = 1) and not(briefdescription = preceding-sibling::*/briefdescription)">
1079        <xsl:text>&#xd;&#xd;      </xsl:text>
1080        <xsl:value-of select="briefdescription"/>
1081      </xsl:if>
1082      <xsl:if test="$overload-position = $overload-count">
1083        <xsl:text>&#xd;    ]&#xd;  ]&#xd;</xsl:text>
1084      </xsl:if>
1085    </xsl:for-each>
1086    <xsl:text>]&#xd;</xsl:text>
1087  </xsl:if>
1088  <xsl:if test="count(sectiondef[@kind='protected-func' or @kind='protected-static-func']) &gt; 0">
1089    <xsl:text>[heading Protected Member Functions]&#xd;</xsl:text>
1090    <xsl:text>[table [[Name][Description]]&#xd;</xsl:text>
1091    <xsl:for-each select="sectiondef[@kind='protected-func' or @kind='protected-static-func']/memberdef" >
1092      <xsl:sort select="name"/>
1093      <xsl:variable name="name">
1094        <xsl:value-of select="name"/>
1095      </xsl:variable>
1096      <xsl:variable name="id">
1097        <xsl:call-template name="make-id">
1098          <xsl:with-param name="name" select="$name"/>
1099        </xsl:call-template>
1100      </xsl:variable>
1101      <xsl:variable name="doxygen-id">
1102        <xsl:value-of select="@id"/>
1103      </xsl:variable>
1104      <xsl:variable name="overload-count">
1105        <xsl:value-of select="count(../memberdef[name = $name])"/>
1106      </xsl:variable>
1107      <xsl:variable name="overload-position">
1108        <xsl:for-each select="../memberdef[name = $name]">
1109          <xsl:if test="@id = $doxygen-id">
1110            <xsl:value-of select="position()"/>
1111          </xsl:if>
1112        </xsl:for-each>
1113      </xsl:variable>
1114      <xsl:if test="$overload-position = 1">
1115        <xsl:text>  [&#xd;</xsl:text>
1116        <xsl:text>    [[link </xsl:text><xsl:value-of select="$doc-ref"/>
1117        <xsl:value-of select="$class-id"/>.<xsl:value-of select="$id"/>
1118        <xsl:text> [*</xsl:text>
1119        <xsl:value-of select="$name"/>
1120        <xsl:text>]]]&#xd;    [&#xd;      </xsl:text>
1121        <xsl:value-of select="briefdescription"/>
1122      </xsl:if>
1123      <xsl:if test="not($overload-position = 1) and not(briefdescription = preceding-sibling::*/briefdescription)">
1124        <xsl:text>&#xd;&#xd;      </xsl:text>
1125        <xsl:value-of select="briefdescription"/>
1126      </xsl:if>
1127      <xsl:if test="$overload-position = $overload-count">
1128        <xsl:text>&#xd;    ]&#xd;  ]&#xd;</xsl:text>
1129      </xsl:if>
1130    </xsl:for-each>
1131    <xsl:text>]&#xd;</xsl:text>
1132  </xsl:if>
1133  <xsl:if test="count(sectiondef[@kind='private-func' or @kind='protected-private-func']) &gt; 0 and $private &gt; 0">
1134    <xsl:text>[heading Private Member Functions]&#xd;</xsl:text>
1135    <xsl:text>[table [[Name][Description]]&#xd;</xsl:text>
1136    <xsl:for-each select="sectiondef[@kind='private-func']/memberdef" >
1137      <xsl:sort select="name"/>
1138      <xsl:variable name="name">
1139        <xsl:value-of select="name"/>
1140      </xsl:variable>
1141      <xsl:variable name="id">
1142        <xsl:call-template name="make-id">
1143          <xsl:with-param name="name" select="$name"/>
1144        </xsl:call-template>
1145      </xsl:variable>
1146      <xsl:variable name="doxygen-id">
1147        <xsl:value-of select="@id"/>
1148      </xsl:variable>
1149      <xsl:variable name="overload-count">
1150        <xsl:value-of select="count(../memberdef[name = $name])"/>
1151      </xsl:variable>
1152      <xsl:variable name="overload-position">
1153        <xsl:for-each select="../memberdef[name = $name]">
1154          <xsl:if test="@id = $doxygen-id">
1155            <xsl:value-of select="position()"/>
1156          </xsl:if>
1157        </xsl:for-each>
1158      </xsl:variable>
1159      <xsl:if test="$overload-position = 1">
1160        <xsl:text>  [&#xd;</xsl:text>
1161        <xsl:text>    [[link </xsl:text><xsl:value-of select="$doc-ref"/>
1162        <xsl:value-of select="$class-id"/>.<xsl:value-of select="$id"/>
1163        <xsl:text> [*</xsl:text>
1164        <xsl:value-of select="$name"/>
1165        <xsl:text>]]]&#xd;    [&#xd;      </xsl:text>
1166        <xsl:value-of select="briefdescription"/>
1167      </xsl:if>
1168      <xsl:if test="not($overload-position = 1) and not(briefdescription = preceding-sibling::*/briefdescription)">
1169        <xsl:text>&#xd;&#xd;      </xsl:text>
1170        <xsl:value-of select="briefdescription"/>
1171      </xsl:if>
1172      <xsl:if test="$overload-position = $overload-count">
1173        <xsl:text>&#xd;    ]&#xd;  ]&#xd;</xsl:text>
1174      </xsl:if>
1175    </xsl:for-each>
1176    <xsl:text>]&#xd;</xsl:text>
1177  </xsl:if>
1178  <xsl:if test="count(sectiondef[@kind='public-attrib' or @kind='public-static-attrib']) &gt; 0">
1179    <xsl:text>[heading Data Members]&#xd;</xsl:text>
1180    <xsl:text>[table [[Name][Description]]&#xd;</xsl:text>
1181    <xsl:for-each select="sectiondef[@kind='public-attrib' or @kind='public-static-attrib']/memberdef" >
1182      <xsl:sort select="name"/>
1183      <xsl:text>  [&#xd;</xsl:text>
1184      <xsl:text>    [[link </xsl:text><xsl:value-of select="$doc-ref"/>
1185      <xsl:value-of select="$class-id"/>.<xsl:value-of select="name"/>
1186      <xsl:text> [*</xsl:text>
1187      <xsl:value-of select="name"/>
1188      <xsl:text>]]]&#xd;    [&#xd;      </xsl:text>
1189      <xsl:value-of select="briefdescription"/>
1190      <xsl:text>&#xd;    ]&#xd;  ]&#xd;</xsl:text>
1191    </xsl:for-each>
1192    <xsl:text>]&#xd;</xsl:text>
1193  </xsl:if>
1194  <xsl:if test="count(sectiondef[@kind='protected-attrib' or @kind='protected-static-attrib']) &gt; 0">
1195    <xsl:text>[heading Protected Data Members]&#xd;</xsl:text>
1196    <xsl:text>[table [[Name][Description]]&#xd;</xsl:text>
1197    <xsl:for-each select="sectiondef[@kind='protected-attrib' or @kind='protected-static-attrib']/memberdef" >
1198      <xsl:sort select="name"/>
1199      <xsl:text>  [&#xd;</xsl:text>
1200      <xsl:text>    [[link </xsl:text><xsl:value-of select="$doc-ref"/>
1201      <xsl:value-of select="$class-id"/>.<xsl:value-of select="name"/>
1202      <xsl:text> [*</xsl:text>
1203      <xsl:value-of select="name"/>
1204      <xsl:text>]]]&#xd;    [&#xd;      </xsl:text>
1205      <xsl:value-of select="briefdescription"/>
1206      <xsl:text>&#xd;    ]&#xd;  ]&#xd;</xsl:text>
1207    </xsl:for-each>
1208    <xsl:text>]&#xd;</xsl:text>
1209  </xsl:if>
1210  <xsl:if test="count(sectiondef[@kind='private-attrib' or @kind='private-static-attrib']) &gt; 0 and
1211      $private &gt; 0">
1212    <xsl:text>[heading Private Data Members]&#xd;</xsl:text>
1213    <xsl:text>[table [[Name][Description]]&#xd;</xsl:text>
1214    <xsl:for-each select="sectiondef[@kind='private-attrib' or @kind='private-static-attrib']/memberdef" >
1215      <xsl:sort select="name"/>
1216      <xsl:text>  [&#xd;</xsl:text>
1217      <xsl:text>    [[link </xsl:text><xsl:value-of select="$doc-ref"/>
1218      <xsl:value-of select="$class-id"/>.<xsl:value-of select="name"/>
1219      <xsl:text> [*</xsl:text>
1220      <xsl:value-of select="name"/>
1221      <xsl:text>]]]&#xd;    [&#xd;      </xsl:text>
1222      <xsl:value-of select="briefdescription"/>
1223      <xsl:text>&#xd;    ]&#xd;  ]&#xd;</xsl:text>
1224    </xsl:for-each>
1225    <xsl:text>]&#xd;</xsl:text>
1226  </xsl:if>
1227  <xsl:if test="count(sectiondef[@kind='friend']/memberdef[not(type = 'friend class') and not(contains(name, '_helper'))]) &gt; 0">
1228    <xsl:text>[heading Friends]&#xd;</xsl:text>
1229    <xsl:text>[table [[Name][Description]]&#xd;</xsl:text>
1230    <xsl:for-each select="sectiondef[@kind='friend']/memberdef[not(type = 'friend class') and not(contains(name, '_helper'))]"  >
1231      <xsl:sort select="name"/>
1232      <xsl:variable name="name">
1233        <xsl:value-of select="name"/>
1234      </xsl:variable>
1235      <xsl:variable name="id">
1236        <xsl:call-template name="make-id">
1237          <xsl:with-param name="name" select="$name"/>
1238        </xsl:call-template>
1239      </xsl:variable>
1240      <xsl:variable name="doxygen-id">
1241        <xsl:value-of select="@id"/>
1242      </xsl:variable>
1243      <xsl:variable name="overload-count">
1244        <xsl:value-of select="count(../memberdef[name = $name])"/>
1245      </xsl:variable>
1246      <xsl:variable name="overload-position">
1247        <xsl:for-each select="../memberdef[name = $name]">
1248          <xsl:if test="@id = $doxygen-id">
1249            <xsl:value-of select="position()"/>
1250          </xsl:if>
1251        </xsl:for-each>
1252      </xsl:variable>
1253      <xsl:if test="$overload-position = 1">
1254        <xsl:text>  [&#xd;</xsl:text>
1255        <xsl:text>    [[link </xsl:text>
1256        <xsl:variable name="friend-link">
1257        <!-- VFALCO This forms a link to a class member instead of a friend free function -->
1258          <xsl:value-of select="$doc-ref"/>
1259          <xsl:value-of select="$class-id"/>
1260          <xsl:text>.</xsl:text>
1261          <xsl:value-of select="$id"/>
1262        </xsl:variable>
1263        <xsl:value-of select="$friend-link"/>
1264        <xsl:text> [*</xsl:text>
1265        <xsl:value-of select="$name"/>
1266        <xsl:text>]]]&#xd;    [&#xd;      </xsl:text>
1267        <xsl:value-of select="briefdescription"/>
1268      </xsl:if>
1269      <xsl:if test="not($overload-position = 1) and not(briefdescription = preceding-sibling::*/briefdescription)">
1270        <xsl:text>&#xd;&#xd;      </xsl:text>
1271        <xsl:value-of select="briefdescription"/>
1272      </xsl:if>
1273      <xsl:if test="$overload-position = $overload-count">
1274        <xsl:text>&#xd;    ]&#xd;  ]&#xd;</xsl:text>
1275      </xsl:if>
1276    </xsl:for-each>
1277    <xsl:text>]&#xd;</xsl:text>
1278  </xsl:if>
1279  <xsl:if test="count(sectiondef[@kind='related']/memberdef) &gt; 0">
1280    <xsl:text>[heading Related Functions]&#xd;</xsl:text>
1281    <xsl:text>[table [[Name][Description]]&#xd;</xsl:text>
1282    <xsl:for-each select="sectiondef[@kind='related']/memberdef" >
1283      <xsl:sort select="name"/>
1284      <xsl:variable name="name">
1285        <xsl:value-of select="name"/>
1286      </xsl:variable>
1287      <xsl:variable name="id">
1288        <xsl:call-template name="make-id">
1289          <xsl:with-param name="name" select="$name"/>
1290        </xsl:call-template>
1291      </xsl:variable>
1292      <xsl:variable name="doxygen-id">
1293        <xsl:value-of select="@id"/>
1294      </xsl:variable>
1295      <xsl:variable name="overload-count">
1296        <xsl:value-of select="count(../memberdef[name = $name])"/>
1297      </xsl:variable>
1298      <xsl:variable name="overload-position">
1299        <xsl:for-each select="../memberdef[name = $name]">
1300          <xsl:if test="@id = $doxygen-id">
1301            <xsl:value-of select="position()"/>
1302          </xsl:if>
1303        </xsl:for-each>
1304      </xsl:variable>
1305      <xsl:if test="$overload-position = 1">
1306      [
1307        [[link <xsl:value-of select="$doc-ref"/><xsl:value-of select="$class-id"/>.<xsl:value-of select="$id"/>
1308          <xsl:text> </xsl:text>[*<xsl:value-of select="$name"/><xsl:text>]]]
1309        [</xsl:text><xsl:value-of select="briefdescription"/>
1310      </xsl:if>
1311      <xsl:if test="not($overload-position = 1) and not(briefdescription = preceding-sibling::*/briefdescription)">
1312        <xsl:value-of select="$newline"/>
1313        <xsl:value-of select="$newline"/>
1314        <xsl:text>     </xsl:text>
1315        <xsl:value-of select="briefdescription"/>
1316      </xsl:if>
1317      <xsl:if test="$overload-position = $overload-count">
1318        <xsl:text>]
1319      ]
1320        </xsl:text>
1321      </xsl:if>
1322    </xsl:for-each>
1323    ]
1324  </xsl:if>
1325</xsl:template>
1326
1327
1328
1329<xsl:template name="class-members">
1330<xsl:param name="class-name"/>
1331<xsl:param name="class-id"/>
1332<xsl:param name="class-file"/>
1333<xsl:choose>
1334  <xsl:when test="$private &gt; 0">
1335    <xsl:apply-templates select="sectiondef[
1336        @kind='public-type' or
1337        @kind='public-func' or
1338        @kind='public-static-func' or
1339        @kind='public-attrib' or
1340        @kind='public-static-attrib' or
1341        @kind='protected-func' or
1342        @kind='protected-static-func' or
1343        @kind='protected-attrib' or
1344        @kind='protected-static-attrib' or
1345        @kind='private-func' or
1346        @kind='protected-private-func' or
1347        @kind='private-attrib' or
1348        @kind='private-static-attrib' or
1349        @kind='friend' or
1350        @kind='related'
1351        ]/memberdef[not(type = 'friend class') and not(contains(name, '_helper'))]" mode="class-detail">
1352      <xsl:sort select="name"/>
1353      <xsl:with-param name="class-name" select="$class-name"/>
1354      <xsl:with-param name="class-id" select="$class-id"/>
1355      <xsl:with-param name="class-file" select="$class-file"/>
1356    </xsl:apply-templates>
1357  </xsl:when>
1358  <xsl:otherwise>
1359    <xsl:apply-templates select="sectiondef[
1360        @kind='public-type' or
1361        @kind='public-func' or
1362        @kind='public-static-func' or
1363        @kind='public-attrib' or
1364        @kind='public-static-attrib' or
1365        @kind='protected-func' or
1366        @kind='protected-static-func' or
1367        @kind='protected-attrib' or
1368        @kind='protected-static-attrib' or
1369        @kind='protected-private-func' or
1370        @kind='friend' or
1371        @kind='related'
1372        ]/memberdef[not(type = 'friend class') and not(contains(name, '_helper'))]" mode="class-detail">
1373      <xsl:sort select="name"/>
1374      <xsl:with-param name="class-name" select="$class-name"/>
1375      <xsl:with-param name="class-id" select="$class-id"/>
1376      <xsl:with-param name="class-file" select="$class-file"/>
1377    </xsl:apply-templates>
1378  </xsl:otherwise>
1379</xsl:choose>
1380<xsl:if test="$class-name = 'io_service::service'">
1381  <xsl:apply-templates select="sectiondef[@kind='private-func']/memberdef[not(type = 'friend class') and not(contains(name, '_helper'))]" mode="class-detail">
1382    <xsl:sort select="name"/>
1383    <xsl:with-param name="class-name" select="$class-name"/>
1384    <xsl:with-param name="class-id" select="$class-id"/>
1385    <xsl:with-param name="class-file" select="$class-file"/>
1386  </xsl:apply-templates>
1387</xsl:if>
1388</xsl:template>
1389
1390
1391
1392<!-- Class detail -->
1393
1394<xsl:template match="memberdef" mode="class-detail">
1395  <xsl:param name="class-name"/>
1396  <xsl:param name="class-id"/>
1397  <xsl:param name="class-file"/>
1398  <xsl:variable name="name">
1399    <xsl:value-of select="name"/>
1400  </xsl:variable>
1401  <xsl:variable name="escaped-name">
1402    <xsl:call-template name="escape-name">
1403      <xsl:with-param name="text" select="$name"/>
1404    </xsl:call-template>
1405  </xsl:variable>
1406  <xsl:variable name="id">
1407    <xsl:call-template name="make-id">
1408      <xsl:with-param name="name" select="$name"/>
1409    </xsl:call-template>
1410  </xsl:variable>
1411  <xsl:variable name="doxygen-id">
1412    <xsl:value-of select="@id"/>
1413  </xsl:variable>
1414  <xsl:variable name="overload-count">
1415    <xsl:value-of select="count(../memberdef[name = $name])"/>
1416  </xsl:variable>
1417  <xsl:variable name="overload-position">
1418    <xsl:for-each select="../memberdef[name = $name]">
1419      <xsl:if test="@id = $doxygen-id">
1420        <xsl:value-of select="position()"/>
1421      </xsl:if>
1422    </xsl:for-each>
1423  </xsl:variable>
1424  <xsl:if test="$overload-count &gt; 1 and $overload-position = 1">
1425    <xsl:text>[section:</xsl:text>
1426    <xsl:value-of select="$id"/>
1427    <xsl:text> </xsl:text>
1428    <xsl:value-of select="$class-name"/>
1429    <xsl:text>::</xsl:text>
1430    <xsl:value-of select="$escaped-name"/>
1431    <xsl:text>]&#xd;</xsl:text>
1432    <xsl:text>[indexterm2 </xsl:text>
1433    <xsl:value-of select="$escaped-name"/>
1434    <xsl:text>..</xsl:text>
1435    <xsl:value-of select="$class-name"/>
1436    <xsl:text>]&#xd;</xsl:text>
1437    <xsl:apply-templates select="briefdescription" mode="markup"/>
1438    <xsl:text>```&#xd;</xsl:text>
1439    <xsl:for-each select="../memberdef[name = $name]">
1440      <xsl:if test="position() &gt; 1">
1441        <xsl:text>&#xd;</xsl:text>
1442        <xsl:if test=" not(briefdescription = preceding-sibling::*/briefdescription)">
1443          <xsl:text>```&#xd;</xsl:text>
1444          <xsl:apply-templates select="briefdescription" mode="markup"/>
1445          <xsl:text>```&#xd;</xsl:text>
1446        </xsl:if>
1447      </xsl:if>
1448      <xsl:apply-templates select="templateparamlist" mode="class-detail"/>
1449      <xsl:if test="@explicit='yes'">explicit&#xd;</xsl:if>
1450      <xsl:if test="@friend='yes'">friend&#xd;</xsl:if>
1451      <xsl:if test="@static='yes'">static&#xd;</xsl:if>
1452      <xsl:if test="@virt='virtual'">virtual&#xd;</xsl:if>
1453      <xsl:variable name="stripped-type">
1454        <xsl:call-template name="cleanup-type">
1455          <xsl:with-param name="name" select="type"/>
1456        </xsl:call-template>
1457      </xsl:variable>
1458      <xsl:if test="string-length($stripped-type) &gt; 0">
1459        <xsl:value-of select="$stripped-type"/>
1460        <xsl:text>&#xd;</xsl:text>
1461      </xsl:if>
1462      <xsl:text>``[link </xsl:text><xsl:value-of select="$doc-ref"/>
1463      <xsl:value-of select="$class-id"/>
1464      <xsl:text>.</xsl:text>
1465      <xsl:value-of select="$id"/>
1466      <xsl:text>.overload</xsl:text>
1467      <xsl:value-of select="position()"/>
1468      <xsl:text> </xsl:text>
1469      <xsl:value-of select="name"/>
1470      <xsl:text>]``(</xsl:text>
1471      <xsl:apply-templates select="param" mode="class-detail"/>
1472      <xsl:text>)</xsl:text>
1473      <xsl:if test="@const='yes'">
1474        <xsl:text> const</xsl:text>
1475      </xsl:if>
1476      <xsl:text>;&#xd;</xsl:text>
1477
1478      <xsl:text>  ``[''''&amp;raquo;''' </xsl:text>
1479      <xsl:text>[link </xsl:text><xsl:value-of select="$doc-ref"/>
1480      <xsl:value-of select="$class-id"/>
1481      <xsl:text>.</xsl:text>
1482      <xsl:value-of select="$id"/>
1483      <xsl:text>.overload</xsl:text>
1484      <xsl:value-of select="position()"/>
1485      <xsl:text> more...]]``</xsl:text>
1486      <xsl:text>&#xd;</xsl:text>
1487
1488    </xsl:for-each>
1489    <xsl:text>```&#xd;</xsl:text>
1490  </xsl:if>
1491
1492<!-- Member function detail -->
1493  <xsl:text>[section:</xsl:text>
1494  <xsl:if test="$overload-count = 1">
1495    <xsl:value-of select="$id"/>
1496  </xsl:if>
1497  <xsl:if test="$overload-count &gt; 1">
1498    <xsl:text>overload</xsl:text>
1499    <xsl:value-of select="$overload-position"/>
1500  </xsl:if>
1501  <xsl:text> </xsl:text>
1502  <xsl:value-of select="$class-name"/>
1503    <xsl:text>::</xsl:text>
1504    <xsl:value-of select="$escaped-name"/>
1505    <xsl:if test="$overload-count &gt; 1">
1506    <xsl:text> (</xsl:text>
1507    <xsl:value-of select="$overload-position"/>
1508    <xsl:text> of </xsl:text>
1509    <xsl:value-of select="$overload-count"/>
1510    <xsl:text> overloads)</xsl:text>
1511  </xsl:if>
1512  <xsl:text>]&#xd;</xsl:text>
1513  <xsl:if test="not(starts-with($doxygen-id, ../../@id))">
1514    <xsl:variable name="inherited-from" select="/doxygen/compounddef[starts-with($doxygen-id, @id)]/compoundname"/>
1515    <xsl:if test="not(contains($inherited-from, '::detail'))">
1516      <xsl:text>(Inherited from `</xsl:text>
1517      <!-- VFALCO Make this a link -->
1518      <xsl:call-template name="strip-doc-ns">
1519        <xsl:with-param name="name" select="$inherited-from"/>
1520      </xsl:call-template>
1521      <xsl:text>`)&#xd;&#xd;</xsl:text>
1522    </xsl:if>
1523  </xsl:if>
1524  <xsl:if test="$overload-count = 1">
1525    <xsl:text>[indexterm2 </xsl:text>
1526    <xsl:value-of select="$escaped-name"/>
1527    <xsl:text>..</xsl:text>
1528    <xsl:value-of select="$class-name"/>
1529    <xsl:text>]&#xd;</xsl:text>
1530  </xsl:if>
1531  <xsl:apply-templates select="briefdescription" mode="markup"/>
1532  <xsl:text>&#xd;[heading Synopsis]&#xd;</xsl:text>
1533  <xsl:if test="@kind='friend'">
1534    <xsl:call-template name="includes">
1535      <xsl:with-param name="file" select="$class-file"/>
1536    </xsl:call-template>
1537  </xsl:if>
1538  <xsl:choose>
1539    <xsl:when test="@kind='typedef'">
1540      <xsl:call-template name="typedef">
1541        <xsl:with-param name="class-name" select="$class-name"/>
1542      </xsl:call-template>
1543    </xsl:when>
1544    <xsl:when test="@kind='variable'">
1545      <xsl:call-template name="variable"/>
1546    </xsl:when>
1547    <xsl:when test="@kind='enum'">
1548      <xsl:call-template name="enum">
1549        <xsl:with-param name="enum-name" select="$class-name"/>
1550      </xsl:call-template>
1551    </xsl:when>
1552    <xsl:when test="@kind='function'">
1553      <xsl:text>```&#xd;</xsl:text>
1554      <xsl:call-template name="function"/>
1555      <xsl:text>```&#xd;</xsl:text>
1556    </xsl:when>
1557    <xsl:when test="@kind='friend'">
1558      <xsl:text>```&#xd;</xsl:text>
1559      <xsl:call-template name="function"/>
1560      <xsl:text>```&#xd;</xsl:text>
1561    </xsl:when>
1562  </xsl:choose>
1563  <xsl:text>&#xd;[heading Description]&#xd;</xsl:text>
1564  <xsl:apply-templates select="detaileddescription" mode="markup"/>
1565  <xsl:if test="@kind='friend'">
1566    <xsl:call-template name="includes-foot">
1567      <xsl:with-param name="file" select="$class-file"/>
1568    </xsl:call-template>
1569  </xsl:if>
1570  <xsl:choose>
1571    <xsl:when test="$overload-count &gt; 1 and $overload-position = $overload-count">
1572      <xsl:text>[endsect]&#xd;[endsect]&#xd;&#xd;</xsl:text>
1573    </xsl:when>
1574    <xsl:otherwise>
1575      <xsl:text>[endsect]&#xd;</xsl:text>
1576    </xsl:otherwise>
1577  </xsl:choose>
1578</xsl:template>
1579
1580
1581
1582<xsl:template name="typedef">
1583  <xsl:param name="class-name"/>
1584  <xsl:text>&#xd;```&#xd;</xsl:text>
1585  <xsl:apply-templates select="templateparamlist" mode="class-detail"/>
1586  <xsl:text>using </xsl:text>
1587  <xsl:value-of select="name"/>
1588  <xsl:text> = </xsl:text>
1589  <xsl:variable name="stripped-type">
1590    <xsl:call-template name="cleanup-type">
1591      <xsl:with-param name="name" select="type"/>
1592    </xsl:call-template>
1593  </xsl:variable>
1594  <xsl:if test="string-length($stripped-type) &gt; 0">
1595    <xsl:value-of select="$stripped-type"/>
1596  </xsl:if>
1597  <xsl:text>;&#xd;</xsl:text>
1598  <xsl:text>```&#xd;</xsl:text>
1599  <xsl:if test="count(type/ref) &gt; 0 and not(contains(type, '*'))">
1600    <xsl:variable name="class-refid">
1601      <xsl:for-each select="type/ref[1]">
1602        <xsl:value-of select="@refid"/>
1603      </xsl:for-each>
1604    </xsl:variable>
1605    <xsl:variable name="name" select="name"/>
1606    <xsl:for-each select="/doxygen/compounddef[@id=$class-refid]">
1607<!-- VFALCO This looks like it was for debugging?
1608<xsl:value-of select="concat($class-name, '::', $name)"/><xsl:text>&#xd;&#xd;</xsl:text>
1609<xsl:value-of select="compoundname"/><xsl:text>&#xd;&#xd;</xsl:text>
1610<xsl:variable name="ref-id">
1611  <xsl:call-template name="make-id">
1612    <xsl:with-param name="name" select="compoundname"/>
1613  </xsl:call-template>
1614</xsl:variable>
1615<xsl:value-of select="$ref-id"/><xsl:text>&#xd;&#xd;</xsl:text>
1616-->
1617      <xsl:call-template name="class-tables">
1618        <xsl:with-param name="class-name">
1619          <xsl:value-of select="concat($class-name, '::', $name)"/>
1620        </xsl:with-param>
1621        <xsl:with-param name="class-id">
1622          <xsl:call-template name="make-id">
1623            <xsl:with-param name="name" select="compoundname"/>
1624          </xsl:call-template>
1625        </xsl:with-param>
1626      </xsl:call-template>
1627      <xsl:apply-templates select="detaileddescription" mode="markup"/>
1628    </xsl:for-each>
1629  </xsl:if>
1630</xsl:template>
1631
1632
1633<!-- Variable at namespace scope -->
1634<xsl:template name="variable">
1635  <xsl:text>```&#xd;</xsl:text>
1636  <xsl:if test="@static='yes'">
1637    <xsl:text>static&#xd;</xsl:text>
1638  </xsl:if>
1639  <xsl:value-of select="type"/>
1640  <xsl:text> </xsl:text>
1641  <xsl:value-of select="name"/>
1642  <xsl:if test="count(initializer) = 1">
1643    <xsl:text> </xsl:text>
1644    <xsl:value-of select="initializer"/>
1645  </xsl:if>
1646  <xsl:text>;&#xd;```&#xd;</xsl:text>
1647</xsl:template>
1648
1649
1650
1651<xsl:template name="enum">
1652  <xsl:param name="enum-name"/>
1653  <xsl:text>```&#xd;</xsl:text>
1654  <xsl:text>enum </xsl:text>
1655  <xsl:value-of select="name"/>
1656  <xsl:text>&#xd;```&#xd;</xsl:text>
1657  <xsl:if test="count(enumvalue) &gt; 0">
1658    <xsl:text>&#xd;</xsl:text>
1659    <xsl:for-each select="enumvalue">
1660      <xsl:text>[indexterm2 </xsl:text>
1661      <xsl:value-of select="name"/>
1662      <xsl:text>..</xsl:text>
1663      <xsl:value-of select="$enum-name"/>
1664      <xsl:text>]</xsl:text>
1665      <xsl:text>&#xd;</xsl:text>
1666    </xsl:for-each>
1667    <xsl:text>[heading Values]&#xd;</xsl:text>
1668    <xsl:text>[table [[Name][Description]]&#xd;</xsl:text>
1669    <xsl:for-each select="enumvalue">
1670      <xsl:text>  [[[^</xsl:text>
1671      <xsl:value-of select="name"/>
1672      <xsl:text>]][</xsl:text>
1673      <xsl:value-of select="briefdescription"/>
1674      <xsl:text>&#xd;&#xd;</xsl:text>
1675      <xsl:value-of select="detaileddescription"/>
1676      <xsl:text>]]&#xd;</xsl:text>
1677    </xsl:for-each>
1678    <xsl:text>]&#xd;</xsl:text>
1679  </xsl:if>
1680</xsl:template>
1681
1682
1683
1684<xsl:template name="function">
1685  <xsl:variable name="doxygen-id">
1686    <xsl:value-of select="@id"/>
1687  </xsl:variable>
1688  <xsl:choose>
1689    <xsl:when test="count(/doxygen//memberdef[@id=$doxygen-id]/templateparamlist) = 1">
1690      <xsl:apply-templates select="/doxygen//memberdef[@id=$doxygen-id]/templateparamlist" mode="class-detail"/>
1691    </xsl:when>
1692    <xsl:otherwise>
1693      <xsl:apply-templates select="templateparamlist" mode="class-detail"/>
1694    </xsl:otherwise>
1695  </xsl:choose>
1696  <xsl:variable name="stripped-type">
1697    <xsl:call-template name="cleanup-type">
1698      <xsl:with-param name="name" select="type"/>
1699    </xsl:call-template>
1700  </xsl:variable>
1701  <xsl:if test="@static='yes'">static&#xd;</xsl:if>
1702  <xsl:if test="@virt='virtual'">virtual&#xd;</xsl:if>
1703  <xsl:if test="string-length($stripped-type) &gt; 0">
1704    <xsl:value-of select="$stripped-type"/>
1705    <xsl:text>&#xd;</xsl:text>
1706  </xsl:if>
1707  <xsl:value-of select="name"/>
1708  <xsl:text>(</xsl:text>
1709  <xsl:apply-templates select="param" mode="class-detail"/>
1710  <xsl:text>)</xsl:text>
1711  <xsl:if test="@const='yes'"> const</xsl:if>
1712  <xsl:text>;&#xd;</xsl:text>
1713</xsl:template>
1714
1715
1716<!-- Template parameter list synopsis -->
1717<xsl:template match="templateparamlist" mode="class-detail">
1718  <xsl:text>template&lt;&#xd;</xsl:text>
1719  <xsl:apply-templates select="param" mode="class-detail-template"/>
1720  <xsl:text>&gt;&#xd;</xsl:text>
1721</xsl:template>
1722
1723
1724
1725<xsl:template match="param" mode="class-detail-template">
1726  <xsl:text>    </xsl:text>
1727  <!-- Normalize 'class', 'class...' or NTTP type -->
1728  <xsl:choose>
1729    <xsl:when test="count(declname) &gt; 0">
1730      <xsl:value-of select="type"/>
1731      <xsl:text> </xsl:text>
1732    </xsl:when>
1733    <xsl:when test="starts-with(type, 'class ')">
1734      <xsl:text>class </xsl:text>
1735    </xsl:when>
1736    <xsl:otherwise>
1737      <xsl:text>[role red error.class-detail-template.1]</xsl:text>
1738    </xsl:otherwise>
1739  </xsl:choose>
1740  <!-- Normalize the <param> -->
1741  <xsl:variable name="normal-tparam">
1742    <xsl:choose>
1743      <xsl:when test="count(declname) &gt; 0">
1744        <xsl:value-of select="declname"/>
1745      </xsl:when>
1746      <xsl:when test="starts-with(type, 'class ')">
1747        <xsl:value-of select="substring(type, 7)"/>
1748      </xsl:when>
1749      <xsl:otherwise>
1750        <xsl:text>[role red error.class-detail-template.2]</xsl:text>
1751      </xsl:otherwise>
1752    </xsl:choose>
1753  </xsl:variable>
1754  <xsl:choose>
1755    <!-- CLASS_DETAIL_TEMPLATE -->
1756    <xsl:otherwise>
1757      <xsl:value-of select="$normal-tparam"/>
1758    </xsl:otherwise>
1759  </xsl:choose>
1760  <!-- default template parameter value -->
1761  <xsl:if test="count(defval) &gt; 0">
1762    <xsl:text> = </xsl:text>
1763    <xsl:value-of select="defval"/>
1764  </xsl:if>
1765  <!-- comma separator -->
1766  <xsl:if test="not(position() = last())">
1767    <xsl:text>,&#xd;</xsl:text>
1768  </xsl:if>
1769</xsl:template>
1770
1771<xsl:template match="param" mode="class-detail">
1772  <xsl:text>&#xd;    </xsl:text>
1773  <xsl:choose>
1774    <xsl:when test="string-length(array) &gt; 0">
1775      <xsl:value-of select="substring-before(type, '&amp;')"/>
1776      <xsl:text>(&amp;</xsl:text>
1777      <xsl:value-of select="declname"/>
1778      <xsl:text>)</xsl:text>
1779      <xsl:value-of select="array"/>
1780    </xsl:when>
1781    <xsl:otherwise>
1782      <xsl:call-template name="cleanup-param">
1783        <xsl:with-param name="name" select="type"/>
1784      </xsl:call-template>
1785      <xsl:if test="count(declname) &gt; 0">
1786        <xsl:text> </xsl:text>
1787        <xsl:value-of select="declname"/>
1788      </xsl:if>
1789    </xsl:otherwise>
1790  </xsl:choose>
1791  <xsl:if test="count(defval) &gt; 0">
1792    <xsl:text> = </xsl:text>
1793    <xsl:value-of select="defval"/>
1794  </xsl:if>
1795  <xsl:if test="not(position() = last())">
1796    <xsl:text>,</xsl:text>
1797  </xsl:if>
1798</xsl:template>
1799
1800<xsl:template match="*" mode="class-detail"/>
1801
1802<!--========== Namespace ==========-->
1803
1804<xsl:template name="namespace-memberdef">
1805  <xsl:variable name="name">
1806    <xsl:call-template name="strip-doc-ns">
1807      <xsl:with-param name="name" select="concat(../../compoundname, '::', name)"/>
1808    </xsl:call-template>
1809  </xsl:variable>
1810  <xsl:variable name="unqualified-name">
1811    <xsl:call-template name="strip-ns">
1812      <xsl:with-param name="name" select="$name"/>
1813    </xsl:call-template>
1814  </xsl:variable>
1815  <xsl:variable name="id">
1816    <xsl:call-template name="make-id">
1817      <xsl:with-param name="name" select="concat(../../compoundname, '::', name)"/>
1818    </xsl:call-template>
1819  </xsl:variable>
1820  <xsl:variable name="doxygen-id">
1821    <xsl:value-of select="@id"/>
1822  </xsl:variable>
1823  <xsl:variable name="overload-count">
1824    <xsl:value-of select="count(../memberdef[name = $unqualified-name])"/>
1825  </xsl:variable>
1826  <xsl:variable name="overload-position">
1827    <xsl:for-each select="../memberdef[name = $unqualified-name]">
1828      <xsl:if test="@id = $doxygen-id">
1829        <xsl:value-of select="position()"/>
1830      </xsl:if>
1831    </xsl:for-each>
1832  </xsl:variable>
1833  <xsl:variable name="display-name">
1834    <xsl:call-template name="strip-doc-ns">
1835      <xsl:with-param name="name" select="concat(../../compoundname, '::', name)"/>
1836    </xsl:call-template>
1837  </xsl:variable>
1838  <xsl:if test="$overload-count &gt; 1 and $overload-position = 1">
1839    <xsl:text>[section:</xsl:text>
1840    <xsl:value-of select="$id"/>
1841    <xsl:text> </xsl:text>
1842    <xsl:value-of select="$display-name"/>
1843    <xsl:text>]&#xd;</xsl:text>
1844    <xsl:text>[indexterm1 </xsl:text>
1845    <xsl:value-of select="$display-name"/>
1846    <xsl:text>]&#xd;</xsl:text>
1847    <!-- VFALCO But each overload could be in a different file!
1848    <xsl:call-template name="includes">
1849      <xsl:with-param name="file" select="location/@file"/>
1850    </xsl:call-template>
1851    -->
1852    <xsl:choose>
1853      <xsl:when test="count(/doxygen/compounddef[@kind='group' and compoundname=$name]) &gt; 0">
1854        <xsl:for-each select="/doxygen/compounddef[@kind='group' and compoundname=$name]">
1855          <xsl:apply-templates select="briefdescription" mode="markup"/>
1856        </xsl:for-each>
1857      </xsl:when>
1858      <xsl:otherwise>
1859        <xsl:apply-templates select="briefdescription" mode="markup"/>
1860      </xsl:otherwise>
1861    </xsl:choose>
1862    <xsl:text>```&#xd;</xsl:text>
1863    <xsl:for-each select="../memberdef[name = $unqualified-name]">
1864      <xsl:if test="position() &gt; 1">
1865        <xsl:text>&#xd;</xsl:text>
1866        <xsl:if test=" not(briefdescription = preceding-sibling::*/briefdescription)">
1867          <xsl:text>```&#xd;</xsl:text>
1868          <xsl:apply-templates select="briefdescription" mode="markup"/>
1869          <xsl:text>```&#xd;</xsl:text>
1870        </xsl:if>
1871      </xsl:if>
1872      <xsl:variable name="stripped-type">
1873        <xsl:call-template name="cleanup-type">
1874          <xsl:with-param name="name" select="type"/>
1875        </xsl:call-template>
1876      </xsl:variable>
1877      <xsl:apply-templates select="templateparamlist" mode="class-detail"/>
1878      <xsl:if test="string-length($stripped-type) &gt; 0">
1879        <xsl:value-of select="$stripped-type"/>
1880        <xsl:text>&#xd;</xsl:text>
1881      </xsl:if>
1882      <xsl:text>``[link </xsl:text><xsl:value-of select="$doc-ref"/>
1883      <xsl:value-of select="$id"/>
1884      <xsl:text>.overload</xsl:text>
1885      <xsl:value-of select="position()"/>
1886      <xsl:text> </xsl:text>
1887      <xsl:value-of select="name"/>
1888      <xsl:text>]``(</xsl:text>
1889      <xsl:apply-templates select="param" mode="class-detail"/>
1890      <xsl:text>);&#xd;</xsl:text>
1891
1892      <xsl:text>  ``[''''&amp;raquo;''' </xsl:text>
1893      <xsl:text>[link </xsl:text><xsl:value-of select="$doc-ref"/>
1894      <xsl:value-of select="$id"/>
1895      <xsl:text>.overload</xsl:text>
1896      <xsl:value-of select="position()"/>
1897      <xsl:text> more...]]``</xsl:text>
1898      <xsl:text>&#xd;</xsl:text>
1899
1900    </xsl:for-each>
1901    <xsl:text>```&#xd;</xsl:text>
1902    <xsl:for-each select="/doxygen/compounddef[@kind='group' and compoundname=$name]">
1903      <xsl:apply-templates select="detaileddescription" mode="markup"/>
1904    </xsl:for-each>
1905  </xsl:if>
1906  <xsl:if test="$overload-count = 1">
1907    <xsl:text>[section:</xsl:text>
1908    <xsl:value-of select="$id"/>
1909  </xsl:if>
1910  <xsl:if test="$overload-count &gt; 1">
1911    <xsl:text>[section:</xsl:text>
1912    <xsl:text>overload</xsl:text>
1913    <xsl:value-of select="$overload-position"/>
1914  </xsl:if>
1915  <xsl:text> </xsl:text>
1916  <xsl:value-of select="$name"/>
1917  <xsl:if test="$overload-count &gt; 1">
1918    <xsl:text> (</xsl:text>
1919    <xsl:value-of select="$overload-position"/>
1920    <xsl:text> of </xsl:text>
1921    <xsl:value-of select="$overload-count"/>
1922    <xsl:text> overloads)</xsl:text>
1923  </xsl:if>
1924  <xsl:text>]&#xd;</xsl:text>
1925  <xsl:if test="$overload-count = 1">
1926    <xsl:text>[indexterm1 </xsl:text>
1927    <xsl:value-of select="$name"/>
1928    <xsl:text>]&#xd;</xsl:text>
1929  </xsl:if>
1930  <xsl:apply-templates select="briefdescription" mode="markup"/>
1931  <xsl:text>&#xd;[heading Synopsis]&#xd;</xsl:text>
1932  <xsl:if test="$overload-count &gt;= 1">
1933    <xsl:call-template name="includes">
1934      <xsl:with-param name="file" select="location/@file"/>
1935    </xsl:call-template>
1936  </xsl:if>
1937  <xsl:choose>
1938    <!-- Handles using/typedef at namespace scope -->
1939    <xsl:when test="@kind='typedef'">
1940      <xsl:call-template name="typedef">
1941        <xsl:with-param name="class-name" select="$name"/>
1942      </xsl:call-template>
1943      <xsl:text>&#xd;[heading Description]&#xd;</xsl:text>
1944      <xsl:apply-templates select="detaileddescription" mode="markup"/>
1945    </xsl:when>
1946    <!-- Everything else at namespace scope-->
1947    <xsl:otherwise>
1948      <xsl:choose>
1949        <xsl:when test="@kind='variable'">
1950          <xsl:call-template name="variable"/>
1951        </xsl:when>
1952        <xsl:when test="@kind='enum'">
1953          <xsl:call-template name="enum">
1954            <xsl:with-param name="enum-name" select="$name"/>
1955          </xsl:call-template>
1956        </xsl:when>
1957        <xsl:when test="@kind='function'">
1958          <xsl:text>&#xd;```&#xd;</xsl:text>
1959          <xsl:call-template name="function"/>
1960          <xsl:text>&#xd;```&#xd;</xsl:text>
1961        </xsl:when>
1962      </xsl:choose>
1963      <xsl:text>&#xd;[heading Description]&#xd;</xsl:text>
1964      <xsl:apply-templates select="detaileddescription" mode="markup"/>
1965      <xsl:if test="$debug &gt; 1">
1966        <xsl:text>[heading Debug]&#xd;[table [[name][value]]</xsl:text>
1967        <xsl:value-of select="concat('[[name][', $name, ']]&#xd;')"/>
1968        <xsl:value-of select="concat('[[display-name][', $display-name, ']]&#xd;')"/>
1969        <xsl:value-of select="concat('[[unqualified-name][', $unqualified-name, ']]&#xd;')"/>
1970        <xsl:value-of select="concat('[[id][', $id, ']]&#xd;')"/>
1971        <xsl:value-of select="concat('[[doxygen-id][', $doxygen-id, ']]&#xd;')"/>
1972        <xsl:value-of select="concat('[[overload-count][', $overload-count, ']]&#xd;')"/>
1973        <xsl:value-of select="concat('[[overload-position][', $overload-position, ']]]&#xd;')"/>
1974      </xsl:if>
1975    </xsl:otherwise>
1976  </xsl:choose>
1977  <xsl:if test="$overload-count &gt;= 1">
1978    <xsl:call-template name="includes-foot">
1979      <xsl:with-param name="file" select="location/@file"/>
1980    </xsl:call-template>
1981  </xsl:if>
1982  <xsl:choose>
1983    <xsl:when test="$overload-count &gt; 1 and $overload-position = $overload-count">
1984      <xsl:text>[endsect]&#xd;[endsect]&#xd;&#xd;&#xd;&#xd;</xsl:text>
1985    </xsl:when>
1986    <xsl:otherwise>
1987      <xsl:text>[endsect]&#xd;</xsl:text>
1988    </xsl:otherwise>
1989  </xsl:choose>
1990</xsl:template>
1991
1992</xsl:stylesheet>
1993