19
19
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
20
20
xmlns:db="http://docbook.org/ns/docbook"
21
21
xmlns="http://www.w3.org/1999/xhtml"
22
exclude-result-prefixes="db"
24
25
<!--!!==========================================================================
25
26
DocBook to HTML - Class Synopses
26
:Requires: db2html-inline db2html-xref gettext
27
:Requires: db2html-xref html
28
:Revision:version="1.0" date="2011-05-16" status="final"
28
REMARK: Describe this module. Implmentation note: for C++, we expect the first
29
modifier to be the visibility
30
This module handles the DocBook #{classsynopsis} and related elements. The
31
contents of the class-modeling elements are processed in a mode depending on
32
the programming language to format the synopsis correctly.
32
<xsl:variable name="cpp.tab" select="'    '"/>
33
<xsl:variable name="python.tab" select="'    '"/>
36
<!-- FIXME: document PI -->
35
<xsl:variable name="db2html.classsynopsis.tab"
36
select="'    '"/>
37
39
<!--@@==========================================================================
38
40
db2html.classsynopsis.language
39
The default programming language used to format #{classsynopsis} elements
41
The default programming language used to format #{classsynopsis} elements.
42
:Revision:version="1.0" date="2011-05-16" status="final"
41
REMARK: Describe this param
44
This parameter sets the default value for the #{language} attribute of elements
45
like #{classsynopsis}. Templates in this module will always use the #{language}
46
attribute if present. Otherwise, they fall back to this value. This parameter
47
can be set with the #{db2html.classsynopsis.language} processing instruction
48
at the root of a DocBook document.
43
50
<xsl:param name="db2html.classsynopsis.language">
76
<xsl:when test="@lang | @xml:lang">
77
<xsl:attribute name="dir">
78
<xsl:call-template name="l10n.direction">
79
<xsl:with-param name="lang" select="@lang | @xml:lang"/>
84
<xsl:attribute name="dir">
85
<xsl:text>ltr</xsl:text>
82
<xsl:call-template name="html.lang.attrs"/>
89
83
<xsl:attribute name="class">
90
84
<xsl:text>synopsis </xsl:text>
91
85
<xsl:value-of select="local-name(.)"/>
158
152
<!--%%==========================================================================
159
153
db2html.class.cpp.mode
154
Process a C++ synopsis.
155
:Revision:version="1.0" date="2011-05-16" status="final"
161
REMARK: Describe this mode
157
This mode is applied to child elements for synopsis elements for the C++
158
programming language. In C++ synopses, the first #{modifier} element for
159
methods is expected to mark the visibility, such as #{public} or #{private}.
163
161
<xsl:template mode="db2html.class.cpp.mode" match="*">
164
162
<xsl:apply-templates select="."/>
223
221
<xsl:call-template name="db2html.class.cpp.modifier"/>
224
<xsl:value-of select="$cpp.tab"/>
222
<xsl:value-of select="$db2html.classsynopsis.tab"/>
225
223
<xsl:for-each select="modifier[position() != 1] | db:modifier[position() != 1]">
226
224
<xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
227
225
<xsl:text> </xsl:text>
265
263
<xsl:call-template name="db2html.class.cpp.modifier"/>
266
<xsl:value-of select="$cpp.tab"/>
264
<xsl:value-of select="$db2html.classsynopsis.tab"/>
267
265
<xsl:for-each select="modifier[position() != 1] | db:modifier[position() != 1]">
268
266
<xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
269
267
<xsl:text> </xsl:text>
310
308
<xsl:call-template name="db2html.class.cpp.modifier"/>
311
<xsl:value-of select="$cpp.tab"/>
309
<xsl:value-of select="$db2html.classsynopsis.tab"/>
312
310
<xsl:for-each select="modifier[position() != 1] | db:modifier[position() != 1]">
313
311
<xsl:apply-templates mode="db2html.class.cpp.mode" select="."/>
314
312
<xsl:text> </xsl:text>
357
355
<xsl:call-template name="db2html.class.cpp.modifier"/>
358
<xsl:value-of select="$cpp.tab"/>
356
<xsl:value-of select="$db2html.classsynopsis.tab"/>
359
357
<!-- Parens for document order -->
360
358
<xsl:for-each select="(methodname/preceding-sibling::modifier |
361
359
db:methodname/preceding-sibling::db:modifier)[position() != 1]">
388
386
<!--%%==========================================================================
389
387
db2html.class.python.mode
388
Process a Python synopsis.
389
:Revision:version="1.0" date="2011-05-16" status="final"
391
REMARK: Describe this mode
391
This mode is applied to child elements for synopsis elements for the Python
392
programming language.
393
394
<xsl:template mode="db2html.class.python.mode" match="*">
394
395
<xsl:apply-templates select="."/>
448
449
<xsl:variable name="tab">
449
450
<xsl:if test="../self::classsynopsis or ../self::db:classsynopsis">
450
<xsl:value-of select="$python.tab"/>
451
<xsl:value-of select="$db2html.classsynopsis.tab"/>
453
454
<xsl:for-each select="modifier | db:modifier">
502
503
<xsl:variable name="tab">
503
504
<xsl:if test="../self::classsynopsis or ../self::db:classsynopsis">
504
<xsl:value-of select="$python.tab"/>
505
<xsl:value-of select="$db2html.classsynopsis.tab"/>
507
508
<xsl:for-each select="modifier | db:modifier">
552
553
<xsl:variable name="tab">
553
554
<xsl:if test="../self::classsynopsis or ../self::db:classsynopsis">
554
<xsl:value-of select="$python.tab"/>
555
<xsl:value-of select="$db2html.classsynopsis.tab"/>
557
558
<xsl:for-each select="modifier | db:modifier">
609
610
<xsl:variable name="tab">
610
611
<xsl:if test="../self::classsynopsis or ../self::db:classsynopsis">
611
<xsl:value-of select="$python.tab"/>
612
<xsl:value-of select="$db2html.classsynopsis.tab"/>
614
615
<xsl:for-each select="modifier | db:modifier">