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