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