1<?xml version='1.0'?>
2<!DOCTYPE xsl:stylesheet [
3<!ENTITY nbsp "&#160;">
4]>
5<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6                version='1.0'>
7
8<!-- ********************************************************************
9     $Id$
10     ********************************************************************
11
12     This file is part of the XSL DocBook Stylesheet distribution.
13     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
14     and other information.
15
16     ******************************************************************** -->
17
18<!-- ==================================================================== -->
19
20<!-- synopsis is in verbatim -->
21
22<!-- ==================================================================== -->
23
24<xsl:template match="cmdsynopsis">
25  <div class="{name(.)}">
26    <p>
27      <xsl:call-template name="anchor"/>
28      <xsl:apply-templates/>
29    </p>
30  </div>
31</xsl:template>
32
33<xsl:template match="cmdsynopsis/command">
34  <br/>
35  <xsl:call-template name="inline.monoseq"/>
36  <xsl:text> </xsl:text>
37</xsl:template>
38
39<xsl:template match="cmdsynopsis/command[1]" priority="2">
40  <xsl:call-template name="inline.monoseq"/>
41  <xsl:text> </xsl:text>
42</xsl:template>
43
44<xsl:template match="group|arg" name="group-or-arg">
45  <xsl:variable name="choice" select="@choice"/>
46  <xsl:variable name="rep" select="@rep"/>
47  <xsl:variable name="sepchar">
48    <xsl:choose>
49      <xsl:when test="ancestor-or-self::*/@sepchar">
50        <xsl:value-of select="ancestor-or-self::*/@sepchar"/>
51      </xsl:when>
52      <xsl:otherwise>
53        <xsl:text> </xsl:text>
54      </xsl:otherwise>
55    </xsl:choose>
56  </xsl:variable>
57
58  <xsl:if test="preceding-sibling::*">
59    <xsl:value-of select="$sepchar"/>
60  </xsl:if>
61  <xsl:choose>
62    <xsl:when test="$choice='plain'">
63      <xsl:value-of select="$arg.choice.plain.open.str"/>
64    </xsl:when>
65    <xsl:when test="$choice='req'">
66      <xsl:value-of select="$arg.choice.req.open.str"/>
67    </xsl:when>
68    <xsl:when test="$choice='opt'">
69      <xsl:value-of select="$arg.choice.opt.open.str"/>
70    </xsl:when>
71    <xsl:otherwise>
72      <xsl:value-of select="$arg.choice.def.open.str"/>
73    </xsl:otherwise>
74  </xsl:choose>
75  <xsl:apply-templates/>
76  <xsl:choose>
77    <xsl:when test="$rep='repeat'">
78      <xsl:value-of select="$arg.rep.repeat.str"/>
79    </xsl:when>
80    <xsl:when test="$rep='norepeat'">
81      <xsl:value-of select="$arg.rep.norepeat.str"/>
82    </xsl:when>
83    <xsl:otherwise>
84      <xsl:value-of select="$arg.rep.def.str"/>
85    </xsl:otherwise>
86  </xsl:choose>
87  <xsl:choose>
88    <xsl:when test="$choice='plain'">
89      <xsl:value-of select="$arg.choice.plain.close.str"/>
90    </xsl:when>
91    <xsl:when test="$choice='req'">
92      <xsl:value-of select="$arg.choice.req.close.str"/>
93    </xsl:when>
94    <xsl:when test="$choice='opt'">
95      <xsl:value-of select="$arg.choice.opt.close.str"/>
96    </xsl:when>
97    <xsl:otherwise>
98      <xsl:value-of select="$arg.choice.def.close.str"/>
99    </xsl:otherwise>
100  </xsl:choose>
101</xsl:template>
102
103<xsl:template match="group/arg">
104  <xsl:variable name="choice" select="@choice"/>
105  <xsl:variable name="rep" select="@rep"/>
106  <xsl:if test="preceding-sibling::*">
107    <xsl:value-of select="$arg.or.sep"/>
108  </xsl:if>
109  <xsl:call-template name="group-or-arg"/>
110</xsl:template>
111
112<xsl:template match="sbr">
113  <br/>
114</xsl:template>
115
116<!-- ==================================================================== -->
117
118<xsl:template match="synopfragmentref">
119  <xsl:variable name="target" select="key('id',@linkend)"/>
120  <xsl:variable name="snum">
121    <xsl:apply-templates select="$target" mode="synopfragment.number"/>
122  </xsl:variable>
123  <i>
124    <a href="#{@linkend}">
125      <xsl:text>(</xsl:text>
126      <xsl:value-of select="$snum"/>
127      <xsl:text>)</xsl:text>
128    </a>
129    <xsl:text>&#160;</xsl:text>
130    <xsl:apply-templates/>
131  </i>
132</xsl:template>
133
134<xsl:template match="synopfragment" mode="synopfragment.number">
135  <xsl:number format="1"/>
136</xsl:template>
137
138<xsl:template match="synopfragment">
139  <xsl:variable name="snum">
140    <xsl:apply-templates select="." mode="synopfragment.number"/>
141  </xsl:variable>
142  <p>
143    <a name="{@id}">
144      <xsl:text>(</xsl:text>
145      <xsl:value-of select="$snum"/>
146      <xsl:text>)</xsl:text>
147    </a>
148    <xsl:text> </xsl:text>
149    <xsl:apply-templates/>
150  </p>
151</xsl:template>
152
153<xsl:template match="funcsynopsis">
154  <xsl:call-template name="informal.object"/>
155</xsl:template>
156
157<xsl:template match="funcsynopsisinfo">
158  <pre class="{name(.)}"><xsl:apply-templates/></pre>
159</xsl:template>
160
161<!-- ====================================================================== -->
162<!-- funcprototype -->
163<!--
164
165funcprototype ::= (funcdef,
166                   (void|varargs|paramdef+))
167
168funcdef       ::= (#PCDATA|type|replaceable|function)*
169
170paramdef      ::= (#PCDATA|type|replaceable|parameter|funcparams)*
171-->
172
173<xsl:template match="funcprototype">
174  <xsl:variable name="html-style">
175    <xsl:call-template name="dbhtml-attribute">
176      <xsl:with-param name="pis"
177                      select="ancestor::funcsynopsis//processing-instruction('dbhtml')"/>
178      <xsl:with-param name="attribute" select="'funcsynopsis-style'"/>
179    </xsl:call-template>
180  </xsl:variable>
181
182  <xsl:variable name="style">
183    <xsl:choose>
184      <xsl:when test="$html-style != ''">
185        <xsl:value-of select="$html-style"/>
186      </xsl:when>
187      <xsl:otherwise>
188        <xsl:value-of select="$funcsynopsis.style"/>
189      </xsl:otherwise>
190    </xsl:choose>
191  </xsl:variable>
192
193<!--
194  <xsl:variable name="tabular-p"
195                select="$funcsynopsis.tabular.threshold &gt; 0
196                        and string-length(.) &gt; $funcsynopsis.tabular.threshold"/>
197-->
198
199  <xsl:variable name="tabular-p" select="true()"/>
200
201  <xsl:choose>
202    <xsl:when test="$style = 'kr' and $tabular-p">
203      <xsl:apply-templates select="." mode="kr-tabular"/>
204    </xsl:when>
205    <xsl:when test="$style = 'kr'">
206      <xsl:apply-templates select="." mode="kr-nontabular"/>
207    </xsl:when>
208    <xsl:when test="$style = 'ansi' and $tabular-p">
209      <xsl:apply-templates select="." mode="ansi-tabular"/>
210    </xsl:when>
211    <xsl:otherwise>
212      <xsl:apply-templates select="." mode="ansi-nontabular"/>
213    </xsl:otherwise>
214  </xsl:choose>
215</xsl:template>
216
217<!-- ====================================================================== -->
218<!-- funcprototype: kr, non-tabular -->
219
220<xsl:template match="funcprototype" mode="kr-nontabular">
221  <p>
222    <xsl:apply-templates mode="kr-nontabular"/>
223    <xsl:if test="paramdef">
224      <br/>
225      <xsl:apply-templates select="paramdef" mode="kr-funcsynopsis-mode"/>
226    </xsl:if>
227  </p>
228</xsl:template>
229
230<xsl:template match="funcdef" mode="kr-nontabular">
231  <code class="{name(.)}">
232    <xsl:apply-templates mode="kr-nontabular"/>
233    <xsl:text>(</xsl:text>
234  </code>
235</xsl:template>
236
237<xsl:template match="funcdef/function" mode="kr-nontabular">
238  <xsl:choose>
239    <xsl:when test="$funcsynopsis.decoration != 0">
240      <b class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></b>
241    </xsl:when>
242    <xsl:otherwise>
243      <xsl:apply-templates mode="kr-nontabular"/>
244    </xsl:otherwise>
245  </xsl:choose>
246</xsl:template>
247
248<xsl:template match="void" mode="kr-nontabular">
249  <code>)</code>
250  <xsl:text>;</xsl:text>
251</xsl:template>
252
253<xsl:template match="varargs" mode="kr-nontabular">
254  <xsl:text>...</xsl:text>
255  <code>)</code>
256  <xsl:text>;</xsl:text>
257</xsl:template>
258
259<xsl:template match="paramdef" mode="kr-nontabular">
260  <xsl:apply-templates select="parameter" mode="kr-nontabular"/>
261  <xsl:choose>
262    <xsl:when test="following-sibling::*">
263      <xsl:text>, </xsl:text>
264    </xsl:when>
265    <xsl:otherwise>
266      <code>)</code>
267      <xsl:text>;</xsl:text>
268    </xsl:otherwise>
269  </xsl:choose>
270</xsl:template>
271
272<xsl:template match="paramdef/parameter" mode="kr-nontabular">
273  <xsl:choose>
274    <xsl:when test="$funcsynopsis.decoration != 0">
275      <var class="pdparam">
276        <xsl:apply-templates mode="kr-nontabular"/>
277      </var>
278    </xsl:when>
279    <xsl:otherwise>
280      <code>
281	<xsl:apply-templates mode="kr-nontabular"/>
282      </code>
283    </xsl:otherwise>
284  </xsl:choose>
285</xsl:template>
286
287<xsl:template match="paramdef" mode="kr-funcsynopsis-mode">
288  <xsl:if test="preceding-sibling::paramdef"><br/></xsl:if>
289  <code>
290    <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
291  </code>
292  <xsl:text>;</xsl:text>
293</xsl:template>
294
295<xsl:template match="paramdef/parameter" mode="kr-funcsynopsis-mode">
296  <xsl:choose>
297    <xsl:when test="$funcsynopsis.decoration != 0">
298      <var class="pdparam">
299        <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
300      </var>
301    </xsl:when>
302    <xsl:otherwise>
303      <code>
304	<xsl:apply-templates mode="kr-funcsynopsis-mode"/>
305      </code>
306    </xsl:otherwise>
307  </xsl:choose>
308</xsl:template>
309
310<xsl:template match="funcparams" mode="kr-funcsynopsis-mode">
311  <code>(</code>
312  <xsl:apply-templates mode="kr-funcsynopsis-mode"/>
313  <code>)</code>
314</xsl:template>
315
316<!-- ====================================================================== -->
317<!-- funcprototype: kr, tabular -->
318
319<xsl:template match="funcprototype" mode="kr-tabular">
320  <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"
321         style="padding-bottom: 1em">
322    <tr>
323      <td>
324        <xsl:apply-templates select="funcdef" mode="kr-tabular"/>
325      </td>
326      <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="kr-tabular"/>
327    </tr>
328    <xsl:for-each select="(void|varargs|paramdef)[preceding-sibling::*[not(self::funcdef)]]">
329      <tr>
330        <td>&#160;</td>
331        <xsl:apply-templates select="." mode="kr-tabular"/>
332      </tr>
333    </xsl:for-each>
334  </table>
335  <xsl:if test="paramdef">
336    <table border="0" summary="Function argument synopsis"
337           cellspacing="0" cellpadding="0">
338      <xsl:if test="following-sibling::funcprototype">
339        <xsl:attribute name="style">padding-bottom: 1em</xsl:attribute>
340      </xsl:if>
341      <xsl:apply-templates select="paramdef" mode="kr-tabular-funcsynopsis-mode"/>
342    </table>
343  </xsl:if>
344</xsl:template>
345
346<xsl:template match="funcdef" mode="kr-tabular">
347  <code class="{name(.)}">
348    <xsl:apply-templates mode="kr-tabular"/>
349    <xsl:text>(</xsl:text>
350  </code>
351</xsl:template>
352
353<xsl:template match="funcdef/function" mode="kr-tabular">
354  <xsl:choose>
355    <xsl:when test="$funcsynopsis.decoration != 0">
356      <b class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></b>
357    </xsl:when>
358    <xsl:otherwise>
359      <xsl:apply-templates mode="kr-tabular"/>
360    </xsl:otherwise>
361  </xsl:choose>
362</xsl:template>
363
364<xsl:template match="void" mode="kr-tabular">
365  <td>
366    <code>)</code>
367    <xsl:text>;</xsl:text>
368  </td>
369  <td>&#160;</td>
370</xsl:template>
371
372<xsl:template match="varargs" mode="kr-tabular">
373  <td>
374    <xsl:text>...</xsl:text>
375    <code>)</code>
376    <xsl:text>;</xsl:text>
377  </td>
378  <td>&#160;</td>
379</xsl:template>
380
381<xsl:template match="paramdef" mode="kr-tabular">
382  <td>
383    <xsl:apply-templates select="parameter" mode="kr-tabular"/>
384    <xsl:choose>
385      <xsl:when test="following-sibling::*">
386	<xsl:text>, </xsl:text>
387      </xsl:when>
388      <xsl:otherwise>
389	<code>)</code>
390	<xsl:text>;</xsl:text>
391      </xsl:otherwise>
392    </xsl:choose>
393  </td>
394  <td>&#160;</td>
395</xsl:template>
396
397<xsl:template match="paramdef/parameter" mode="kr-tabular">
398  <xsl:choose>
399    <xsl:when test="$funcsynopsis.decoration != 0">
400      <var class="pdparam">
401        <xsl:apply-templates mode="kr-tabular"/>
402      </var>
403    </xsl:when>
404    <xsl:otherwise>
405      <code>
406	<xsl:apply-templates mode="kr-tabular"/>
407      </code>
408    </xsl:otherwise>
409  </xsl:choose>
410</xsl:template>
411
412<xsl:template match="paramdef" mode="kr-tabular-funcsynopsis-mode">
413  <xsl:variable name="type">
414    <xsl:choose>
415      <xsl:when test="type">
416	<xsl:apply-templates select="type"
417			     mode="kr-tabular-funcsynopsis-mode"/>
418      </xsl:when>
419      <xsl:when test="normalize-space(parameter/preceding-sibling::node()[not(self::parameter)]) != ''">
420	<xsl:copy-of select="parameter/preceding-sibling::node()[not(self::parameter)]"/>
421      </xsl:when>
422    </xsl:choose>
423  </xsl:variable>
424
425  <tr>
426    <xsl:choose>
427      <xsl:when test="$type != '' and funcparams">
428        <td>
429	  <code>
430	    <xsl:copy-of select="$type"/>
431	  </code>
432          <xsl:text>&#160;</xsl:text>
433        </td>
434        <td>
435	  <code>
436	    <xsl:choose>
437	      <xsl:when test="type">
438		<xsl:apply-templates select="type/following-sibling::*"
439				     mode="kr-tabular-funcsynopsis-mode"/>
440	      </xsl:when>
441	      <xsl:otherwise>
442		<xsl:apply-templates select="*"
443				     mode="kr-tabular-funcsynopsis-mode"/>
444	      </xsl:otherwise>
445	    </xsl:choose>
446	  </code>
447        </td>
448      </xsl:when>
449
450      <xsl:when test="funcparams">
451        <td colspan="2">
452	  <code>
453	    <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
454	  </code>
455        </td>
456      </xsl:when>
457
458      <xsl:otherwise>
459        <td>
460	  <code>
461	    <xsl:apply-templates select="parameter/preceding-sibling::node()[not(self::parameter)]"
462				 mode="kr-tabular-funcsynopsis-mode"/>
463	  </code>
464          <xsl:text>&#160;</xsl:text>
465        </td>
466        <td>
467	  <code>
468	    <xsl:apply-templates select="parameter"
469				 mode="kr-tabular"/>
470	    <xsl:apply-templates select="parameter/following-sibling::*[not(self::parameter)]"
471				 mode="kr-tabular-funcsynopsis-mode"/>
472	    <xsl:text>;</xsl:text>
473	  </code>
474        </td>
475      </xsl:otherwise>
476    </xsl:choose>
477  </tr>
478</xsl:template>
479
480<xsl:template match="paramdef/parameter" mode="kr-tabular-funcsynopsis-mode">
481  <xsl:choose>
482    <xsl:when test="$funcsynopsis.decoration != 0">
483      <var class="pdparam">
484        <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
485      </var>
486    </xsl:when>
487    <xsl:otherwise>
488      <code>
489	<xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
490      </code>
491    </xsl:otherwise>
492  </xsl:choose>
493</xsl:template>
494
495<xsl:template match="funcparams" mode="kr-tabular-funcsynopsis-mode">
496  <code>(</code>
497  <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/>
498  <code>)</code>
499  <xsl:text>;</xsl:text>
500</xsl:template>
501
502<!-- ====================================================================== -->
503<!-- funcprototype: ansi, non-tabular -->
504
505<xsl:template match="funcprototype" mode="ansi-nontabular">
506  <p>
507    <xsl:apply-templates mode="ansi-nontabular"/>
508  </p>
509</xsl:template>
510
511<xsl:template match="funcdef" mode="ansi-nontabular">
512  <code class="{name(.)}">
513    <xsl:apply-templates mode="ansi-nontabular"/>
514    <xsl:text>(</xsl:text>
515  </code>
516</xsl:template>
517
518<xsl:template match="funcdef/function" mode="ansi-nontabular">
519  <xsl:choose>
520    <xsl:when test="$funcsynopsis.decoration != 0">
521      <b class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></b>
522    </xsl:when>
523    <xsl:otherwise>
524      <xsl:apply-templates mode="ansi-nontabular"/>
525    </xsl:otherwise>
526  </xsl:choose>
527</xsl:template>
528
529<xsl:template match="void" mode="ansi-nontabular">
530  <code>void)</code>
531  <xsl:text>;</xsl:text>
532</xsl:template>
533
534<xsl:template match="varargs" mode="ansi-nontabular">
535  <xsl:text>...</xsl:text>
536  <code>)</code>
537  <xsl:text>;</xsl:text>
538</xsl:template>
539
540<xsl:template match="paramdef" mode="ansi-nontabular">
541  <xsl:apply-templates mode="ansi-nontabular"/>
542  <xsl:choose>
543    <xsl:when test="following-sibling::*">
544      <xsl:text>, </xsl:text>
545    </xsl:when>
546    <xsl:otherwise>
547      <code>)</code>
548      <xsl:text>;</xsl:text>
549    </xsl:otherwise>
550  </xsl:choose>
551</xsl:template>
552
553<xsl:template match="paramdef/parameter" mode="ansi-nontabular">
554  <xsl:choose>
555    <xsl:when test="$funcsynopsis.decoration != 0">
556      <var class="pdparam">
557        <xsl:apply-templates mode="ansi-nontabular"/>
558      </var>
559    </xsl:when>
560    <xsl:otherwise>
561      <code>
562	<xsl:apply-templates mode="ansi-nontabular"/>
563      </code>
564    </xsl:otherwise>
565  </xsl:choose>
566</xsl:template>
567
568<xsl:template match="funcparams" mode="ansi-nontabular">
569  <code>(</code>
570  <xsl:apply-templates mode="ansi-nontabular"/>
571  <code>)</code>
572</xsl:template>
573
574<!-- ====================================================================== -->
575<!-- funcprototype: ansi, tabular -->
576
577<xsl:template match="funcprototype" mode="ansi-tabular">
578  <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
579    <xsl:if test="following-sibling::funcprototype">
580      <xsl:attribute name="style">padding-bottom: 1em</xsl:attribute>
581    </xsl:if>
582    <tr>
583      <td>
584        <xsl:apply-templates select="funcdef" mode="ansi-tabular"/>
585      </td>
586      <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="ansi-tabular"/>
587    </tr>
588    <xsl:for-each select="(void|varargs|paramdef)[preceding-sibling::*[not(self::funcdef)]]">
589      <tr>
590        <td>&#160;</td>
591        <xsl:apply-templates select="." mode="ansi-tabular"/>
592      </tr>
593    </xsl:for-each>
594  </table>
595</xsl:template>
596
597<xsl:template match="funcdef" mode="ansi-tabular">
598  <code class="{name(.)}">
599    <xsl:apply-templates mode="ansi-tabular"/>
600    <xsl:text>(</xsl:text>
601  </code>
602</xsl:template>
603
604<xsl:template match="funcdef/function" mode="ansi-tabular">
605  <xsl:choose>
606    <xsl:when test="$funcsynopsis.decoration != 0">
607      <b class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></b>
608    </xsl:when>
609    <xsl:otherwise>
610      <xsl:apply-templates mode="kr-tabular"/>
611    </xsl:otherwise>
612  </xsl:choose>
613</xsl:template>
614
615<xsl:template match="void" mode="ansi-tabular">
616  <td>
617    <code>void)</code>
618    <xsl:text>;</xsl:text>
619  </td>
620  <td>&#160;</td>
621</xsl:template>
622
623<xsl:template match="varargs" mode="ansi-tabular">
624  <td>
625    <xsl:text>...</xsl:text>
626    <code>)</code>
627    <xsl:text>;</xsl:text>
628  </td>
629  <td>&#160;</td>
630</xsl:template>
631
632<xsl:template match="paramdef" mode="ansi-tabular">
633  <xsl:variable name="type">
634    <xsl:choose>
635      <xsl:when test="type">
636	<xsl:apply-templates select="type"
637			     mode="ansi-tabular"/>
638      </xsl:when>
639      <xsl:when test="normalize-space(parameter/preceding-sibling::node()[not(self::parameter)]) != ''">
640	<xsl:copy-of select="parameter/preceding-sibling::node()[not(self::parameter)]"/>
641      </xsl:when>
642    </xsl:choose>
643  </xsl:variable>
644
645  <xsl:choose>
646    <xsl:when test="$type != '' and funcparams">
647      <td>
648	<xsl:copy-of select="$type"/>
649        <xsl:text>&#160;</xsl:text>
650      </td>
651      <td>
652	<xsl:choose>
653	  <xsl:when test="type">
654	    <xsl:apply-templates select="type/following-sibling::*"
655				 mode="ansi-tabular"/>
656	  </xsl:when>
657	  <xsl:otherwise>
658	    <xsl:apply-templates select="*"
659				 mode="ansi-tabular"/>
660	  </xsl:otherwise>
661	</xsl:choose>
662        <xsl:choose>
663          <xsl:when test="following-sibling::*">
664            <xsl:text>, </xsl:text>
665          </xsl:when>
666          <xsl:otherwise>
667            <code>)</code>
668            <xsl:text>;</xsl:text>
669          </xsl:otherwise>
670        </xsl:choose>
671      </td>
672    </xsl:when>
673    <xsl:otherwise>
674      <td>
675        <xsl:apply-templates select="parameter/preceding-sibling::node()[not(self::parameter)]"
676                             mode="ansi-tabular"/>
677        <xsl:text>&#160;</xsl:text>
678      </td>
679      <td>
680        <xsl:apply-templates select="parameter"
681                             mode="ansi-tabular"/>
682        <xsl:apply-templates select="parameter/following-sibling::*[not(self::parameter)]"
683                             mode="ansi-tabular"/>
684        <xsl:choose>
685          <xsl:when test="following-sibling::*">
686            <xsl:text>, </xsl:text>
687          </xsl:when>
688          <xsl:otherwise>
689            <code>)</code>
690            <xsl:text>;</xsl:text>
691          </xsl:otherwise>
692        </xsl:choose>
693      </td>
694    </xsl:otherwise>
695  </xsl:choose>
696</xsl:template>
697
698<xsl:template match="paramdef/parameter" mode="ansi-tabular">
699  <xsl:choose>
700    <xsl:when test="$funcsynopsis.decoration != 0">
701      <var class="pdparam">
702        <xsl:apply-templates mode="ansi-tabular"/>
703      </var>
704    </xsl:when>
705    <xsl:otherwise>
706      <code>
707	<xsl:apply-templates mode="ansi-tabular"/>
708      </code>
709    </xsl:otherwise>
710  </xsl:choose>
711</xsl:template>
712
713<xsl:template match="funcparams" mode="ansi-tabular">
714  <code>(</code>
715  <xsl:apply-templates/>
716  <code>)</code>
717</xsl:template>
718
719<!-- ====================================================================== -->
720
721<xsl:variable name="default-classsynopsis-language">java</xsl:variable>
722
723<xsl:template match="classsynopsis
724                     |fieldsynopsis
725                     |methodsynopsis
726                     |constructorsynopsis
727                     |destructorsynopsis">
728  <xsl:param name="language">
729    <xsl:choose>
730      <xsl:when test="@language">
731	<xsl:value-of select="@language"/>
732      </xsl:when>
733      <xsl:when test="$language">
734	<xsl:value-of select="$language"/>
735      </xsl:when>
736      <xsl:otherwise>
737	<xsl:value-of select="$default-classsynopsis-language"/>
738      </xsl:otherwise>
739    </xsl:choose>
740  </xsl:param>
741
742  <xsl:choose>
743    <xsl:when test="$language='java'">
744      <xsl:apply-templates select="." mode="java"/>
745    </xsl:when>
746    <xsl:when test="$language='perl'">
747      <xsl:apply-templates select="." mode="perl"/>
748    </xsl:when>
749    <xsl:when test="$language='idl'">
750      <xsl:apply-templates select="." mode="idl"/>
751    </xsl:when>
752    <xsl:when test="$language='cpp'">
753      <xsl:apply-templates select="." mode="cpp"/>
754    </xsl:when>
755    <xsl:otherwise>
756      <xsl:message>
757	<xsl:text>Unrecognized language on </xsl:text>
758        <xsl:value-of select="name(.)"/>
759        <xsl:text>: </xsl:text>
760	<xsl:value-of select="$language"/>
761      </xsl:message>
762      <xsl:apply-templates select=".">
763	<xsl:with-param name="language"
764	  select="$default-classsynopsis-language"/>
765      </xsl:apply-templates>
766    </xsl:otherwise>
767  </xsl:choose>
768</xsl:template>
769
770<xsl:template name="synop-break">
771  <xsl:if test="parent::classsynopsis
772                or (following-sibling::fieldsynopsis
773                    |following-sibling::methodsynopsis
774                    |following-sibling::constructorsynopsis
775                    |following-sibling::destructorsynopsis)">
776    <br/>
777  </xsl:if>
778</xsl:template>
779
780
781<!-- ===== Java ======================================================== -->
782
783<xsl:template match="classsynopsis" mode="java">
784  <pre class="{name(.)}">
785    <xsl:apply-templates select="ooclass[1]" mode="java"/>
786    <xsl:if test="ooclass[preceding-sibling::*]">
787      <xsl:text> extends</xsl:text>
788      <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="java"/>
789      <xsl:if test="oointerface|ooexception">
790        <br/>
791	<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
792      </xsl:if>
793    </xsl:if>
794    <xsl:if test="oointerface">
795      <xsl:text>implements</xsl:text>
796      <xsl:apply-templates select="oointerface" mode="java"/>
797      <xsl:if test="ooexception">
798        <br/>
799	<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
800      </xsl:if>
801    </xsl:if>
802    <xsl:if test="ooexception">
803      <xsl:text>throws</xsl:text>
804      <xsl:apply-templates select="ooexception" mode="java"/>
805    </xsl:if>
806    <xsl:text>&nbsp;{</xsl:text>
807    <br/>
808    <xsl:apply-templates select="constructorsynopsis
809                                 |destructorsynopsis
810                                 |fieldsynopsis
811                                 |methodsynopsis
812                                 |classsynopsisinfo" mode="java"/>
813    <xsl:text>}</xsl:text>
814  </pre>
815</xsl:template>
816
817<xsl:template match="classsynopsisinfo" mode="java">
818  <xsl:apply-templates mode="java"/>
819</xsl:template>
820
821<xsl:template match="ooclass|oointerface|ooexception" mode="java">
822  <xsl:choose>
823    <xsl:when test="preceding-sibling::*">
824      <xsl:text>, </xsl:text>
825    </xsl:when>
826    <xsl:otherwise>
827      <xsl:text> </xsl:text>
828    </xsl:otherwise>
829  </xsl:choose>
830  <span class="{name(.)}">
831    <xsl:apply-templates mode="java"/>
832  </span>
833</xsl:template>
834
835<xsl:template match="modifier" mode="java">
836  <span class="{name(.)}">
837    <xsl:apply-templates mode="java"/>
838    <xsl:if test="following-sibling::*">
839      <xsl:text>&nbsp;</xsl:text>
840    </xsl:if>
841  </span>
842</xsl:template>
843
844<xsl:template match="classname" mode="java">
845  <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
846    <xsl:text>, </xsl:text>
847  </xsl:if>
848  <span class="{name(.)}">
849    <xsl:apply-templates mode="java"/>
850  </span>
851</xsl:template>
852
853<xsl:template match="interfacename" mode="java">
854  <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
855    <xsl:text>, </xsl:text>
856  </xsl:if>
857  <span class="{name(.)}">
858    <xsl:apply-templates mode="java"/>
859  </span>
860</xsl:template>
861
862<xsl:template match="exceptionname" mode="java">
863  <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
864    <xsl:text>, </xsl:text>
865  </xsl:if>
866  <span class="{name(.)}">
867    <xsl:apply-templates mode="java"/>
868  </span>
869</xsl:template>
870
871<xsl:template match="fieldsynopsis" mode="java">
872  <code class="{name(.)}">
873    <xsl:if test="parent::classsynopsis">
874      <xsl:text>&nbsp;&nbsp;</xsl:text>
875    </xsl:if>
876    <xsl:apply-templates mode="java"/>
877    <xsl:text>;</xsl:text>
878  </code>
879  <xsl:call-template name="synop-break"/>
880</xsl:template>
881
882<xsl:template match="type" mode="java">
883  <span class="{name(.)}">
884    <xsl:apply-templates mode="java"/>
885    <xsl:text>&nbsp;</xsl:text>
886  </span>
887</xsl:template>
888
889<xsl:template match="varname" mode="java">
890  <span class="{name(.)}">
891    <xsl:apply-templates mode="java"/>
892    <xsl:text>&nbsp;</xsl:text>
893  </span>
894</xsl:template>
895
896<xsl:template match="initializer" mode="java">
897  <span class="{name(.)}">
898    <xsl:text>=&nbsp;</xsl:text>
899    <xsl:apply-templates mode="java"/>
900  </span>
901</xsl:template>
902
903<xsl:template match="void" mode="java">
904  <span class="{name(.)}">
905    <xsl:text>void&nbsp;</xsl:text>
906  </span>
907</xsl:template>
908
909<xsl:template match="methodname" mode="java">
910  <span class="{name(.)}">
911    <xsl:apply-templates mode="java"/>
912  </span>
913</xsl:template>
914
915<xsl:template match="methodparam" mode="java">
916  <xsl:param name="indent">0</xsl:param>
917  <xsl:if test="preceding-sibling::methodparam">
918    <xsl:text>,</xsl:text>
919    <br/>
920    <xsl:if test="$indent &gt; 0">
921      <xsl:call-template name="copy-string">
922	<xsl:with-param name="string">&nbsp;</xsl:with-param>
923	<xsl:with-param name="count" select="$indent + 1"/>
924      </xsl:call-template>
925    </xsl:if>
926  </xsl:if>
927  <span class="{name(.)}">
928    <xsl:apply-templates mode="java"/>
929  </span>
930</xsl:template>
931
932<xsl:template match="parameter" mode="java">
933  <span class="{name(.)}">
934    <xsl:apply-templates mode="java"/>
935  </span>
936</xsl:template>
937
938<xsl:template mode="java"
939  match="constructorsynopsis|destructorsynopsis|methodsynopsis">
940  <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[name(.) != 'modifier']]"/>
941  <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
942  <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[name(.) != 'modifier']]"/>
943  <xsl:variable name="decl">
944    <xsl:if test="parent::classsynopsis">
945      <xsl:text>&nbsp;&nbsp;</xsl:text>
946    </xsl:if>
947    <xsl:apply-templates select="$start-modifiers" mode="java"/>
948
949    <!-- type -->
950    <xsl:if test="name($notmod[1]) != 'methodname'">
951      <xsl:apply-templates select="$notmod[1]" mode="java"/>
952    </xsl:if>
953
954    <xsl:apply-templates select="methodname" mode="java"/>
955  </xsl:variable>
956
957  <code class="{name(.)}">
958    <xsl:copy-of select="$decl"/>
959    <xsl:text>(</xsl:text>
960    <xsl:apply-templates select="methodparam" mode="java">
961      <xsl:with-param name="indent" select="string-length($decl)"/>
962    </xsl:apply-templates>
963    <xsl:text>)</xsl:text>
964    <xsl:if test="exceptionname">
965      <br/>
966      <xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;throws&nbsp;</xsl:text>
967      <xsl:apply-templates select="exceptionname" mode="java"/>
968    </xsl:if>
969    <xsl:if test="modifier[preceding-sibling::*[name(.) != 'modifier']]">
970      <xsl:text> </xsl:text>
971      <xsl:apply-templates select="$end-modifiers" mode="java"/>
972    </xsl:if>
973    <xsl:text>;</xsl:text>
974  </code>
975  <xsl:call-template name="synop-break"/>
976</xsl:template>
977
978<!-- ===== C++ ========================================================= -->
979
980<xsl:template match="classsynopsis" mode="cpp">
981  <pre class="{name(.)}">
982    <xsl:apply-templates select="ooclass[1]" mode="cpp"/>
983    <xsl:if test="ooclass[preceding-sibling::*]">
984      <xsl:text>: </xsl:text>
985      <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="cpp"/>
986      <xsl:if test="oointerface|ooexception">
987        <br/>
988	<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
989      </xsl:if>
990    </xsl:if>
991    <xsl:if test="oointerface">
992      <xsl:text> implements</xsl:text>
993      <xsl:apply-templates select="oointerface" mode="cpp"/>
994      <xsl:if test="ooexception">
995        <br/>
996	<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
997      </xsl:if>
998    </xsl:if>
999    <xsl:if test="ooexception">
1000      <xsl:text> throws</xsl:text>
1001      <xsl:apply-templates select="ooexception" mode="cpp"/>
1002    </xsl:if>
1003    <xsl:text>&nbsp;{</xsl:text>
1004    <br/>
1005    <xsl:apply-templates select="constructorsynopsis
1006                                 |destructorsynopsis
1007                                 |fieldsynopsis
1008                                 |methodsynopsis
1009                                 |classsynopsisinfo" mode="cpp"/>
1010    <xsl:text>}</xsl:text>
1011  </pre>
1012</xsl:template>
1013
1014<xsl:template match="classsynopsisinfo" mode="cpp">
1015  <xsl:apply-templates mode="cpp"/>
1016</xsl:template>
1017
1018<xsl:template match="ooclass|oointerface|ooexception" mode="cpp">
1019  <xsl:if test="preceding-sibling::*">
1020    <xsl:text>, </xsl:text>
1021  </xsl:if>
1022  <span class="{name(.)}">
1023    <xsl:apply-templates mode="cpp"/>
1024  </span>
1025</xsl:template>
1026
1027<xsl:template match="modifier" mode="cpp">
1028  <span class="{name(.)}">
1029    <xsl:apply-templates mode="cpp"/>
1030    <xsl:if test="following-sibling::*">
1031      <xsl:text>&nbsp;</xsl:text>
1032    </xsl:if>
1033  </span>
1034</xsl:template>
1035
1036<xsl:template match="classname" mode="cpp">
1037  <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
1038    <xsl:text>, </xsl:text>
1039  </xsl:if>
1040  <span class="{name(.)}">
1041    <xsl:apply-templates mode="cpp"/>
1042  </span>
1043</xsl:template>
1044
1045<xsl:template match="interfacename" mode="cpp">
1046  <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
1047    <xsl:text>, </xsl:text>
1048  </xsl:if>
1049  <span class="{name(.)}">
1050    <xsl:apply-templates mode="cpp"/>
1051  </span>
1052</xsl:template>
1053
1054<xsl:template match="exceptionname" mode="cpp">
1055  <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
1056    <xsl:text>, </xsl:text>
1057  </xsl:if>
1058  <span class="{name(.)}">
1059    <xsl:apply-templates mode="cpp"/>
1060  </span>
1061</xsl:template>
1062
1063<xsl:template match="fieldsynopsis" mode="cpp">
1064  <code class="{name(.)}">
1065    <xsl:if test="parent::classsynopsis">
1066      <xsl:text>&nbsp;&nbsp;</xsl:text>
1067    </xsl:if>
1068    <xsl:apply-templates mode="cpp"/>
1069    <xsl:text>;</xsl:text>
1070  </code>
1071  <xsl:call-template name="synop-break"/>
1072</xsl:template>
1073
1074<xsl:template match="type" mode="cpp">
1075  <span class="{name(.)}">
1076    <xsl:apply-templates mode="cpp"/>
1077    <xsl:if test="substring(., string-length(.)) != '*'">
1078	<xsl:text>&nbsp;</xsl:text>
1079    </xsl:if>
1080  </span>
1081</xsl:template>
1082
1083<xsl:template match="varname" mode="cpp">
1084  <span class="{name(.)}">
1085    <xsl:apply-templates mode="cpp"/>
1086    <xsl:text>&nbsp;</xsl:text>
1087  </span>
1088</xsl:template>
1089
1090<xsl:template match="initializer" mode="cpp">
1091  <span class="{name(.)}">
1092    <xsl:text>&nbsp;=&nbsp;</xsl:text>
1093    <xsl:apply-templates mode="cpp"/>
1094  </span>
1095</xsl:template>
1096
1097<xsl:template match="void" mode="cpp">
1098  <span class="{name(.)}">
1099    <xsl:text>void&nbsp;</xsl:text>
1100  </span>
1101</xsl:template>
1102
1103<xsl:template match="methodname" mode="cpp">
1104  <span class="{name(.)}">
1105    <xsl:apply-templates mode="cpp"/>
1106  </span>
1107</xsl:template>
1108
1109<xsl:template match="methodparam" mode="cpp">
1110  <xsl:if test="preceding-sibling::methodparam">
1111    <xsl:text>, </xsl:text>
1112  </xsl:if>
1113  <span class="{name(.)}">
1114    <xsl:apply-templates mode="cpp"/>
1115  </span>
1116</xsl:template>
1117
1118<xsl:template match="parameter" mode="cpp">
1119  <span class="{name(.)}">
1120    <xsl:apply-templates mode="cpp"/>
1121  </span>
1122</xsl:template>
1123
1124<xsl:template mode="cpp"
1125  match="constructorsynopsis|destructorsynopsis|methodsynopsis">
1126  <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[name(.) != 'modifier']]"/>
1127  <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
1128  <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[name(.) != 'modifier']]"/>
1129
1130  <code class="{name(.)}">
1131    <xsl:if test="parent::classsynopsis">
1132      <xsl:text>&nbsp;&nbsp;</xsl:text>
1133    </xsl:if>
1134    <xsl:apply-templates select="$start-modifiers" mode="cpp"/>
1135
1136    <!-- type -->
1137    <xsl:if test="name($notmod[1]) != 'methodname'">
1138      <xsl:apply-templates select="$notmod[1]" mode="cpp"/>
1139    </xsl:if>
1140
1141    <xsl:apply-templates select="methodname" mode="cpp"/>
1142    <xsl:text>(</xsl:text>
1143    <xsl:apply-templates select="methodparam" mode="cpp"/>
1144    <xsl:text>)</xsl:text>
1145    <xsl:if test="exceptionname">
1146      <br/>
1147      <xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;throws&nbsp;</xsl:text>
1148      <xsl:apply-templates select="exceptionname" mode="cpp"/>
1149    </xsl:if>
1150    <xsl:if test="modifier[preceding-sibling::*[name(.) != 'modifier']]">
1151      <xsl:text> </xsl:text>
1152      <xsl:apply-templates select="$end-modifiers" mode="cpp"/>
1153    </xsl:if>
1154    <xsl:text>;</xsl:text>
1155  </code>
1156  <xsl:call-template name="synop-break"/>
1157</xsl:template>
1158
1159<!-- ===== IDL ========================================================= -->
1160
1161<xsl:template match="classsynopsis" mode="idl">
1162  <pre class="{name(.)}">
1163    <xsl:text>interface </xsl:text>
1164    <xsl:apply-templates select="ooclass[1]" mode="idl"/>
1165    <xsl:if test="ooclass[preceding-sibling::*]">
1166      <xsl:text>: </xsl:text>
1167      <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="idl"/>
1168      <xsl:if test="oointerface|ooexception">
1169        <br/>
1170	<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
1171      </xsl:if>
1172    </xsl:if>
1173    <xsl:if test="oointerface">
1174      <xsl:text> implements</xsl:text>
1175      <xsl:apply-templates select="oointerface" mode="idl"/>
1176      <xsl:if test="ooexception">
1177        <br/>
1178	<xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
1179      </xsl:if>
1180    </xsl:if>
1181    <xsl:if test="ooexception">
1182      <xsl:text> throws</xsl:text>
1183      <xsl:apply-templates select="ooexception" mode="idl"/>
1184    </xsl:if>
1185    <xsl:text>&nbsp;{</xsl:text>
1186    <br/>
1187    <xsl:apply-templates select="constructorsynopsis
1188                                 |destructorsynopsis
1189                                 |fieldsynopsis
1190                                 |methodsynopsis
1191                                 |classsynopsisinfo" mode="idl"/>
1192    <xsl:text>}</xsl:text>
1193  </pre>
1194</xsl:template>
1195
1196<xsl:template match="classsynopsisinfo" mode="idl">
1197  <xsl:apply-templates mode="idl"/>
1198</xsl:template>
1199
1200<xsl:template match="ooclass|oointerface|ooexception" mode="idl">
1201  <xsl:if test="preceding-sibling::*">
1202    <xsl:text>, </xsl:text>
1203  </xsl:if>
1204  <span class="{name(.)}">
1205    <xsl:apply-templates mode="idl"/>
1206  </span>
1207</xsl:template>
1208
1209<xsl:template match="modifier" mode="idl">
1210  <span class="{name(.)}">
1211    <xsl:apply-templates mode="idl"/>
1212    <xsl:if test="following-sibling::*">
1213      <xsl:text>&nbsp;</xsl:text>
1214    </xsl:if>
1215  </span>
1216</xsl:template>
1217
1218<xsl:template match="classname" mode="idl">
1219  <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
1220    <xsl:text>, </xsl:text>
1221  </xsl:if>
1222  <span class="{name(.)}">
1223    <xsl:apply-templates mode="idl"/>
1224  </span>
1225</xsl:template>
1226
1227<xsl:template match="interfacename" mode="idl">
1228  <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
1229    <xsl:text>, </xsl:text>
1230  </xsl:if>
1231  <span class="{name(.)}">
1232    <xsl:apply-templates mode="idl"/>
1233  </span>
1234</xsl:template>
1235
1236<xsl:template match="exceptionname" mode="idl">
1237  <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
1238    <xsl:text>, </xsl:text>
1239  </xsl:if>
1240  <span class="{name(.)}">
1241    <xsl:apply-templates mode="idl"/>
1242  </span>
1243</xsl:template>
1244
1245<xsl:template match="fieldsynopsis" mode="idl">
1246  <code class="{name(.)}">
1247    <xsl:if test="parent::classsynopsis">
1248      <xsl:text>&nbsp;&nbsp;</xsl:text>
1249    </xsl:if>
1250    <xsl:apply-templates mode="idl"/>
1251    <xsl:text>;</xsl:text>
1252  </code>
1253  <xsl:call-template name="synop-break"/>
1254</xsl:template>
1255
1256<xsl:template match="type" mode="idl">
1257  <span class="{name(.)}">
1258    <xsl:apply-templates mode="idl"/>
1259    <xsl:text>&nbsp;</xsl:text>
1260  </span>
1261</xsl:template>
1262
1263<xsl:template match="varname" mode="idl">
1264  <span class="{name(.)}">
1265    <xsl:apply-templates mode="idl"/>
1266    <xsl:text>&nbsp;</xsl:text>
1267  </span>
1268</xsl:template>
1269
1270<xsl:template match="initializer" mode="idl">
1271  <span class="{name(.)}">
1272    <xsl:text>=&nbsp;</xsl:text>
1273    <xsl:apply-templates mode="idl"/>
1274  </span>
1275</xsl:template>
1276
1277<xsl:template match="void" mode="idl">
1278  <span class="{name(.)}">
1279    <xsl:text>void&nbsp;</xsl:text>
1280  </span>
1281</xsl:template>
1282
1283<xsl:template match="methodname" mode="idl">
1284  <span class="{name(.)}">
1285    <xsl:apply-templates mode="idl"/>
1286  </span>
1287</xsl:template>
1288
1289<xsl:template match="methodparam" mode="idl">
1290  <xsl:if test="preceding-sibling::methodparam">
1291    <xsl:text>, </xsl:text>
1292  </xsl:if>
1293  <span class="{name(.)}">
1294    <xsl:apply-templates mode="idl"/>
1295  </span>
1296</xsl:template>
1297
1298<xsl:template match="parameter" mode="idl">
1299  <span class="{name(.)}">
1300    <xsl:apply-templates mode="idl"/>
1301  </span>
1302</xsl:template>
1303
1304<xsl:template mode="idl"
1305  match="constructorsynopsis|destructorsynopsis|methodsynopsis">
1306  <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[name(.) != 'modifier']]"/>
1307  <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
1308  <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[name(.) != 'modifier']]"/>
1309  <code class="{name(.)}">
1310    <xsl:if test="parent::classsynopsis">
1311      <xsl:text>&nbsp;&nbsp;</xsl:text>
1312    </xsl:if>
1313    <xsl:apply-templates select="$start-modifiers" mode="idl"/>
1314
1315    <!-- type -->
1316    <xsl:if test="name($notmod[1]) != 'methodname'">
1317      <xsl:apply-templates select="$notmod[1]" mode="idl"/>
1318    </xsl:if>
1319
1320    <xsl:apply-templates select="methodname" mode="idl"/>
1321    <xsl:text>(</xsl:text>
1322    <xsl:apply-templates select="methodparam" mode="idl"/>
1323    <xsl:text>)</xsl:text>
1324    <xsl:if test="exceptionname">
1325      <br/>
1326      <xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;raises(</xsl:text>
1327      <xsl:apply-templates select="exceptionname" mode="idl"/>
1328      <xsl:text>)</xsl:text>
1329    </xsl:if>
1330    <xsl:if test="modifier[preceding-sibling::*[name(.) != 'modifier']]">
1331      <xsl:text> </xsl:text>
1332      <xsl:apply-templates select="$end-modifiers" mode="idl"/>
1333    </xsl:if>
1334    <xsl:text>;</xsl:text>
1335  </code>
1336  <xsl:call-template name="synop-break"/>
1337</xsl:template>
1338
1339<!-- ===== Perl ======================================================== -->
1340
1341<xsl:template match="classsynopsis" mode="perl">
1342  <pre class="{name(.)}">
1343    <xsl:text>package </xsl:text>
1344    <xsl:apply-templates select="ooclass[1]" mode="perl"/>
1345    <xsl:text>;</xsl:text>
1346    <br/>
1347
1348    <xsl:if test="ooclass[preceding-sibling::*]">
1349      <xsl:text>@ISA = (</xsl:text>
1350      <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="perl"/>
1351      <xsl:text>);</xsl:text>
1352      <br/>
1353    </xsl:if>
1354
1355    <xsl:apply-templates select="constructorsynopsis
1356                                 |destructorsynopsis
1357                                 |fieldsynopsis
1358                                 |methodsynopsis
1359                                 |classsynopsisinfo" mode="perl"/>
1360  </pre>
1361</xsl:template>
1362
1363<xsl:template match="classsynopsisinfo" mode="perl">
1364  <xsl:apply-templates mode="perl"/>
1365</xsl:template>
1366
1367<xsl:template match="ooclass|oointerface|ooexception" mode="perl">
1368  <xsl:if test="preceding-sibling::*">
1369    <xsl:text>, </xsl:text>
1370  </xsl:if>
1371  <span class="{name(.)}">
1372    <xsl:apply-templates mode="perl"/>
1373  </span>
1374</xsl:template>
1375
1376<xsl:template match="modifier" mode="perl">
1377  <span class="{name(.)}">
1378    <xsl:apply-templates mode="perl"/>
1379    <xsl:if test="following-sibling::*">
1380      <xsl:text>&nbsp;</xsl:text>
1381    </xsl:if>
1382  </span>
1383</xsl:template>
1384
1385<xsl:template match="classname" mode="perl">
1386  <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
1387    <xsl:text>, </xsl:text>
1388  </xsl:if>
1389  <span class="{name(.)}">
1390    <xsl:apply-templates mode="perl"/>
1391  </span>
1392</xsl:template>
1393
1394<xsl:template match="interfacename" mode="perl">
1395  <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
1396    <xsl:text>, </xsl:text>
1397  </xsl:if>
1398  <span class="{name(.)}">
1399    <xsl:apply-templates mode="perl"/>
1400  </span>
1401</xsl:template>
1402
1403<xsl:template match="exceptionname" mode="perl">
1404  <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
1405    <xsl:text>, </xsl:text>
1406  </xsl:if>
1407  <span class="{name(.)}">
1408    <xsl:apply-templates mode="perl"/>
1409  </span>
1410</xsl:template>
1411
1412<xsl:template match="fieldsynopsis" mode="perl">
1413  <code class="{name(.)}">
1414    <xsl:if test="parent::classsynopsis">
1415      <xsl:text>&nbsp;&nbsp;</xsl:text>
1416    </xsl:if>
1417    <xsl:apply-templates mode="perl"/>
1418    <xsl:text>;</xsl:text>
1419  </code>
1420  <xsl:call-template name="synop-break"/>
1421</xsl:template>
1422
1423<xsl:template match="type" mode="perl">
1424  <span class="{name(.)}">
1425    <xsl:apply-templates mode="perl"/>
1426    <xsl:text>&nbsp;</xsl:text>
1427  </span>
1428</xsl:template>
1429
1430<xsl:template match="varname" mode="perl">
1431  <span class="{name(.)}">
1432    <xsl:apply-templates mode="perl"/>
1433    <xsl:text>&nbsp;</xsl:text>
1434  </span>
1435</xsl:template>
1436
1437<xsl:template match="initializer" mode="perl">
1438  <span class="{name(.)}">
1439    <xsl:text>=&nbsp;</xsl:text>
1440    <xsl:apply-templates mode="perl"/>
1441  </span>
1442</xsl:template>
1443
1444<xsl:template match="void" mode="perl">
1445  <span class="{name(.)}">
1446    <xsl:text>void&nbsp;</xsl:text>
1447  </span>
1448</xsl:template>
1449
1450<xsl:template match="methodname" mode="perl">
1451  <span class="{name(.)}">
1452    <xsl:apply-templates mode="perl"/>
1453  </span>
1454</xsl:template>
1455
1456<xsl:template match="methodparam" mode="perl">
1457  <xsl:if test="preceding-sibling::methodparam">
1458    <xsl:text>, </xsl:text>
1459  </xsl:if>
1460  <span class="{name(.)}">
1461    <xsl:apply-templates mode="perl"/>
1462  </span>
1463</xsl:template>
1464
1465<xsl:template match="parameter" mode="perl">
1466  <span class="{name(.)}">
1467    <xsl:apply-templates mode="perl"/>
1468  </span>
1469</xsl:template>
1470
1471<xsl:template mode="perl"
1472  match="constructorsynopsis|destructorsynopsis|methodsynopsis">
1473  <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[name(.) != 'modifier']]"/>
1474  <xsl:variable name="notmod" select="*[name(.) != 'modifier']"/>
1475  <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[name(.) != 'modifier']]"/>
1476
1477  <code class="{name(.)}">
1478    <xsl:text>sub </xsl:text>
1479
1480    <xsl:apply-templates select="methodname" mode="perl"/>
1481    <xsl:text> { ... };</xsl:text>
1482  </code>
1483  <xsl:call-template name="synop-break"/>
1484</xsl:template>
1485
1486<!-- ==================================================================== -->
1487
1488<!-- * DocBook 5 allows linking elements (link, olink, and xref) -->
1489<!-- * within the OO *synopsis elements (classsynopsis, fieldsynopsis, -->
1490<!-- * methodsynopsis, constructorsynopsis, destructorsynopsis) and -->
1491<!-- * their children. So we need to have mode="java|cpp|idl|perl" -->
1492<!-- * per-mode matches for those linking elements in order for them -->
1493<!-- * to be processed as expected. -->
1494
1495<xsl:template match="link|olink|xref" mode="java">
1496  <xsl:apply-templates select="."/>
1497</xsl:template>
1498
1499<xsl:template match="link|olink|xref" mode="cpp">
1500  <xsl:apply-templates select="."/>
1501</xsl:template>
1502
1503<xsl:template match="link|olink|xref" mode="idl">
1504  <xsl:apply-templates select="."/>
1505</xsl:template>
1506
1507<xsl:template match="link|olink|xref" mode="perl">
1508  <xsl:apply-templates select="."/>
1509</xsl:template>
1510
1511</xsl:stylesheet>
1512