Debian Codegraph @

docs/xsl-generic/manpages/html-synop.xsl

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