]> git.saurik.com Git - wxWidgets.git/blob - wxPython/docs/bin/simplify.xsl
Added SF Patch#
[wxWidgets.git] / wxPython / docs / bin / simplify.xsl
1 <?xml version="1.0"?>
2 <xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4
5 <xsl:strip-space elements="*" />
6 <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" />
7
8
9 <!-- Stuff to ignore (ignored because the rules don't do anything) -->
10 <xsl:template match="/top/attributelist" />
11 <xsl:template match="include/attributelist" />
12 <xsl:template match="namespace" />
13 <xsl:template match="typemap" />
14 <xsl:template match="typemapcopy" />
15 <xsl:template match="insert" />
16 <xsl:template match="fragment" />
17 <xsl:template match="constant" />
18 <xsl:template match="import" />
19
20
21 <!-- Wrap the whole thing in a top level element -->
22 <xsl:template match="/">
23 <xsl:element name="module">
24 <xsl:attribute name="name"><xsl:value-of select="top/attributelist/attribute[@name='module']/@value"/></xsl:attribute>
25 <xsl:apply-templates />
26 </xsl:element>
27 </xsl:template>
28
29
30
31 <xsl:template match="/top/include/import/module">
32 <xsl:element name="import">
33 <xsl:attribute name="name"><xsl:value-of select="./attributelist/attribute[@name='name']/@value"/></xsl:attribute>
34 </xsl:element>
35 </xsl:template>
36
37
38 <!-- A callable template that outputs the various docstrings for the current node -->
39 <xsl:template name="DoDocstrings">
40 <xsl:if test="./attributelist/attribute[@name='python_autodoc' and @value!='']">
41 <xsl:element name="autodoc"><xsl:value-of select="./attributelist/attribute[@name='python_autodoc']/@value"/></xsl:element>
42 </xsl:if>
43 <xsl:if test="./attributelist/attribute[@name='feature_docstring' and @value!='']">
44 <xsl:element name="docstring"><xsl:value-of select="./attributelist/attribute[@name='feature_docstring']/@value"/></xsl:element>
45 </xsl:if>
46 <xsl:if test="./attributelist/attribute[@name='feature_refdoc' and @value!='']">
47 <xsl:element name="refdoc"><xsl:value-of select="./attributelist/attribute[@name='feature_refdoc']/@value"/></xsl:element>
48 </xsl:if>
49 </xsl:template>
50
51
52 <!-- A callable template that handles parameter lists -->
53 <xsl:template name="DoParamList">
54 <xsl:if test="attributelist/parmlist">
55 <xsl:element name="paramlist">
56 <xsl:for-each select="attributelist/parmlist/parm">
57 <xsl:element name="param">
58 <xsl:attribute name="name"><xsl:value-of select="./attributelist/attribute[@name='name']/@value"/></xsl:attribute>
59 <xsl:attribute name="type"><xsl:value-of select="./attributelist/attribute[@name='type']/@value"/></xsl:attribute>
60 <xsl:attribute name="default"><xsl:value-of select="./attributelist/attribute[@name='value']/@value"/></xsl:attribute>
61 </xsl:element>
62 </xsl:for-each>
63 </xsl:element>
64 </xsl:if>
65 </xsl:template>
66
67
68 <!-- Check for overloaded methods -->
69 <xsl:template name="CheckOverloaded">
70 <xsl:choose>
71 <xsl:when test="./attributelist/attribute[@name='sym_overloaded']">
72 <xsl:attribute name="overloaded">yes</xsl:attribute>
73 </xsl:when>
74 <xsl:otherwise>
75 <xsl:attribute name="overloaded">no</xsl:attribute>
76 </xsl:otherwise>
77 </xsl:choose>
78 </xsl:template>
79
80
81
82 <!-- A callable template that handles functions, methods, etc. -->
83 <xsl:template name="DoFunction">
84 <xsl:attribute name="name"><xsl:value-of select="./attributelist/attribute[@name='sym_name']/@value"/></xsl:attribute>
85 <!-- <xsl:attribute name="returntype"><xsl:value-of select="./attributelist/attribute[@name='type']/@value"/></xsl:attribute> -->
86 <xsl:call-template name="CheckOverloaded" />
87 <xsl:call-template name="DoDocstrings" />
88 <xsl:call-template name="DoParamList" />
89 </xsl:template>
90
91
92
93
94 <!-- Create a class element with doc sub elements taken from the attributelist -->
95 <xsl:template match="class">
96 <xsl:element name="class">
97
98 <xsl:attribute name="name">
99 <xsl:value-of select="./attributelist/attribute[@name='sym_name']/@value"/>
100 </xsl:attribute>
101 <xsl:attribute name="oldname">
102 <xsl:value-of select="./attributelist/attribute[@name='name']/@value"/>
103 </xsl:attribute>
104
105 <xsl:attribute name="module">
106 <xsl:value-of select="./attributelist/attribute[@name='module']/@value"/>
107 </xsl:attribute>
108
109 <xsl:call-template name="DoDocstrings" />
110 <xsl:apply-templates />
111
112 </xsl:element>
113 </xsl:template>
114
115 <xsl:template match="base">
116 <xsl:element name="baseclass">
117 <xsl:attribute name="name">
118 <xsl:value-of select="@name"/>
119 </xsl:attribute>
120 </xsl:element>
121 </xsl:template>
122
123
124 <!-- constructor -->
125 <xsl:template match="constructor">
126 <xsl:element name="constructor">
127 <xsl:attribute name="name">
128 <xsl:value-of select="./attributelist/attribute[@name='sym_name']/@value"/>
129 </xsl:attribute>
130 <xsl:call-template name="CheckOverloaded" />
131
132 <xsl:call-template name="DoDocstrings" />
133 <xsl:call-template name="DoParamList" />
134
135 </xsl:element>
136 </xsl:template>
137
138
139 <!-- destructor -->
140 <xsl:template match="destructor">
141 <xsl:element name="destructor">
142
143 <xsl:attribute name="name">
144 <xsl:value-of select="./attributelist/attribute[@name='sym_name']/@value"/>
145 </xsl:attribute>
146
147 <xsl:call-template name="DoDocstrings" />
148 <xsl:call-template name="DoParamList" />
149
150 </xsl:element>
151 </xsl:template>
152
153
154 <!-- cdecls: can be functions, methods, properties, etc. -->
155 <xsl:template match="cdecl">
156 <xsl:choose>
157 <!-- method -->
158 <xsl:when test="./attributelist/attribute[@name='view' and @value='memberfunctionHandler']">
159 <xsl:element name="method">
160 <xsl:call-template name="DoFunction" />
161 </xsl:element>
162 </xsl:when>
163
164 <!-- staticmethod -->
165 <xsl:when test="./attributelist/attribute[@name='view' and @value='staticmemberfunctionHandler']">
166 <xsl:element name="staticmethod">
167 <xsl:call-template name="DoFunction" />
168 </xsl:element>
169 </xsl:when>
170
171 <!-- property -->
172 <xsl:when test="./attributelist/attribute[@name='view' and @value='variableHandler']">
173 <xsl:element name="property">
174 <xsl:attribute name="name">
175 <xsl:value-of select="./attributelist/attribute[@name='sym_name']/@value"/>
176 </xsl:attribute>
177 <xsl:attribute name="type">
178 <xsl:value-of select="./attributelist/attribute[@name='type']/@value"/>
179 </xsl:attribute>
180 <xsl:choose>
181 <xsl:when test="./attributelist/attribute[@name='feature_immutable']">
182 <xsl:attribute name="readonly">yes</xsl:attribute>
183 </xsl:when>
184 <xsl:otherwise>
185 <xsl:attribute name="readonly">no</xsl:attribute>
186 </xsl:otherwise>
187 </xsl:choose>
188 <xsl:call-template name="DoDocstrings" />
189 </xsl:element>
190 </xsl:when>
191
192 <!-- global function -->
193 <xsl:when test="./attributelist/attribute[@name='view' and @value='globalfunctionHandler']">
194 <xsl:element name="function">
195 <xsl:attribute name="oldname">
196 <xsl:value-of select="./attributelist/attribute[@name='name']/@value"/>
197 </xsl:attribute>
198 <xsl:call-template name="DoFunction" />
199 </xsl:element>
200 </xsl:when>
201
202 </xsl:choose>
203 </xsl:template>
204
205
206 <!-- %pythoncode directives -->
207 <xsl:template match="insert">
208 <xsl:if test="./attributelist/attribute[@name='section' and @value='python']">
209 <xsl:element name="pythoncode">
210 <xsl:value-of select="./attributelist/attribute[@name='code']/@value"/>
211 </xsl:element>
212 </xsl:if>
213 </xsl:template>
214
215
216 </xsl:stylesheet>
217