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