1
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
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
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
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, write to the
15
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
20
xmlns:str="http://exslt.org/strings"
21
xmlns:db="http://docbook.org/ns/docbook"
22
xmlns="http://www.w3.org/1999/xhtml"
25
<!--!!==========================================================================
26
DocBook to HTML - Function Synopses
27
:Requires: db2html-block db2html-inline
29
REMARK: Describe this module
33
<!--@@==========================================================================
34
db2html.funcsynopsis.style
35
How to render #{funcsynopsis} elements
37
This parameter controls the indentation style used to render #{funcsynopsis}
38
elements. Supported values are #{'KR'} and #{'ANSI'}. This value can also
39
be set with the #{db2html.funcsynopsis.style} processing instruction at the
40
top of the XML document. The same processing instruction or inside a
41
#{funcsynopsis} element will override this setting for that synopsis.
43
<xsl:param name="db2html.funcsynopsis.style">
45
<xsl:when test="/processing-instruction('db2html.funcsynopsis.style')">
46
<xsl:value-of select="/processing-instruction('db2html.funcsynopsis.style')"/>
49
<xsl:value-of select="'ANSI'"/>
55
<!-- == Matched Templates == -->
58
<xsl:template match="funcdef | db:funcdef">
59
<xsl:call-template name="db2html.inline"/>
62
<!-- = funcparams = -->
63
<xsl:template match="funcparams | db:funcparams">
64
<xsl:text>(</xsl:text>
65
<xsl:call-template name="db2html.inline"/>
66
<xsl:text>)</xsl:text>
69
<!-- = funcprototype = -->
70
<xsl:template match="funcprototype | db:funcprototype">
71
<xsl:variable name="style">
73
<xsl:when test="../processing-instruction('db2html.funcsynopsis.style')">
74
<xsl:value-of select="../processing-instruction('db2html.funcsynopsis.style')"/>
77
<xsl:value-of select="$db2html.funcsynopsis.style"/>
81
<xsl:for-each select="funcdef/preceding-sibling::modifier |
82
db:funcdef/preceding-sibling::db:modifier">
83
<xsl:apply-templates select="."/>
84
<xsl:text> </xsl:text>
86
<xsl:apply-templates select="funcdef | db:funcdef"/>
87
<xsl:text> (</xsl:text>
89
<xsl:when test="$style = 'KR'">
90
<xsl:for-each select="void | varargs | paramdef |
91
db:void | db:varargs | db:paramdef">
92
<xsl:if test="position() != 1">
93
<xsl:text>, </xsl:text>
96
<xsl:when test="self::paramdef or self::db:paramdef">
97
<xsl:call-template name="db2html.inline">
98
<xsl:with-param name="node" select="."/>
99
<xsl:with-param name="children" select="parameter | db:parameter"/>
103
<xsl:apply-templates select="."/>
107
<xsl:text>)</xsl:text>
108
<xsl:for-each select="funcdef/following-sibling::modifier |
109
db:funcdef/following-sibling::db:modifier">
110
<xsl:text> </xsl:text>
111
<xsl:apply-templates select="."/>
113
<xsl:text>;</xsl:text>
114
<xsl:for-each select="paramdef | db:paramdef">
115
<xsl:text>
 </xsl:text>
116
<xsl:apply-templates select="."/>
117
<xsl:text>;</xsl:text>
120
<!-- ANSI is the default -->
122
<xsl:variable name="indent">
123
<xsl:call-template name="_db2html.funcsynopsis.pad">
124
<xsl:with-param name="nodes"
125
select="funcdef | funcdef/preceding-sibling::modifier|
127
db:fundef/preceding-sibling::db:modifier"/>
129
<xsl:value-of select="str:padding(count(funcdef/preceding-sibling::modifier) +
130
count(db:funcdef/preceding-sibling::db:modifier) + 2)"/>
132
<xsl:for-each select="void | varargs | paramdef |
133
db:void | db:varargs | db:paramdef">
134
<xsl:if test="position() != 1">
135
<xsl:text>,
</xsl:text>
136
<xsl:value-of select="$indent"/>
138
<xsl:apply-templates select="."/>
140
<xsl:text>)</xsl:text>
141
<xsl:for-each select="funcdef/following-sibling::modifier |
142
db:funcdef/following-sibling::db:modifier">
143
<xsl:text> </xsl:text>
144
<xsl:apply-templates select="."/>
146
<xsl:text>;</xsl:text>
151
<!-- = funcsynopsis = -->
152
<xsl:template match="funcsynopsis | db:funcsynopsis">
153
<xsl:call-template name="db2html.pre">
154
<xsl:with-param name="node" select="."/>
155
<xsl:with-param name="children" select="*"/>
156
<xsl:with-param name="class" select="'synopsis'"/>
160
<!-- = funcsynopsisinfo = -->
161
<xsl:template match="funcsynopsisinfo | db:funcsynopsisinfo">
162
<xsl:call-template name="db2html.pre"/>
165
<!-- = initializer = -->
166
<xsl:template match="initializer | db:initializer">
167
<xsl:call-template name="db2html.inline"/>
170
<!-- = modifier = -->
171
<xsl:template match="modifier | db:modifier">
172
<xsl:call-template name="db2html.inline"/>
175
<!-- = paramdef = -->
176
<xsl:template match="paramdef | db:paramdef">
177
<xsl:call-template name="db2html.inline"/>
181
<xsl:template match="varargs | db:varargs">
182
<xsl:text>...</xsl:text>
186
<xsl:template match="void | db:void">
187
<xsl:text>void</xsl:text>
191
<!-- == Utility Templates == -->
193
<!--#* _db2html.funcsynopsis.pad -->
194
<xsl:template name="_db2html.funcsynopsis.pad">
195
<xsl:param name="nodes"/>
196
<xsl:value-of select="str:padding(string-length($nodes[1]))"/>
197
<xsl:if test="$nodes[position() != 1]">
198
<xsl:call-template name="_db2html.funcsynopsis.pad">
199
<xsl:with-param name="nodes" select="$nodes[position() != 1]"/>