Debian Codegraph @

xslt/docbook/html/db2html-classsynopsis.xsl

raw
1 <?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
2 <!--
3 This program is free software; you can redistribute it and/or modify it under
4 the terms of the GNU Lesser General Public License as published by the Free
5 Software Foundation; either version 2 of the License, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful, but WITHOUT
9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 details.
12
13 You should have received a copy of the GNU Lesser General Public License
14 along with this program; see the file COPYING.LGPL. If not, see <http://www.gnu.org/licenses/>.
15 -->
16
17 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18 xmlns:db="http://docbook.org/ns/docbook"
19 xmlns="http://www.w3.org/1999/xhtml"
20 exclude-result-prefixes="db"
21 version="1.0">
22
23 <!--!!==========================================================================
24 DocBook to HTML - Class Synopses
25 @revision[version=1.0 date=2011-05-16 status=final]
26
27 This module handles the DocBook `classsynopsis` and related elements. The
28 contents of the class-modeling elements are processed in a mode depending on
29 the programming language to format the synopsis correctly.
30 -->
31
32 <xsl:variable name="db2html.classsynopsis.tab"
33 select="'&#x00A0;&#x00A0;&#x00A0;&#x00A0;'"/>
34
35
36 <!--@@==========================================================================
37 db2html.classsynopsis.language
38 The default programming language used to format `classsynopsis` elements.
39 @revision[version=1.0 date=2011-05-16 status=final]
40
41 This parameter sets the default value for the `language` attribute of elements
42 like `classsynopsis`. Templates in this module will always use the `language`
43 attribute if present. Otherwise, they fall back to this value. This parameter
44 can be set with the `db2html.classsynopsis.language` processing instruction
45 at the root of a DocBook document.
46 -->
47 <xsl:param name="db2html.classsynopsis.language">
48 <xsl:choose>
49 <xsl:when test="/processing-instruction('db2html.classsynopsis.language')">
50 <xsl:value-of
51 select="/processing-instruction('db2html.classsynopsis.language')"/>
52 </xsl:when>
53 <xsl:otherwise>
54 <xsl:value-of select="'cpp'"/>
55 </xsl:otherwise>
56 </xsl:choose>
57 </xsl:param>
58
59
60 <!-- == Matched Templates == -->
61
62 <!-- = *synopsis = -->
63 <xsl:template match="
64 classsynopsis | constructorsynopsis | fieldsynopsis |
65 methodsynopsis | destructorsynopsis |
66 db:classsynopsis | db:constructorsynopsis | db:fieldsynopsis |
67 db:methodsynopsis | db:destructorsynopsis ">
68 <xsl:variable name="if"><xsl:call-template name="db.profile.test"/></xsl:variable>
69 <xsl:if test="$if != ''">
70 <xsl:variable name="language">
71 <xsl:choose>
72 <xsl:when test="@language">
73 <xsl:value-of select="@language"/>
74 </xsl:when>
75 <xsl:otherwise>
76 <xsl:value-of select="$db2html.classsynopsis.language"/>
77 </xsl:otherwise>
78 </xsl:choose>
79 </xsl:variable>
80 <div>
81 <xsl:call-template name="html.lang.attrs"/>
82 <xsl:call-template name="html.class.attr">
83 <xsl:with-param name="class">
84 <xsl:text>synopsis </xsl:text>
85 <xsl:value-of select="local-name(.)"/>
86 </xsl:with-param>
87 </xsl:call-template>
88 <xsl:call-template name="db2html.anchor"/>
89 <pre class="contents {local-name(.)} classsynopsis-{$language}">
90 <xsl:choose>
91 <xsl:when test="$language = 'cpp'">
92 <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
93 </xsl:when>
94 <xsl:when test="$language = 'python'">
95 <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
96 </xsl:when>
97 <xsl:otherwise>
98 <xsl:message>
99 <xsl:text>No information about the language '</xsl:text>
100 <xsl:value-of select="$language"/>
101 <xsl:text>' for classsynopsis.</xsl:text>
102 </xsl:message>
103 </xsl:otherwise>
104 </xsl:choose>
105 </pre>
106 </div>
107 </xsl:if>
108 </xsl:template>
109
110 <!-- = classsynopsisinfo = -->
111 <xsl:template match="classsynopsisinfo | db:classsynopsisinfo">
112 <xsl:apply-templates/>
113 <!-- FIXME? -->
114 <xsl:text>&#x000A;</xsl:text>
115 </xsl:template>
116
117 <!-- = methodparam = -->
118 <xsl:template match="methodparam | db:methodparam">
119 <span>
120 <xsl:call-template name="html.class.attr">
121 <xsl:with-param name="class" select="'methodparam'"/>
122 </xsl:call-template>
123 <xsl:for-each select="*">
124 <xsl:if test="position() != 1">
125 <xsl:text> </xsl:text>
126 </xsl:if>
127 <xsl:apply-templates select="."/>
128 </xsl:for-each>
129 </span>
130 </xsl:template>
131
132 <!--#* db2html.class.cpp.modifier -->
133 <xsl:template name="db2html.class.cpp.modifier">
134 <!-- For C++, we expect the first modifier to be the visibility -->
135 <xsl:variable name="prec" select="self::*[../self::classsynopsis]/preceding-sibling::constructorsynopsis |
136 self::*[../self::classsynopsis]/preceding-sibling::destructorsynopsis |
137 self::*[../self::classsynopsis]/preceding-sibling::fieldsynopsis |
138 self::*[../self::classsynopsis]/preceding-sibling::methodsynopsis |
139 self::*[../self::db:classsynopsis]/preceding-sibling::db:constructorsynopsis |
140 self::*[../self::db:classsynopsis]/preceding-sibling::db:destructorsynopsis |
141 self::*[../self::db:classsynopsis]/preceding-sibling::db:fieldsynopsis |
142 self::*[../self::db:classsynopsis]/preceding-sibling::db:methodsynopsis "/>
143 <xsl:choose>
144 <xsl:when test="not($prec[modifier][last()][modifier[1] = current()/modifier[1]]) and
145 not($prec[db:modifier][last()][db:modifier[1] = current()/db:modifier[1]])">
146 <xsl:if test="$prec"><xsl:text>&#x000A;</xsl:text></xsl:if>
147 <xsl:apply-templates select="(modifier | db:modifier)[1]"/>
148 <xsl:text>:&#x000A;</xsl:text>
149 </xsl:when>
150 <xsl:when test="$prec and (name($prec[last()]) != name(.))">
151 <xsl:text>&#x000A;</xsl:text>
152 </xsl:when>
153 </xsl:choose>
154 </xsl:template>
155
156
157 <!--%%==========================================================================
158 db2html.class.cpp.mode
159 Process a C++ synopsis.
160 @revision[version=1.0 date=2011-05-16 status=final]
161
162 This mode is applied to child elements for synopsis elements for the C++
163 programming language. In C++ synopses, the first `modifier` element for
164 methods is expected to mark the visibility, such as `public` or `private`.
165 -->
166 <xsl:template mode="db2html.class.cpp.mode" match="*">
167 <xsl:apply-templates select="."/>
168 </xsl:template>
169
170 <!-- = classsynopsis % db2html.class.cpp.mode = -->
171 <xsl:template mode="db2html.class.cpp.mode"
172 match="classsynopsis | db:classsynopsis">
173 <!-- classsynopsis = element classsynopsis {
174 attribute language { ... }?,
175 attribute class { ... }?,
176 ooclass+,
177 (classsynopsisinfo | constructorsynopsis |
178 destructorsynopsis | fieldsynopsis |
179 methodsynopsis )
180 }
181 -->
182 <xsl:if test="@class = 'class' or not(@class)">
183 <span class="ooclass">
184 <xsl:for-each select="ooclass[1]/modifier | db:ooclass[1]/db:modifier">
185 <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
186 <xsl:text> </xsl:text>
187 </xsl:for-each>
188 <xsl:text>class </xsl:text>
189 <xsl:apply-templates mode="db2html.class.cpp.mode"
190 select="ooclass[1]/classname |
191 db:ooclass[1]/db:classname"/>
192 </span>
193 <xsl:if test="ooclass[2] or db:ooclass[2]">
194 <xsl:text> : </xsl:text>
195 <xsl:for-each select="ooclass[position() != 1] |
196 db:ooclass[position() != 1]">
197 <xsl:if test="position() != 1">
198 <xsl:text>, </xsl:text>
199 </xsl:if>
200 <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
201 </xsl:for-each>
202 </xsl:if>
203 <xsl:text>&#x000A;{&#x000A;</xsl:text>
204 <xsl:apply-templates mode="db2html.class.cpp.mode"
205 select="
206 classsynopsisinfo |
207 constructorsynopsis | destructorsynopsis |
208 fieldsynopsis | methodsynopsis |
209 db:classsynopsisinfo |
210 db:constructorsynopsis | db:destructorsynopsis |
211 db:fieldsynopsis | db:methodsynopsis "/>
212 <xsl:text>}&#x000A;</xsl:text>
213 </xsl:if>
214 </xsl:template>
215
216 <!-- = constructorsynopsis % db2html.class.cpp.mode = -->
217 <xsl:template mode="db2html.class.cpp.mode"
218 match="constructorsynopsis | db:constructorsynopsis">
219 <!-- constructorsynopsis = element constructorsynopsis {
220 attribute language { ... }?,
221 modifier+,
222 methodname?,
223 (methodparam+ | void?)
224 }
225 -->
226 <xsl:call-template name="db2html.class.cpp.modifier"/>
227 <xsl:value-of select="$db2html.classsynopsis.tab"/>
228 <xsl:for-each select="modifier[position() != 1] | db:modifier[position() != 1]">
229 <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
230 <xsl:text> </xsl:text>
231 </xsl:for-each>
232 <xsl:choose>
233 <xsl:when test="methodname or db:methodname">
234 <xsl:apply-templates mode="db2html.class.cpp.mode"
235 select="methodname | db:methodname"/>
236 </xsl:when>
237 <xsl:when test="../self::classsynopsis[ooclass]">
238 <span class="methodname">
239 <xsl:value-of select="../ooclass/classname"/>
240 </span>
241 </xsl:when>
242 <xsl:when test="../self::db:classsynopsis[db:ooclass]">
243 <span class="methodname">
244 <xsl:value-of select="../db:ooclass/db:classname"/>
245 </span>
246 </xsl:when>
247 </xsl:choose>
248 <xsl:text>(</xsl:text>
249 <xsl:for-each select="methodparam | db:methodparam">
250 <xsl:if test="position() != 1">
251 <xsl:text>, </xsl:text>
252 </xsl:if>
253 <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
254 </xsl:for-each>
255 <xsl:text>);&#x000A;</xsl:text>
256 </xsl:template>
257
258 <!-- = destructorsynopsis % db2html.class.cpp.mode = -->
259 <xsl:template mode="db2html.class.cpp.mode"
260 match="destructorsynopsis | db:destructorsynopsis">
261 <!-- destructorsynopsis = element destructorsynopsis {
262 attribute language { ... }?,
263 modifier+,
264 methodname?,
265 (methodparam+ | void?)
266 }
267 -->
268 <xsl:call-template name="db2html.class.cpp.modifier"/>
269 <xsl:value-of select="$db2html.classsynopsis.tab"/>
270 <xsl:for-each select="modifier[position() != 1] | db:modifier[position() != 1]">
271 <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
272 <xsl:text> </xsl:text>
273 </xsl:for-each>
274 <xsl:choose>
275 <xsl:when test="methodname">
276 <xsl:apply-templates mode="db2html.class.cpp.mode"
277 select="methodname | db:methodname"/>
278 </xsl:when>
279 <xsl:when test="../self::classsynopsis[ooclass]">
280 <span class="methodname">
281 <xsl:text>~</xsl:text>
282 <xsl:value-of select="../ooclass/classname"/>
283 </span>
284 </xsl:when>
285 <xsl:when test="../self::db:classsynopsis[db:ooclass]">
286 <span class="methodname">
287 <xsl:value-of select="../db:ooclass/db:classname"/>
288 </span>
289 </xsl:when>
290 </xsl:choose>
291 <xsl:text>(</xsl:text>
292 <xsl:for-each select="methodparam | db:methodparam">
293 <!-- FIXME: should we do each methodparam on its own line? -->
294 <xsl:if test="position() != 1">
295 <xsl:text>, </xsl:text>
296 </xsl:if>
297 <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
298 </xsl:for-each>
299 <xsl:text>);&#x000A;</xsl:text>
300 </xsl:template>
301
302 <!-- = fieldsynopsis % db2html.class.cpp.mode = -->
303 <xsl:template mode="db2html.class.cpp.mode"
304 match="fieldsynopsis | db:fieldsynopsis">
305 <!-- fieldsynopsis = element fieldsynopsis {
306 attribute language { ... }?,
307 modifier+,
308 type,
309 varname,
310 initializer?
311 }
312 -->
313 <xsl:call-template name="db2html.class.cpp.modifier"/>
314 <xsl:value-of select="$db2html.classsynopsis.tab"/>
315 <xsl:for-each select="modifier[position() != 1] | db:modifier[position() != 1]">
316 <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
317 <xsl:text> </xsl:text>
318 </xsl:for-each>
319 <xsl:if test="type or db:type">
320 <xsl:apply-templates mode="db2html.class.cpp.mode" select="type | db:type"/>
321 <xsl:text> </xsl:text>
322 </xsl:if>
323 <xsl:apply-templates mode="db2html.class.cpp.mode"
324 select="varname | db:varname"/>
325 <xsl:if test="initializer or db:initializer">
326 <xsl:text> = </xsl:text>
327 <xsl:apply-templates mode="db2html.class.cpp.mode"
328 select="initializer | db:initializer"/>
329 </xsl:if>
330 <xsl:text>;&#x000A;</xsl:text>
331 </xsl:template>
332
333 <!-- = methodparam % db2html.class.cpp.mode = -->
334 <xsl:template mode="db2html.class.cpp.mode"
335 match="methodparam | db:methodparam">
336 <span>
337 <xsl:call-template name="html.class.attr">
338 <xsl:with-param name="class" select="'methodparam'"/>
339 </xsl:call-template>
340 <xsl:for-each select="*">
341 <xsl:if test="position() != 1">
342 <xsl:text> </xsl:text>
343 </xsl:if>
344 <xsl:if test="self::initializer or self::db:initializer">
345 <xsl:text>= </xsl:text>
346 </xsl:if>
347 <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
348 </xsl:for-each>
349 </span>
350 </xsl:template>
351
352 <!-- = methodsynopsis % db2html.class.cpp.mode = -->
353 <xsl:template mode="db2html.class.cpp.mode"
354 match="methodsynopsis | db:methodsynopsis">
355 <!-- methodsynopsis = element methodsynopsis {
356 attribute language { ... }?,
357 modifier+,
358 (type | void),
359 methodname,
360 (methodparam+ | void?)
361 }
362 -->
363 <xsl:call-template name="db2html.class.cpp.modifier"/>
364 <xsl:value-of select="$db2html.classsynopsis.tab"/>
365 <!-- Parens for document order -->
366 <xsl:for-each select="(methodname/preceding-sibling::modifier |
367 db:methodname/preceding-sibling::db:modifier)[position() != 1]">
368 <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
369 <xsl:text> </xsl:text>
370 </xsl:for-each>
371 <xsl:apply-templates mode="db2html.class.cpp.mode"
372 select="type | methodname/preceding-sibling::void |
373 db:type | db:methodname/preceding-sibling::db:void"/>
374 <xsl:text> </xsl:text>
375 <xsl:apply-templates mode="db2html.class.cpp.mode"
376 select="methodname | db:methodname"/>
377 <xsl:text>(</xsl:text>
378 <xsl:for-each select="methodparam | db:methodparam">
379 <xsl:if test="position() != 1">
380 <xsl:text>, </xsl:text>
381 </xsl:if>
382 <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
383 </xsl:for-each>
384 <xsl:text>)</xsl:text>
385 <xsl:for-each select="methodname/following-sibling::modifier |
386 db:methodname/following-sibling::db:modifier">
387 <xsl:text> </xsl:text>
388 <xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
389 </xsl:for-each>
390 <xsl:text>;&#x000A;</xsl:text>
391 </xsl:template>
392
393
394 <!--%%==========================================================================
395 db2html.class.python.mode
396 Process a Python synopsis.
397 @revision[version=1.0 date=2011-05-16 status=final]
398
399 This mode is applied to child elements for synopsis elements for the Python
400 programming language.
401 -->
402 <xsl:template mode="db2html.class.python.mode" match="*">
403 <xsl:apply-templates select="."/>
404 </xsl:template>
405
406 <!-- = classsynopsis % db2html.class.python.mode = -->
407 <xsl:template mode="db2html.class.python.mode"
408 match="classsynopsis | db:classsynopsis">
409 <!-- classsynopsis = element classsynopsis {
410 attribute language { ... }?,
411 attribute class { ... }?,
412 ooclass+,
413 (classsynopsisinfo | constructorsynopsis |
414 destructorsynopsis | fieldsynopsis |
415 methodsynopsis )
416 }
417 -->
418 <xsl:if test="@class = 'class' or not(@class)">
419 <xsl:text>class </xsl:text>
420 <xsl:apply-templates mode="db2html.class.python.mode"
421 select="ooclass[1] | db:ooclass[1]"/>
422 <xsl:if test="ooclass[2] or db:ooclass[2]">
423 <xsl:text>(</xsl:text>
424 <xsl:for-each select="(ooclass | db:ooclass)[position() != 1]">
425 <xsl:if test="position() != 1">
426 <xsl:text>, </xsl:text>
427 </xsl:if>
428 <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
429 </xsl:for-each>
430 <xsl:text>)</xsl:text>
431 </xsl:if>
432 <xsl:text>:&#x000A;</xsl:text>
433 <xsl:for-each select="classsynopsisinfo | constructorsynopsis |
434 destructorsynopsis | fieldsynopsis |
435 methodsynopsis |
436 db:classsynopsisinfo | db:constructorsynopsis |
437 db:destructorsynopsis | db:fieldsynopsis |
438 db:methodsynopsis ">
439 <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
440 <xsl:if test="position() != last() and local-name(following-sibling::*[1]) != local-name(.)">
441 <xsl:text>&#x000A;</xsl:text>
442 </xsl:if>
443 </xsl:for-each>
444 </xsl:if>
445 </xsl:template>
446
447 <!-- = constructorsynopsis % db2html.class.python.mode = -->
448 <xsl:template mode="db2html.class.python.mode"
449 match="constructorsynopsis | db:constructorsynopsis">
450 <!-- constructorsynopsis = element constructorsynopsis {
451 attribute language { ... }?,
452 modifier+,
453 methodname?,
454 (methodparam+ | void?)
455 }
456 -->
457 <xsl:variable name="tab">
458 <xsl:if test="../self::classsynopsis or ../self::db:classsynopsis">
459 <xsl:value-of select="$db2html.classsynopsis.tab"/>
460 </xsl:if>
461 </xsl:variable>
462 <xsl:for-each select="modifier | db:modifier">
463 <xsl:value-of select="$tab"/>
464 <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
465 <xsl:text>&#x000A;</xsl:text>
466 </xsl:for-each>
467 <xsl:value-of select="$tab"/>
468 <xsl:choose>
469 <xsl:when test="methodname">
470 <xsl:apply-templates mode="db2html.class.python.mode" select="methodname"/>
471 </xsl:when>
472 <xsl:when test="db:methodname">
473 <xsl:apply-templates mode="db2html.class.python.mode" select="db:methodname"/>
474 </xsl:when>
475 <xsl:when test="../self::classsynopsis[ooclass]">
476 <span class="methodname">
477 <xsl:value-of select="../ooclass/classname"/>
478 </span>
479 </xsl:when>
480 <xsl:when test="../self::db:classsynopsis[db:ooclass]">
481 <span class="methodname">
482 <xsl:value-of select="../db:ooclass/db:classname"/>
483 </span>
484 </xsl:when>
485 </xsl:choose>
486 <xsl:text>(</xsl:text>
487 <xsl:for-each select="methodparam | db:methodparam">
488 <xsl:if test="position() != 1">
489 <xsl:text>, </xsl:text>
490 </xsl:if>
491 <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
492 </xsl:for-each>
493 <xsl:text>)</xsl:text>
494 <xsl:if test="type or db:type">
495 <xsl:text> -&gt; </xsl:text>
496 <xsl:apply-templates mode="db2html.class.python.mode" select="type | db:type"/>
497 </xsl:if>
498 <xsl:text>&#x000A;</xsl:text>
499 </xsl:template>
500
501 <!-- = destructorsynopsis % db2html.class.python.mode = -->
502 <xsl:template mode="db2html.class.python.mode"
503 match="destructorsynopsis | db:destructorsynopsis">
504 <!-- destructorsynopsis = element destructorsynopsis {
505 attribute language { ... }?,
506 modifier+,
507 methodname?,
508 (methodparam+ | void?)
509 }
510 -->
511 <xsl:variable name="tab">
512 <xsl:if test="../self::classsynopsis or ../self::db:classsynopsis">
513 <xsl:value-of select="$db2html.classsynopsis.tab"/>
514 </xsl:if>
515 </xsl:variable>
516 <xsl:for-each select="modifier | db:modifier">
517 <xsl:value-of select="$tab"/>
518 <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
519 <xsl:text>&#x000A;</xsl:text>
520 </xsl:for-each>
521 <xsl:value-of select="$tab"/>
522 <xsl:choose>
523 <xsl:when test="methodname">
524 <xsl:apply-templates mode="db2html.class.python.mode" select="methodname"/>
525 </xsl:when>
526 <xsl:when test="db:methodname">
527 <xsl:apply-templates mode="db2html.class.python.mode" select="db:methodname"/>
528 </xsl:when>
529 <xsl:otherwise>
530 <span class="methodname">
531 <xsl:text>__del__</xsl:text>
532 </span>
533 </xsl:otherwise>
534 </xsl:choose>
535 <xsl:text>(</xsl:text>
536 <xsl:for-each select="methodparam | db:methodparam">
537 <xsl:if test="position() != 1">
538 <xsl:text>, </xsl:text>
539 </xsl:if>
540 <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
541 </xsl:for-each>
542 <xsl:text>)</xsl:text>
543 <xsl:if test="type or db:type">
544 <xsl:text> -&gt; </xsl:text>
545 <xsl:apply-templates mode="db2html.class.python.mode" select="type | db:type"/>
546 </xsl:if>
547 <xsl:text>&#x000A;</xsl:text>
548 </xsl:template>
549
550 <!-- = fieldsynopsis % db2html.class.python.mode = -->
551 <xsl:template mode="db2html.class.python.mode"
552 match="fieldsynopsis | db:fieldsynopsis">
553 <!-- fieldsynopsis = element fieldsynopsis {
554 attribute language { ... }?,
555 modifier+,
556 type,
557 varname,
558 initializer?
559 }
560 -->
561 <xsl:variable name="tab">
562 <xsl:if test="../self::classsynopsis or ../self::db:classsynopsis">
563 <xsl:value-of select="$db2html.classsynopsis.tab"/>
564 </xsl:if>
565 </xsl:variable>
566 <xsl:for-each select="modifier | db:modifier">
567 <xsl:value-of select="$tab"/>
568 <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
569 <xsl:text>&#x000A;</xsl:text>
570 </xsl:for-each>
571 <xsl:value-of select="$tab"/>
572 <xsl:apply-templates mode="db2html.class.python.mode"
573 select="varname | db:varname"/>
574 <xsl:if test="initializer or db:initializer">
575 <xsl:text>=</xsl:text>
576 <xsl:apply-templates mode="db2html.class.python.mode"
577 select="initializer | db:initializer"/>
578 </xsl:if>
579 <xsl:text>&#x000A;</xsl:text>
580 </xsl:template>
581
582 <!-- = methodparam % db2html.class.python.mode = -->
583 <xsl:template mode="db2html.class.python.mode"
584 match="methodparam | db:methodparam">
585 <span class="methodparam">
586 <xsl:apply-templates mode="db2html.class.python.mode"
587 select="parameter | db:parameter"/>
588 <xsl:if test="modifier or type or db:modifier or db:type">
589 <xsl:text>: </xsl:text>
590 <xsl:apply-templates mode="db2html.class.python.mode"
591 select="(modifier | type | db:modifier | db:type)[1]"/>
592 <xsl:if test="initializer or db:initializer">
593 <xsl:text> </xsl:text>
594 </xsl:if>
595 </xsl:if>
596 <xsl:if test="initializer or db:initializer">
597 <xsl:text>=</xsl:text>
598 <xsl:if test="modifier or type or db:modifier or db:type">
599 <xsl:text> </xsl:text>
600 </xsl:if>
601 <xsl:apply-templates mode="db2html.class.python.mode"
602 select="initializer | db:initializer"/>
603 </xsl:if>
604 </span>
605 </xsl:template>
606
607 <!-- = methodsynopsis % db2html.class.python.mode = -->
608 <xsl:template mode="db2html.class.python.mode"
609 match="methodsynopsis | db:methodsynopsis">
610 <!-- methodsynopsis = element methodsynopsis {
611 attribute language { ... }?,
612 modifier+,
613 (type | void),
614 methodname,
615 (methodparam+ | void?)
616 }
617 -->
618 <xsl:variable name="tab">
619 <xsl:if test="../self::classsynopsis or ../self::db:classsynopsis">
620 <xsl:value-of select="$db2html.classsynopsis.tab"/>
621 </xsl:if>
622 </xsl:variable>
623 <xsl:for-each select="modifier | db:modifier">
624 <xsl:value-of select="$tab"/>
625 <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
626 <xsl:text>&#x000A;</xsl:text>
627 </xsl:for-each>
628 <xsl:value-of select="$tab"/>
629 <xsl:text>def </xsl:text>
630 <xsl:apply-templates mode="db2html.class.python.mode"
631 select="methodname | db:methodname"/>
632 <xsl:text>(</xsl:text>
633 <xsl:for-each select="methodparam | db:methodparam">
634 <xsl:if test="position() != 1">
635 <xsl:text>, </xsl:text>
636 </xsl:if>
637 <xsl:apply-templates mode="db2html.class.python.mode" select="."/>
638 </xsl:for-each>
639 <xsl:text>)</xsl:text>
640 <xsl:if test="type or db:type">
641 <xsl:text> -&gt; </xsl:text>
642 <xsl:apply-templates mode="db2html.class.python.mode" select="type | db:type"/>
643 </xsl:if>
644 <xsl:text>&#x000A;</xsl:text>
645 </xsl:template>
646
647 </xsl:stylesheet>