OLD | NEW |
| (Empty) |
1 <?xml version='1.0'?> | |
2 <!DOCTYPE xsl:stylesheet [ | |
3 <!ENTITY nbsp " "> | |
4 ]> | |
5 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
6 version='1.0'> | |
7 | |
8 <!-- ******************************************************************** | |
9 $Id: synop.xsl 9357 2012-05-12 23:36:14Z bobstayton $ | |
10 ******************************************************************** | |
11 | |
12 This file is part of the XSL DocBook Stylesheet distribution. | |
13 See ../README or http://docbook.sf.net/release/xsl/current/ for | |
14 copyright and other information. | |
15 | |
16 ******************************************************************** --> | |
17 | |
18 <!-- ==================================================================== --> | |
19 | |
20 <!-- synopsis is in verbatim --> | |
21 | |
22 <!-- ==================================================================== --> | |
23 | |
24 <xsl:template match="cmdsynopsis"> | |
25 <div> | |
26 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
27 <p> | |
28 <xsl:call-template name="id.attribute"> | |
29 <xsl:with-param name="conditional" select="0"/> | |
30 </xsl:call-template> | |
31 <xsl:if test="..//processing-instruction('dbcmdlist')"> | |
32 <!-- * Placing a dbcmdlist PI as a child of a particular element --> | |
33 <!-- * creates a hyperlinked list of all cmdsynopsis instances --> | |
34 <!-- * that are descendants of that element; so for any --> | |
35 <!-- * cmdsynopsis that is a descendant of an element containing --> | |
36 <!-- * a dbcmdlist PI, we need to output an a@id instance so that --> | |
37 <!-- * we will have something to link to --> | |
38 <xsl:call-template name="anchor"> | |
39 <xsl:with-param name="conditional" select="0"/> | |
40 </xsl:call-template> | |
41 </xsl:if> | |
42 <xsl:apply-templates/> | |
43 </p> | |
44 </div> | |
45 </xsl:template> | |
46 | |
47 <xsl:template match="cmdsynopsis/command"> | |
48 <br/> | |
49 <xsl:call-template name="inline.monoseq"/> | |
50 <xsl:text> </xsl:text> | |
51 </xsl:template> | |
52 | |
53 <xsl:template match="cmdsynopsis/command[1]" priority="2"> | |
54 <xsl:call-template name="inline.monoseq"/> | |
55 <xsl:text> </xsl:text> | |
56 </xsl:template> | |
57 | |
58 <xsl:template match="group|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="group/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="sbr"> | |
127 <br/> | |
128 </xsl:template> | |
129 | |
130 <!-- ==================================================================== --> | |
131 | |
132 <xsl:template match="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 <i> | |
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> </xsl:text> | |
144 <xsl:apply-templates/> | |
145 </i> | |
146 </xsl:template> | |
147 | |
148 <xsl:template match="synopfragment" mode="synopfragment.number"> | |
149 <xsl:number format="1"/> | |
150 </xsl:template> | |
151 | |
152 <xsl:template match="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 name="{$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="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="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="funcprototype"> | |
213 <xsl:variable name="html-style"> | |
214 <xsl:call-template name="pi.dbhtml_funcsynopsis-style"> | |
215 <xsl:with-param name="node" select="ancestor::funcsynopsis/descendant-or-s
elf::*"/> | |
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.thresho
ld --> | |
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 > 0 | |
237 and string-length(.) > $funcsynopsis.tabular.threshol
d"/> | |
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="funcprototype" mode="kr-nontabular"> | |
262 <p> | |
263 <xsl:apply-templates mode="kr-nontabular"/> | |
264 <xsl:if test="paramdef"> | |
265 <br/> | |
266 <xsl:apply-templates select="paramdef" mode="kr-funcsynopsis-mode"/> | |
267 </xsl:if> | |
268 </p> | |
269 </xsl:template> | |
270 | |
271 <xsl:template match="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="funcdef/function" mode="kr-nontabular"> | |
281 <xsl:choose> | |
282 <xsl:when test="$funcsynopsis.decoration != 0"> | |
283 <b class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></b> | |
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="void" mode="kr-nontabular"> | |
292 <code>)</code> | |
293 <xsl:text>;</xsl:text> | |
294 </xsl:template> | |
295 | |
296 <xsl:template match="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="paramdef" mode="kr-nontabular"> | |
303 <xsl:apply-templates select="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="paramdef/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="paramdef" mode="kr-funcsynopsis-mode"> | |
331 <xsl:if test="preceding-sibling::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="paramdef/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="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="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="funcdef" mode="kr-tabular"/> | |
373 </td> | |
374 <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="kr-tabular"
/> | |
375 </tr> | |
376 <xsl:for-each select="(void|varargs|paramdef)[preceding-sibling::*[not(self:
:funcdef)]]"> | |
377 <tr> | |
378 <td> </td> | |
379 <xsl:apply-templates select="." mode="kr-tabular"/> | |
380 </tr> | |
381 </xsl:for-each> | |
382 </table> | |
383 <xsl:if test="paramdef"> | |
384 <div class="paramdef-list"> | |
385 <xsl:apply-templates select="paramdef" mode="kr-funcsynopsis-mode"/> | |
386 </div> | |
387 </xsl:if> | |
388 <div class="funcprototype-spacer"> </div> <!-- hACk: blank div for vertic
al spacing --> | |
389 </xsl:template> | |
390 | |
391 <xsl:template match="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="funcdef/function" mode="kr-tabular"> | |
401 <xsl:choose> | |
402 <xsl:when test="$funcsynopsis.decoration != 0"> | |
403 <b class="fsfunc"><xsl:apply-templates mode="kr-nontabular"/></b> | |
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="void" mode="kr-tabular"> | |
412 <td> | |
413 <code>)</code> | |
414 <xsl:text>;</xsl:text> | |
415 </td> | |
416 <td> </td> | |
417 </xsl:template> | |
418 | |
419 <xsl:template match="varargs" mode="kr-tabular"> | |
420 <td> | |
421 <xsl:text>...</xsl:text> | |
422 <code>)</code> | |
423 <xsl:text>;</xsl:text> | |
424 </td> | |
425 <td> </td> | |
426 </xsl:template> | |
427 | |
428 <xsl:template match="paramdef" mode="kr-tabular"> | |
429 <td> | |
430 <xsl:apply-templates select="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> </td> | |
442 </xsl:template> | |
443 | |
444 <xsl:template match="paramdef/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="paramdef" mode="kr-tabular-funcsynopsis-mode"> | |
460 <xsl:variable name="type"> | |
461 <xsl:choose> | |
462 <xsl:when test="type"> | |
463 <xsl:apply-templates select="type" | |
464 mode="kr-tabular-funcsynopsis-mode"/> | |
465 </xsl:when> | |
466 <xsl:when test="normalize-space(parameter/preceding-sibling::node()[not(se
lf::parameter)]) != ''"> | |
467 <xsl:copy-of select="parameter/preceding-sibling::node()[not(self::param
eter)]"/> | |
468 </xsl:when> | |
469 </xsl:choose> | |
470 </xsl:variable> | |
471 | |
472 <tr> | |
473 <xsl:choose> | |
474 <xsl:when test="$type != '' and funcparams"> | |
475 <td> | |
476 <code> | |
477 <xsl:copy-of select="$type"/> | |
478 </code> | |
479 <xsl:text> </xsl:text> | |
480 </td> | |
481 <td> | |
482 <code> | |
483 <xsl:choose> | |
484 <xsl:when test="type"> | |
485 <xsl:apply-templates select="type/following-sibling::*" | |
486 mode="kr-tabular-funcsynopsis-mode"/> | |
487 </xsl:when> | |
488 <xsl:otherwise> | |
489 <xsl:apply-templates select="*" | |
490 mode="kr-tabular-funcsynopsis-mode"/> | |
491 </xsl:otherwise> | |
492 </xsl:choose> | |
493 </code> | |
494 </td> | |
495 </xsl:when> | |
496 | |
497 <xsl:when test="funcparams"> | |
498 <td colspan="2"> | |
499 <code> | |
500 <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/> | |
501 </code> | |
502 </td> | |
503 </xsl:when> | |
504 | |
505 <xsl:otherwise> | |
506 <td> | |
507 <code> | |
508 <xsl:apply-templates select="parameter/preceding-sibling::node()[not
(self::parameter)]" | |
509 mode="kr-tabular-funcsynopsis-mode"/> | |
510 </code> | |
511 <xsl:text> </xsl:text> | |
512 </td> | |
513 <td> | |
514 <code> | |
515 <xsl:apply-templates select="parameter" | |
516 mode="kr-tabular"/> | |
517 <xsl:apply-templates select="parameter/following-sibling::*[not(self
::parameter)]" | |
518 mode="kr-tabular-funcsynopsis-mode"/> | |
519 <xsl:text>;</xsl:text> | |
520 </code> | |
521 </td> | |
522 </xsl:otherwise> | |
523 </xsl:choose> | |
524 </tr> | |
525 </xsl:template> | |
526 | |
527 <xsl:template match="paramdef/parameter" mode="kr-tabular-funcsynopsis-mode"> | |
528 <xsl:choose> | |
529 <xsl:when test="$funcsynopsis.decoration != 0"> | |
530 <var class="pdparam"> | |
531 <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/> | |
532 </var> | |
533 </xsl:when> | |
534 <xsl:otherwise> | |
535 <code> | |
536 <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/> | |
537 </code> | |
538 </xsl:otherwise> | |
539 </xsl:choose> | |
540 </xsl:template> | |
541 | |
542 <xsl:template match="funcparams" mode="kr-tabular-funcsynopsis-mode"> | |
543 <code>(</code> | |
544 <xsl:apply-templates mode="kr-tabular-funcsynopsis-mode"/> | |
545 <code>)</code> | |
546 <xsl:text>;</xsl:text> | |
547 </xsl:template> | |
548 | |
549 <!-- ====================================================================== --> | |
550 <!-- funcprototype: ansi, non-tabular --> | |
551 | |
552 <xsl:template match="funcprototype" mode="ansi-nontabular"> | |
553 <p> | |
554 <xsl:apply-templates mode="ansi-nontabular"/> | |
555 </p> | |
556 </xsl:template> | |
557 | |
558 <xsl:template match="funcdef" mode="ansi-nontabular"> | |
559 <code> | |
560 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
561 <xsl:call-template name="id.attribute"/> | |
562 <xsl:apply-templates mode="ansi-nontabular"/> | |
563 <xsl:text>(</xsl:text> | |
564 </code> | |
565 </xsl:template> | |
566 | |
567 <xsl:template match="funcdef/function" mode="ansi-nontabular"> | |
568 <xsl:choose> | |
569 <xsl:when test="$funcsynopsis.decoration != 0"> | |
570 <b class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></b> | |
571 </xsl:when> | |
572 <xsl:otherwise> | |
573 <xsl:apply-templates mode="ansi-nontabular"/> | |
574 </xsl:otherwise> | |
575 </xsl:choose> | |
576 </xsl:template> | |
577 | |
578 <xsl:template match="void" mode="ansi-nontabular"> | |
579 <code>void)</code> | |
580 <xsl:text>;</xsl:text> | |
581 </xsl:template> | |
582 | |
583 <xsl:template match="varargs" mode="ansi-nontabular"> | |
584 <xsl:text>...</xsl:text> | |
585 <code>)</code> | |
586 <xsl:text>;</xsl:text> | |
587 </xsl:template> | |
588 | |
589 <xsl:template match="paramdef" mode="ansi-nontabular"> | |
590 <xsl:apply-templates mode="ansi-nontabular"/> | |
591 <xsl:choose> | |
592 <xsl:when test="following-sibling::*"> | |
593 <xsl:text>, </xsl:text> | |
594 </xsl:when> | |
595 <xsl:otherwise> | |
596 <code>)</code> | |
597 <xsl:text>;</xsl:text> | |
598 </xsl:otherwise> | |
599 </xsl:choose> | |
600 </xsl:template> | |
601 | |
602 <xsl:template match="paramdef/parameter" mode="ansi-nontabular"> | |
603 <xsl:choose> | |
604 <xsl:when test="$funcsynopsis.decoration != 0"> | |
605 <var class="pdparam"> | |
606 <xsl:apply-templates mode="ansi-nontabular"/> | |
607 </var> | |
608 </xsl:when> | |
609 <xsl:otherwise> | |
610 <code> | |
611 <xsl:apply-templates mode="ansi-nontabular"/> | |
612 </code> | |
613 </xsl:otherwise> | |
614 </xsl:choose> | |
615 </xsl:template> | |
616 | |
617 <xsl:template match="funcparams" mode="ansi-nontabular"> | |
618 <code>(</code> | |
619 <xsl:apply-templates mode="ansi-nontabular"/> | |
620 <code>)</code> | |
621 </xsl:template> | |
622 | |
623 <!-- ====================================================================== --> | |
624 <!-- funcprototype: ansi, tabular --> | |
625 | |
626 <xsl:template match="funcprototype" mode="ansi-tabular"> | |
627 <table border="{$table.border.off}" | |
628 class="funcprototype-table" | |
629 > | |
630 <xsl:if test="$div.element != 'section'"> | |
631 <xsl:attribute name="summary">Function synopsis</xsl:attribute> | |
632 </xsl:if> | |
633 <xsl:if test="$css.decoration != 0"> | |
634 <xsl:attribute name="style">cellspacing: 0; cellpadding: 0;</xsl:attribute
> | |
635 </xsl:if> | |
636 <tr> | |
637 <td> | |
638 <xsl:apply-templates select="funcdef" mode="ansi-tabular"/> | |
639 </td> | |
640 <xsl:apply-templates select="(void|varargs|paramdef)[1]" mode="ansi-tabula
r"/> | |
641 </tr> | |
642 <xsl:for-each select="(void|varargs|paramdef)[preceding-sibling::*[not(self:
:funcdef)]]"> | |
643 <tr> | |
644 <td> </td> | |
645 <xsl:apply-templates select="." mode="ansi-tabular"/> | |
646 </tr> | |
647 </xsl:for-each> | |
648 </table> | |
649 <div class="funcprototype-spacer"> </div> <!-- hACk: blank div for vertic
al spacing --> | |
650 </xsl:template> | |
651 | |
652 <xsl:template match="funcdef" mode="ansi-tabular"> | |
653 <code> | |
654 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
655 <xsl:call-template name="id.attribute"/> | |
656 <xsl:apply-templates mode="ansi-tabular"/> | |
657 <xsl:text>(</xsl:text> | |
658 </code> | |
659 </xsl:template> | |
660 | |
661 <xsl:template match="funcdef/function" mode="ansi-tabular"> | |
662 <xsl:choose> | |
663 <xsl:when test="$funcsynopsis.decoration != 0"> | |
664 <b class="fsfunc"><xsl:apply-templates mode="ansi-nontabular"/></b> | |
665 </xsl:when> | |
666 <xsl:otherwise> | |
667 <xsl:apply-templates mode="kr-tabular"/> | |
668 </xsl:otherwise> | |
669 </xsl:choose> | |
670 </xsl:template> | |
671 | |
672 <xsl:template match="void" mode="ansi-tabular"> | |
673 <td> | |
674 <code>void)</code> | |
675 <xsl:text>;</xsl:text> | |
676 </td> | |
677 <td> </td> | |
678 </xsl:template> | |
679 | |
680 <xsl:template match="varargs" mode="ansi-tabular"> | |
681 <td> | |
682 <xsl:text>...</xsl:text> | |
683 <code>)</code> | |
684 <xsl:text>;</xsl:text> | |
685 </td> | |
686 <td> </td> | |
687 </xsl:template> | |
688 | |
689 <xsl:template match="paramdef" mode="ansi-tabular"> | |
690 <td> | |
691 <xsl:apply-templates mode="ansi-tabular"/> | |
692 <xsl:choose> | |
693 <xsl:when test="following-sibling::*"> | |
694 <xsl:text>, </xsl:text> | |
695 </xsl:when> | |
696 <xsl:otherwise> | |
697 <code>)</code> | |
698 <xsl:text>;</xsl:text> | |
699 </xsl:otherwise> | |
700 </xsl:choose> | |
701 </td> | |
702 </xsl:template> | |
703 | |
704 <xsl:template match="paramdef/parameter" mode="ansi-tabular"> | |
705 <xsl:choose> | |
706 <xsl:when test="$funcsynopsis.decoration != 0"> | |
707 <var class="pdparam"> | |
708 <xsl:apply-templates mode="ansi-tabular"/> | |
709 </var> | |
710 </xsl:when> | |
711 <xsl:otherwise> | |
712 <code> | |
713 <xsl:apply-templates mode="ansi-tabular"/> | |
714 </code> | |
715 </xsl:otherwise> | |
716 </xsl:choose> | |
717 </xsl:template> | |
718 | |
719 <xsl:template match="funcparams" mode="ansi-tabular"> | |
720 <code>(</code> | |
721 <xsl:apply-templates/> | |
722 <code>)</code> | |
723 </xsl:template> | |
724 | |
725 <!-- ====================================================================== --> | |
726 | |
727 <xsl:variable name="default-classsynopsis-language">java</xsl:variable> | |
728 | |
729 <xsl:template match="classsynopsis | |
730 |fieldsynopsis | |
731 |methodsynopsis | |
732 |constructorsynopsis | |
733 |destructorsynopsis"> | |
734 <xsl:param name="language"> | |
735 <xsl:choose> | |
736 <xsl:when test="@language"> | |
737 <xsl:value-of select="@language"/> | |
738 </xsl:when> | |
739 <xsl:otherwise> | |
740 <xsl:value-of select="$default-classsynopsis-language"/> | |
741 </xsl:otherwise> | |
742 </xsl:choose> | |
743 </xsl:param> | |
744 | |
745 <xsl:choose> | |
746 <xsl:when test="$language='java' or $language='Java'"> | |
747 <xsl:apply-templates select="." mode="java"/> | |
748 </xsl:when> | |
749 <xsl:when test="$language='perl' or $language='Perl'"> | |
750 <xsl:apply-templates select="." mode="perl"/> | |
751 </xsl:when> | |
752 <xsl:when test="$language='idl' or $language='IDL'"> | |
753 <xsl:apply-templates select="." mode="idl"/> | |
754 </xsl:when> | |
755 <xsl:when test="$language='cpp' or $language='c++' or $language='C++'"> | |
756 <xsl:apply-templates select="." mode="cpp"/> | |
757 </xsl:when> | |
758 <xsl:otherwise> | |
759 <xsl:message> | |
760 <xsl:text>Unrecognized language on </xsl:text> | |
761 <xsl:value-of select="local-name(.)"/> | |
762 <xsl:text>: </xsl:text> | |
763 <xsl:value-of select="$language"/> | |
764 </xsl:message> | |
765 <xsl:apply-templates select="."> | |
766 <xsl:with-param name="language" | |
767 select="$default-classsynopsis-language"/> | |
768 </xsl:apply-templates> | |
769 </xsl:otherwise> | |
770 </xsl:choose> | |
771 </xsl:template> | |
772 | |
773 <xsl:template name="synop-break"> | |
774 <xsl:if test="parent::classsynopsis | |
775 or (following-sibling::fieldsynopsis | |
776 |following-sibling::methodsynopsis | |
777 |following-sibling::constructorsynopsis | |
778 |following-sibling::destructorsynopsis)"> | |
779 <br/> | |
780 </xsl:if> | |
781 </xsl:template> | |
782 | |
783 | |
784 <!-- ===== Java ======================================================== --> | |
785 | |
786 <xsl:template match="classsynopsis" mode="java"> | |
787 <pre> | |
788 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
789 <xsl:call-template name="id.attribute"/> | |
790 <xsl:apply-templates select="ooclass[1]" mode="java"/> | |
791 <xsl:if test="ooclass[preceding-sibling::*]"> | |
792 <xsl:text> extends</xsl:text> | |
793 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="java"/> | |
794 <xsl:if test="oointerface|ooexception"> | |
795 <br/> | |
796 <xsl:text> </xsl:text> | |
797 </xsl:if> | |
798 </xsl:if> | |
799 <xsl:if test="oointerface"> | |
800 <xsl:text>implements</xsl:text> | |
801 <xsl:apply-templates select="oointerface" mode="java"/> | |
802 <xsl:if test="ooexception"> | |
803 <br/> | |
804 <xsl:text> </xsl:text> | |
805 </xsl:if> | |
806 </xsl:if> | |
807 <xsl:if test="ooexception"> | |
808 <xsl:text>throws</xsl:text> | |
809 <xsl:apply-templates select="ooexception" mode="java"/> | |
810 </xsl:if> | |
811 <xsl:text> {</xsl:text> | |
812 <br/> | |
813 <xsl:apply-templates select="constructorsynopsis | |
814 |destructorsynopsis | |
815 |fieldsynopsis | |
816 |methodsynopsis | |
817 |classsynopsisinfo" mode="java"/> | |
818 <xsl:text>}</xsl:text> | |
819 </pre> | |
820 </xsl:template> | |
821 | |
822 <xsl:template match="classsynopsisinfo" mode="java"> | |
823 <xsl:apply-templates mode="java"/> | |
824 </xsl:template> | |
825 | |
826 <xsl:template match="ooclass|oointerface|ooexception" mode="java"> | |
827 <xsl:choose> | |
828 <xsl:when test="preceding-sibling::*"> | |
829 <xsl:text>, </xsl:text> | |
830 </xsl:when> | |
831 <xsl:otherwise> | |
832 <xsl:text> </xsl:text> | |
833 </xsl:otherwise> | |
834 </xsl:choose> | |
835 <span> | |
836 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
837 <xsl:call-template name="id.attribute"/> | |
838 <xsl:apply-templates mode="java"/> | |
839 </span> | |
840 </xsl:template> | |
841 | |
842 <xsl:template match="modifier|package" mode="java"> | |
843 <span> | |
844 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
845 <xsl:call-template name="id.attribute"/> | |
846 <xsl:apply-templates mode="java"/> | |
847 <xsl:if test="following-sibling::*"> | |
848 <xsl:text> </xsl:text> | |
849 </xsl:if> | |
850 </span> | |
851 </xsl:template> | |
852 | |
853 <xsl:template match="classname" mode="java"> | |
854 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'"> | |
855 <xsl:text>, </xsl:text> | |
856 </xsl:if> | |
857 <span> | |
858 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
859 <xsl:call-template name="id.attribute"/> | |
860 <xsl:apply-templates mode="java"/> | |
861 </span> | |
862 </xsl:template> | |
863 | |
864 <xsl:template match="interfacename" mode="java"> | |
865 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'"> | |
866 <xsl:text>, </xsl:text> | |
867 </xsl:if> | |
868 <span> | |
869 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
870 <xsl:call-template name="id.attribute"/> | |
871 <xsl:apply-templates mode="java"/> | |
872 </span> | |
873 </xsl:template> | |
874 | |
875 <xsl:template match="exceptionname" mode="java"> | |
876 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'"> | |
877 <xsl:text>, </xsl:text> | |
878 </xsl:if> | |
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 </span> | |
884 </xsl:template> | |
885 | |
886 <xsl:template match="fieldsynopsis" mode="java"> | |
887 <code> | |
888 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
889 <xsl:call-template name="id.attribute"/> | |
890 <xsl:if test="parent::classsynopsis"> | |
891 <xsl:text> </xsl:text> | |
892 </xsl:if> | |
893 <xsl:apply-templates mode="java"/> | |
894 <xsl:text>;</xsl:text> | |
895 </code> | |
896 <xsl:call-template name="synop-break"/> | |
897 </xsl:template> | |
898 | |
899 <xsl:template match="type" mode="java"> | |
900 <span> | |
901 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
902 <xsl:call-template name="id.attribute"/> | |
903 <xsl:apply-templates mode="java"/> | |
904 <xsl:text> </xsl:text> | |
905 </span> | |
906 </xsl:template> | |
907 | |
908 <xsl:template match="varname" mode="java"> | |
909 <span> | |
910 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
911 <xsl:call-template name="id.attribute"/> | |
912 <xsl:apply-templates mode="java"/> | |
913 <xsl:text> </xsl:text> | |
914 </span> | |
915 </xsl:template> | |
916 | |
917 <xsl:template match="initializer" mode="java"> | |
918 <span> | |
919 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
920 <xsl:call-template name="id.attribute"/> | |
921 <xsl:text>= </xsl:text> | |
922 <xsl:apply-templates mode="java"/> | |
923 </span> | |
924 </xsl:template> | |
925 | |
926 <xsl:template match="void" mode="java"> | |
927 <span> | |
928 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
929 <xsl:call-template name="id.attribute"/> | |
930 <xsl:text>void </xsl:text> | |
931 </span> | |
932 </xsl:template> | |
933 | |
934 <xsl:template match="methodname" mode="java"> | |
935 <span> | |
936 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
937 <xsl:call-template name="id.attribute"/> | |
938 <xsl:apply-templates mode="java"/> | |
939 </span> | |
940 </xsl:template> | |
941 | |
942 <xsl:template match="methodparam" mode="java"> | |
943 <xsl:param name="indent">0</xsl:param> | |
944 <xsl:if test="preceding-sibling::methodparam"> | |
945 <xsl:text>,</xsl:text> | |
946 <br/> | |
947 <xsl:if test="$indent > 0"> | |
948 <xsl:call-template name="copy-string"> | |
949 <xsl:with-param name="string"> </xsl:with-param> | |
950 <xsl:with-param name="count" select="$indent + 1"/> | |
951 </xsl:call-template> | |
952 </xsl:if> | |
953 </xsl:if> | |
954 <span> | |
955 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
956 <xsl:call-template name="id.attribute"/> | |
957 <xsl:apply-templates mode="java"/> | |
958 </span> | |
959 </xsl:template> | |
960 | |
961 <xsl:template match="parameter" mode="java"> | |
962 <span> | |
963 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
964 <xsl:call-template name="id.attribute"/> | |
965 <xsl:apply-templates mode="java"/> | |
966 </span> | |
967 </xsl:template> | |
968 | |
969 <xsl:template mode="java" | |
970 match="constructorsynopsis|destructorsynopsis|methodsynopsis"> | |
971 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[loc
al-name(.) != 'modifier']]"/> | |
972 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/> | |
973 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local
-name(.) != 'modifier']]"/> | |
974 <xsl:variable name="decl"> | |
975 <xsl:if test="parent::classsynopsis"> | |
976 <xsl:text> </xsl:text> | |
977 </xsl:if> | |
978 <xsl:apply-templates select="$start-modifiers" mode="java"/> | |
979 | |
980 <!-- type --> | |
981 <xsl:if test="local-name($notmod[1]) != 'methodname'"> | |
982 <xsl:apply-templates select="$notmod[1]" mode="java"/> | |
983 </xsl:if> | |
984 | |
985 <xsl:apply-templates select="methodname" mode="java"/> | |
986 </xsl:variable> | |
987 | |
988 <code> | |
989 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
990 <xsl:call-template name="id.attribute"/> | |
991 <xsl:copy-of select="$decl"/> | |
992 <xsl:text>(</xsl:text> | |
993 <xsl:apply-templates select="methodparam" mode="java"> | |
994 <xsl:with-param name="indent" select="string-length($decl)"/> | |
995 </xsl:apply-templates> | |
996 <xsl:text>)</xsl:text> | |
997 <xsl:if test="exceptionname"> | |
998 <br/> | |
999 <xsl:text> throws </xsl:text> | |
1000 <xsl:apply-templates select="exceptionname" mode="java"/> | |
1001 </xsl:if> | |
1002 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"> | |
1003 <xsl:text> </xsl:text> | |
1004 <xsl:apply-templates select="$end-modifiers" mode="java"/> | |
1005 </xsl:if> | |
1006 <xsl:text>;</xsl:text> | |
1007 </code> | |
1008 <xsl:call-template name="synop-break"/> | |
1009 </xsl:template> | |
1010 | |
1011 <!-- ===== C++ ========================================================= --> | |
1012 | |
1013 <xsl:template match="classsynopsis" mode="cpp"> | |
1014 <pre> | |
1015 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1016 <xsl:call-template name="id.attribute"/> | |
1017 <xsl:apply-templates select="ooclass[1]" mode="cpp"/> | |
1018 <xsl:if test="ooclass[preceding-sibling::*]"> | |
1019 <xsl:text>: </xsl:text> | |
1020 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="cpp"/> | |
1021 <xsl:if test="oointerface|ooexception"> | |
1022 <br/> | |
1023 <xsl:text> </xsl:text> | |
1024 </xsl:if> | |
1025 </xsl:if> | |
1026 <xsl:if test="oointerface"> | |
1027 <xsl:text> implements</xsl:text> | |
1028 <xsl:apply-templates select="oointerface" mode="cpp"/> | |
1029 <xsl:if test="ooexception"> | |
1030 <br/> | |
1031 <xsl:text> </xsl:text> | |
1032 </xsl:if> | |
1033 </xsl:if> | |
1034 <xsl:if test="ooexception"> | |
1035 <xsl:text> throws</xsl:text> | |
1036 <xsl:apply-templates select="ooexception" mode="cpp"/> | |
1037 </xsl:if> | |
1038 <xsl:text> {</xsl:text> | |
1039 <br/> | |
1040 <xsl:apply-templates select="constructorsynopsis | |
1041 |destructorsynopsis | |
1042 |fieldsynopsis | |
1043 |methodsynopsis | |
1044 |classsynopsisinfo" mode="cpp"/> | |
1045 <xsl:text>}</xsl:text> | |
1046 </pre> | |
1047 </xsl:template> | |
1048 | |
1049 <xsl:template match="classsynopsisinfo" mode="cpp"> | |
1050 <xsl:apply-templates mode="cpp"/> | |
1051 </xsl:template> | |
1052 | |
1053 <xsl:template match="ooclass|oointerface|ooexception" mode="cpp"> | |
1054 <xsl:if test="preceding-sibling::*"> | |
1055 <xsl:text>, </xsl:text> | |
1056 </xsl:if> | |
1057 <span> | |
1058 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1059 <xsl:call-template name="id.attribute"/> | |
1060 <xsl:apply-templates mode="cpp"/> | |
1061 </span> | |
1062 </xsl:template> | |
1063 | |
1064 <xsl:template match="modifier|package" mode="cpp"> | |
1065 <span> | |
1066 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1067 <xsl:call-template name="id.attribute"/> | |
1068 <xsl:apply-templates mode="cpp"/> | |
1069 <xsl:if test="following-sibling::*"> | |
1070 <xsl:text> </xsl:text> | |
1071 </xsl:if> | |
1072 </span> | |
1073 </xsl:template> | |
1074 | |
1075 <xsl:template match="classname" mode="cpp"> | |
1076 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'"> | |
1077 <xsl:text>, </xsl:text> | |
1078 </xsl:if> | |
1079 <span> | |
1080 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1081 <xsl:call-template name="id.attribute"/> | |
1082 <xsl:apply-templates mode="cpp"/> | |
1083 </span> | |
1084 </xsl:template> | |
1085 | |
1086 <xsl:template match="interfacename" mode="cpp"> | |
1087 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'"> | |
1088 <xsl:text>, </xsl:text> | |
1089 </xsl:if> | |
1090 <span> | |
1091 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1092 <xsl:call-template name="id.attribute"/> | |
1093 <xsl:apply-templates mode="cpp"/> | |
1094 </span> | |
1095 </xsl:template> | |
1096 | |
1097 <xsl:template match="exceptionname" mode="cpp"> | |
1098 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'"> | |
1099 <xsl:text>, </xsl:text> | |
1100 </xsl:if> | |
1101 <span> | |
1102 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1103 <xsl:call-template name="id.attribute"/> | |
1104 <xsl:apply-templates mode="cpp"/> | |
1105 </span> | |
1106 </xsl:template> | |
1107 | |
1108 <xsl:template match="fieldsynopsis" mode="cpp"> | |
1109 <code> | |
1110 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1111 <xsl:call-template name="id.attribute"/> | |
1112 <xsl:if test="parent::classsynopsis"> | |
1113 <xsl:text> </xsl:text> | |
1114 </xsl:if> | |
1115 <xsl:apply-templates mode="cpp"/> | |
1116 <xsl:text>;</xsl:text> | |
1117 </code> | |
1118 <xsl:call-template name="synop-break"/> | |
1119 </xsl:template> | |
1120 | |
1121 <xsl:template match="type" mode="cpp"> | |
1122 <span> | |
1123 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1124 <xsl:call-template name="id.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="common.html.attributes"/> | |
1133 <xsl:call-template name="id.attribute"/> | |
1134 <xsl:apply-templates mode="cpp"/> | |
1135 <xsl:text> </xsl:text> | |
1136 </span> | |
1137 </xsl:template> | |
1138 | |
1139 <xsl:template match="initializer" mode="cpp"> | |
1140 <span> | |
1141 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1142 <xsl:call-template name="id.attribute"/> | |
1143 <xsl:text>= </xsl:text> | |
1144 <xsl:apply-templates mode="cpp"/> | |
1145 </span> | |
1146 </xsl:template> | |
1147 | |
1148 <xsl:template match="void" mode="cpp"> | |
1149 <span> | |
1150 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1151 <xsl:call-template name="id.attribute"/> | |
1152 <xsl:text>void </xsl:text> | |
1153 </span> | |
1154 </xsl:template> | |
1155 | |
1156 <xsl:template match="methodname" mode="cpp"> | |
1157 <span> | |
1158 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1159 <xsl:call-template name="id.attribute"/> | |
1160 <xsl:apply-templates mode="cpp"/> | |
1161 </span> | |
1162 </xsl:template> | |
1163 | |
1164 <xsl:template match="methodparam" mode="cpp"> | |
1165 <xsl:if test="preceding-sibling::methodparam"> | |
1166 <xsl:text>, </xsl:text> | |
1167 </xsl:if> | |
1168 <span> | |
1169 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1170 <xsl:call-template name="id.attribute"/> | |
1171 <xsl:apply-templates mode="cpp"/> | |
1172 </span> | |
1173 </xsl:template> | |
1174 | |
1175 <xsl:template match="parameter" mode="cpp"> | |
1176 <span> | |
1177 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1178 <xsl:call-template name="id.attribute"/> | |
1179 <xsl:apply-templates mode="cpp"/> | |
1180 </span> | |
1181 </xsl:template> | |
1182 | |
1183 <xsl:template mode="cpp" | |
1184 match="constructorsynopsis|destructorsynopsis|methodsynopsis"> | |
1185 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[loc
al-name(.) != 'modifier']]"/> | |
1186 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/> | |
1187 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local
-name(.) != 'modifier']]"/> | |
1188 | |
1189 <code> | |
1190 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1191 <xsl:call-template name="id.attribute"/> | |
1192 <xsl:if test="parent::classsynopsis"> | |
1193 <xsl:text> </xsl:text> | |
1194 </xsl:if> | |
1195 <xsl:apply-templates select="$start-modifiers" mode="cpp"/> | |
1196 | |
1197 <!-- type --> | |
1198 <xsl:if test="local-name($notmod[1]) != 'methodname'"> | |
1199 <xsl:apply-templates select="$notmod[1]" mode="cpp"/> | |
1200 </xsl:if> | |
1201 | |
1202 <xsl:apply-templates select="methodname" mode="cpp"/> | |
1203 <xsl:text>(</xsl:text> | |
1204 <xsl:apply-templates select="methodparam" mode="cpp"/> | |
1205 <xsl:text>)</xsl:text> | |
1206 <xsl:if test="exceptionname"> | |
1207 <br/> | |
1208 <xsl:text> throws </xsl:text> | |
1209 <xsl:apply-templates select="exceptionname" mode="cpp"/> | |
1210 </xsl:if> | |
1211 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"> | |
1212 <xsl:text> </xsl:text> | |
1213 <xsl:apply-templates select="$end-modifiers" mode="cpp"/> | |
1214 </xsl:if> | |
1215 <xsl:text>;</xsl:text> | |
1216 </code> | |
1217 <xsl:call-template name="synop-break"/> | |
1218 </xsl:template> | |
1219 | |
1220 <!-- ===== IDL ========================================================= --> | |
1221 | |
1222 <xsl:template match="classsynopsis" mode="idl"> | |
1223 <pre> | |
1224 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1225 <xsl:call-template name="id.attribute"/> | |
1226 <xsl:text>interface </xsl:text> | |
1227 <xsl:apply-templates select="ooclass[1]" mode="idl"/> | |
1228 <xsl:if test="ooclass[preceding-sibling::*]"> | |
1229 <xsl:text>: </xsl:text> | |
1230 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="idl"/> | |
1231 <xsl:if test="oointerface|ooexception"> | |
1232 <br/> | |
1233 <xsl:text> </xsl:text> | |
1234 </xsl:if> | |
1235 </xsl:if> | |
1236 <xsl:if test="oointerface"> | |
1237 <xsl:text> implements</xsl:text> | |
1238 <xsl:apply-templates select="oointerface" mode="idl"/> | |
1239 <xsl:if test="ooexception"> | |
1240 <br/> | |
1241 <xsl:text> </xsl:text> | |
1242 </xsl:if> | |
1243 </xsl:if> | |
1244 <xsl:if test="ooexception"> | |
1245 <xsl:text> throws</xsl:text> | |
1246 <xsl:apply-templates select="ooexception" mode="idl"/> | |
1247 </xsl:if> | |
1248 <xsl:text> {</xsl:text> | |
1249 <br/> | |
1250 <xsl:apply-templates select="constructorsynopsis | |
1251 |destructorsynopsis | |
1252 |fieldsynopsis | |
1253 |methodsynopsis | |
1254 |classsynopsisinfo" mode="idl"/> | |
1255 <xsl:text>}</xsl:text> | |
1256 </pre> | |
1257 </xsl:template> | |
1258 | |
1259 <xsl:template match="classsynopsisinfo" mode="idl"> | |
1260 <xsl:apply-templates mode="idl"/> | |
1261 </xsl:template> | |
1262 | |
1263 <xsl:template match="ooclass|oointerface|ooexception" mode="idl"> | |
1264 <xsl:if test="preceding-sibling::*"> | |
1265 <xsl:text>, </xsl:text> | |
1266 </xsl:if> | |
1267 <span> | |
1268 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1269 <xsl:call-template name="id.attribute"/> | |
1270 <xsl:apply-templates mode="idl"/> | |
1271 </span> | |
1272 </xsl:template> | |
1273 | |
1274 <xsl:template match="modifier|package" mode="idl"> | |
1275 <span> | |
1276 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1277 <xsl:call-template name="id.attribute"/> | |
1278 <xsl:apply-templates mode="idl"/> | |
1279 <xsl:if test="following-sibling::*"> | |
1280 <xsl:text> </xsl:text> | |
1281 </xsl:if> | |
1282 </span> | |
1283 </xsl:template> | |
1284 | |
1285 <xsl:template match="classname" mode="idl"> | |
1286 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'"> | |
1287 <xsl:text>, </xsl:text> | |
1288 </xsl:if> | |
1289 <span> | |
1290 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1291 <xsl:call-template name="id.attribute"/> | |
1292 <xsl:apply-templates mode="idl"/> | |
1293 </span> | |
1294 </xsl:template> | |
1295 | |
1296 <xsl:template match="interfacename" mode="idl"> | |
1297 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'"> | |
1298 <xsl:text>, </xsl:text> | |
1299 </xsl:if> | |
1300 <span> | |
1301 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1302 <xsl:call-template name="id.attribute"/> | |
1303 <xsl:apply-templates mode="idl"/> | |
1304 </span> | |
1305 </xsl:template> | |
1306 | |
1307 <xsl:template match="exceptionname" mode="idl"> | |
1308 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'"> | |
1309 <xsl:text>, </xsl:text> | |
1310 </xsl:if> | |
1311 <span> | |
1312 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1313 <xsl:call-template name="id.attribute"/> | |
1314 <xsl:apply-templates mode="idl"/> | |
1315 </span> | |
1316 </xsl:template> | |
1317 | |
1318 <xsl:template match="fieldsynopsis" mode="idl"> | |
1319 <code> | |
1320 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1321 <xsl:call-template name="id.attribute"/> | |
1322 <xsl:if test="parent::classsynopsis"> | |
1323 <xsl:text> </xsl:text> | |
1324 </xsl:if> | |
1325 <xsl:apply-templates mode="idl"/> | |
1326 <xsl:text>;</xsl:text> | |
1327 </code> | |
1328 <xsl:call-template name="synop-break"/> | |
1329 </xsl:template> | |
1330 | |
1331 <xsl:template match="type" mode="idl"> | |
1332 <span> | |
1333 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1334 <xsl:call-template name="id.attribute"/> | |
1335 <xsl:apply-templates mode="idl"/> | |
1336 <xsl:text> </xsl:text> | |
1337 </span> | |
1338 </xsl:template> | |
1339 | |
1340 <xsl:template match="varname" mode="idl"> | |
1341 <span> | |
1342 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1343 <xsl:call-template name="id.attribute"/> | |
1344 <xsl:apply-templates mode="idl"/> | |
1345 <xsl:text> </xsl:text> | |
1346 </span> | |
1347 </xsl:template> | |
1348 | |
1349 <xsl:template match="initializer" mode="idl"> | |
1350 <span> | |
1351 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1352 <xsl:call-template name="id.attribute"/> | |
1353 <xsl:text>= </xsl:text> | |
1354 <xsl:apply-templates mode="idl"/> | |
1355 </span> | |
1356 </xsl:template> | |
1357 | |
1358 <xsl:template match="void" mode="idl"> | |
1359 <span> | |
1360 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1361 <xsl:call-template name="id.attribute"/> | |
1362 <xsl:text>void </xsl:text> | |
1363 </span> | |
1364 </xsl:template> | |
1365 | |
1366 <xsl:template match="methodname" mode="idl"> | |
1367 <span> | |
1368 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1369 <xsl:call-template name="id.attribute"/> | |
1370 <xsl:apply-templates mode="idl"/> | |
1371 </span> | |
1372 </xsl:template> | |
1373 | |
1374 <xsl:template match="methodparam" mode="idl"> | |
1375 <xsl:if test="preceding-sibling::methodparam"> | |
1376 <xsl:text>, </xsl:text> | |
1377 </xsl:if> | |
1378 <span> | |
1379 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1380 <xsl:call-template name="id.attribute"/> | |
1381 <xsl:apply-templates mode="idl"/> | |
1382 </span> | |
1383 </xsl:template> | |
1384 | |
1385 <xsl:template match="parameter" mode="idl"> | |
1386 <span> | |
1387 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1388 <xsl:call-template name="id.attribute"/> | |
1389 <xsl:apply-templates mode="idl"/> | |
1390 </span> | |
1391 </xsl:template> | |
1392 | |
1393 <xsl:template mode="idl" | |
1394 match="constructorsynopsis|destructorsynopsis|methodsynopsis"> | |
1395 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[loc
al-name(.) != 'modifier']]"/> | |
1396 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/> | |
1397 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local
-name(.) != 'modifier']]"/> | |
1398 <code> | |
1399 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1400 <xsl:call-template name="id.attribute"/> | |
1401 <xsl:if test="parent::classsynopsis"> | |
1402 <xsl:text> </xsl:text> | |
1403 </xsl:if> | |
1404 <xsl:apply-templates select="$start-modifiers" mode="idl"/> | |
1405 | |
1406 <!-- type --> | |
1407 <xsl:if test="local-name($notmod[1]) != 'methodname'"> | |
1408 <xsl:apply-templates select="$notmod[1]" mode="idl"/> | |
1409 </xsl:if> | |
1410 | |
1411 <xsl:apply-templates select="methodname" mode="idl"/> | |
1412 <xsl:text>(</xsl:text> | |
1413 <xsl:apply-templates select="methodparam" mode="idl"/> | |
1414 <xsl:text>)</xsl:text> | |
1415 <xsl:if test="exceptionname"> | |
1416 <br/> | |
1417 <xsl:text> raises(</xsl:text> | |
1418 <xsl:apply-templates select="exceptionname" mode="idl"/> | |
1419 <xsl:text>)</xsl:text> | |
1420 </xsl:if> | |
1421 <xsl:if test="modifier[preceding-sibling::*[local-name(.) != 'modifier']]"> | |
1422 <xsl:text> </xsl:text> | |
1423 <xsl:apply-templates select="$end-modifiers" mode="idl"/> | |
1424 </xsl:if> | |
1425 <xsl:text>;</xsl:text> | |
1426 </code> | |
1427 <xsl:call-template name="synop-break"/> | |
1428 </xsl:template> | |
1429 | |
1430 <!-- ===== Perl ======================================================== --> | |
1431 | |
1432 <xsl:template match="classsynopsis" mode="perl"> | |
1433 <pre> | |
1434 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1435 <xsl:call-template name="id.attribute"/> | |
1436 <xsl:text>package </xsl:text> | |
1437 <xsl:apply-templates select="ooclass[1]" mode="perl"/> | |
1438 <xsl:text>;</xsl:text> | |
1439 <br/> | |
1440 | |
1441 <xsl:if test="ooclass[preceding-sibling::*]"> | |
1442 <xsl:text>@ISA = (</xsl:text> | |
1443 <xsl:apply-templates select="ooclass[preceding-sibling::*]" mode="perl"/> | |
1444 <xsl:text>);</xsl:text> | |
1445 <br/> | |
1446 </xsl:if> | |
1447 | |
1448 <xsl:apply-templates select="constructorsynopsis | |
1449 |destructorsynopsis | |
1450 |fieldsynopsis | |
1451 |methodsynopsis | |
1452 |classsynopsisinfo" mode="perl"/> | |
1453 </pre> | |
1454 </xsl:template> | |
1455 | |
1456 <xsl:template match="classsynopsisinfo" mode="perl"> | |
1457 <xsl:apply-templates mode="perl"/> | |
1458 </xsl:template> | |
1459 | |
1460 <xsl:template match="ooclass|oointerface|ooexception" mode="perl"> | |
1461 <xsl:if test="preceding-sibling::*"> | |
1462 <xsl:text>, </xsl:text> | |
1463 </xsl:if> | |
1464 <span> | |
1465 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1466 <xsl:call-template name="id.attribute"/> | |
1467 <xsl:apply-templates mode="perl"/> | |
1468 </span> | |
1469 </xsl:template> | |
1470 | |
1471 <xsl:template match="modifier|package" mode="perl"> | |
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 <xsl:if test="following-sibling::*"> | |
1477 <xsl:text> </xsl:text> | |
1478 </xsl:if> | |
1479 </span> | |
1480 </xsl:template> | |
1481 | |
1482 <xsl:template match="classname" mode="perl"> | |
1483 <xsl:if test="local-name(preceding-sibling::*[1]) = 'classname'"> | |
1484 <xsl:text>, </xsl:text> | |
1485 </xsl:if> | |
1486 <span> | |
1487 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1488 <xsl:call-template name="id.attribute"/> | |
1489 <xsl:apply-templates mode="perl"/> | |
1490 </span> | |
1491 </xsl:template> | |
1492 | |
1493 <xsl:template match="interfacename" mode="perl"> | |
1494 <xsl:if test="local-name(preceding-sibling::*[1]) = 'interfacename'"> | |
1495 <xsl:text>, </xsl:text> | |
1496 </xsl:if> | |
1497 <span> | |
1498 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1499 <xsl:call-template name="id.attribute"/> | |
1500 <xsl:apply-templates mode="perl"/> | |
1501 </span> | |
1502 </xsl:template> | |
1503 | |
1504 <xsl:template match="exceptionname" mode="perl"> | |
1505 <xsl:if test="local-name(preceding-sibling::*[1]) = 'exceptionname'"> | |
1506 <xsl:text>, </xsl:text> | |
1507 </xsl:if> | |
1508 <span> | |
1509 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1510 <xsl:call-template name="id.attribute"/> | |
1511 <xsl:apply-templates mode="perl"/> | |
1512 </span> | |
1513 </xsl:template> | |
1514 | |
1515 <xsl:template match="fieldsynopsis" mode="perl"> | |
1516 <code> | |
1517 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1518 <xsl:call-template name="id.attribute"/> | |
1519 <xsl:if test="parent::classsynopsis"> | |
1520 <xsl:text> </xsl:text> | |
1521 </xsl:if> | |
1522 <xsl:apply-templates mode="perl"/> | |
1523 <xsl:text>;</xsl:text> | |
1524 </code> | |
1525 <xsl:call-template name="synop-break"/> | |
1526 </xsl:template> | |
1527 | |
1528 <xsl:template match="type" mode="perl"> | |
1529 <span> | |
1530 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1531 <xsl:call-template name="id.attribute"/> | |
1532 <xsl:apply-templates mode="perl"/> | |
1533 <xsl:text> </xsl:text> | |
1534 </span> | |
1535 </xsl:template> | |
1536 | |
1537 <xsl:template match="varname" mode="perl"> | |
1538 <span> | |
1539 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1540 <xsl:call-template name="id.attribute"/> | |
1541 <xsl:apply-templates mode="perl"/> | |
1542 <xsl:text> </xsl:text> | |
1543 </span> | |
1544 </xsl:template> | |
1545 | |
1546 <xsl:template match="initializer" mode="perl"> | |
1547 <span> | |
1548 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1549 <xsl:call-template name="id.attribute"/> | |
1550 <xsl:text>= </xsl:text> | |
1551 <xsl:apply-templates mode="perl"/> | |
1552 </span> | |
1553 </xsl:template> | |
1554 | |
1555 <xsl:template match="void" mode="perl"> | |
1556 <span> | |
1557 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1558 <xsl:call-template name="id.attribute"/> | |
1559 <xsl:text>void </xsl:text> | |
1560 </span> | |
1561 </xsl:template> | |
1562 | |
1563 <xsl:template match="methodname" mode="perl"> | |
1564 <span> | |
1565 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1566 <xsl:call-template name="id.attribute"/> | |
1567 <xsl:apply-templates mode="perl"/> | |
1568 </span> | |
1569 </xsl:template> | |
1570 | |
1571 <xsl:template match="methodparam" mode="perl"> | |
1572 <xsl:if test="preceding-sibling::methodparam"> | |
1573 <xsl:text>, </xsl:text> | |
1574 </xsl:if> | |
1575 <span> | |
1576 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1577 <xsl:call-template name="id.attribute"/> | |
1578 <xsl:apply-templates mode="perl"/> | |
1579 </span> | |
1580 </xsl:template> | |
1581 | |
1582 <xsl:template match="parameter" mode="perl"> | |
1583 <span> | |
1584 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1585 <xsl:call-template name="id.attribute"/> | |
1586 <xsl:apply-templates mode="perl"/> | |
1587 </span> | |
1588 </xsl:template> | |
1589 | |
1590 <xsl:template mode="perl" | |
1591 match="constructorsynopsis|destructorsynopsis|methodsynopsis"> | |
1592 <xsl:variable name="start-modifiers" select="modifier[following-sibling::*[loc
al-name(.) != 'modifier']]"/> | |
1593 <xsl:variable name="notmod" select="*[local-name(.) != 'modifier']"/> | |
1594 <xsl:variable name="end-modifiers" select="modifier[preceding-sibling::*[local
-name(.) != 'modifier']]"/> | |
1595 | |
1596 <code> | |
1597 <xsl:apply-templates select="." mode="common.html.attributes"/> | |
1598 <xsl:call-template name="id.attribute"/> | |
1599 <xsl:text>sub </xsl:text> | |
1600 | |
1601 <xsl:apply-templates select="methodname" mode="perl"/> | |
1602 <xsl:text> { ... };</xsl:text> | |
1603 </code> | |
1604 <xsl:call-template name="synop-break"/> | |
1605 </xsl:template> | |
1606 | |
1607 <!-- Used when not occurring as a child of classsynopsis --> | |
1608 <xsl:template match="ooclass|oointerface|ooexception"> | |
1609 <xsl:apply-templates/> | |
1610 </xsl:template> | |
1611 | |
1612 <!-- ==================================================================== --> | |
1613 | |
1614 <!-- * DocBook 5 allows linking elements (link, olink, and xref) --> | |
1615 <!-- * within the OO *synopsis elements (classsynopsis, fieldsynopsis, --> | |
1616 <!-- * methodsynopsis, constructorsynopsis, destructorsynopsis) and --> | |
1617 <!-- * their children. So we need to have mode="java|cpp|idl|perl" --> | |
1618 <!-- * per-mode matches for those linking elements in order for them --> | |
1619 <!-- * to be processed as expected. --> | |
1620 | |
1621 <xsl:template match="link|olink|xref" mode="java"> | |
1622 <xsl:apply-templates select="."/> | |
1623 </xsl:template> | |
1624 | |
1625 <xsl:template match="link|olink|xref" mode="cpp"> | |
1626 <xsl:apply-templates select="."/> | |
1627 </xsl:template> | |
1628 | |
1629 <xsl:template match="link|olink|xref" mode="idl"> | |
1630 <xsl:apply-templates select="."/> | |
1631 </xsl:template> | |
1632 | |
1633 <xsl:template match="link|olink|xref" mode="perl"> | |
1634 <xsl:apply-templates select="."/> | |
1635 </xsl:template> | |
1636 | |
1637 <xsl:template match="link|olink|xref" mode="ansi-nontabular"> | |
1638 <xsl:apply-templates select="."/> | |
1639 </xsl:template> | |
1640 | |
1641 <xsl:template match="link|olink|xref" mode="ansi-tabular"> | |
1642 <xsl:apply-templates select="."/> | |
1643 </xsl:template> | |
1644 | |
1645 <xsl:template match="link|olink|xref" mode="kr-nontabular"> | |
1646 <xsl:apply-templates select="."/> | |
1647 </xsl:template> | |
1648 | |
1649 <xsl:template match="link|olink|xref" mode="kr-tabular"> | |
1650 <xsl:apply-templates select="."/> | |
1651 </xsl:template> | |
1652 | |
1653 </xsl:stylesheet> | |
OLD | NEW |