Mercurial > pub > site.implab
comparison schemas/doxygen/csharp/default.xsl @ 7:fa7a99c2d079
dox library templates and schemas
author | sergey |
---|---|
date | Wed, 14 May 2014 01:22:21 +0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
6:2d1a0a75fc49 | 7:fa7a99c2d079 |
---|---|
1 <?xml version="1.0" encoding="UTF-8"?> | |
2 <xsl:stylesheet version="1.0" | |
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
4 <xsl:import href="base.xsl" /> | |
5 <xsl:param name="compounds" /> | |
6 <xsl:param name="members" /> | |
7 <xsl:variable name="labels" select="document('labels.xml')"/> | |
8 | |
9 <xsl:key name="param-key" use="concat(generate-id(parent::node()),declname/text())" match="memberdef/param[declname]"/> | |
10 | |
11 <xsl:output method="html" encoding="utf-8" indent="yes" | |
12 omit-xml-declaration="yes" /> | |
13 | |
14 <!-- The main template --> | |
15 <xsl:template name="compounddefType"> | |
16 <h1> | |
17 <xsl:apply-templates select="title|compoundname" | |
18 mode="compounddefType" /> | |
19 </h1> | |
20 <div class="briefdescription"> | |
21 <xsl:apply-templates select="briefdescription" | |
22 mode="compounddefType" /> | |
23 </div> | |
24 <div class="basecompoundref"> | |
25 <pre> | |
26 <xsl:apply-templates select="basecompoundref" | |
27 mode="compounddefType" /> | |
28 </pre> | |
29 </div> | |
30 <div class="detaileddescription"> | |
31 <xsl:apply-templates select="detaileddescription" | |
32 mode="compounddefType" /> | |
33 </div> | |
34 | |
35 <div class="innerCompounds"> | |
36 <xsl:apply-templates select="innerclass | innernamespace" | |
37 mode="compounddefType" /> | |
38 </div> | |
39 | |
40 <div class="members"> | |
41 <xsl:apply-templates select="sectiondef" mode="compounddefType" /> | |
42 </div> | |
43 | |
44 <xsl:if test="derivedcompoundref"> | |
45 <div class="derivedcompoundref"> | |
46 <h2>Derived</h2> | |
47 <xsl:apply-templates select="derivedcompoundref" | |
48 mode="compounddefType" /> | |
49 </div> | |
50 </xsl:if> | |
51 </xsl:template> | |
52 | |
53 <xsl:template match="compoundname" mode="compounddefType"> | |
54 <xsl:call-template name="full-type-name"> | |
55 <xsl:with-param name="typename" select="text()" /> | |
56 </xsl:call-template> | |
57 </xsl:template> | |
58 | |
59 <!-- handle references --> | |
60 <xsl:template name="compoundRefType"> | |
61 <xsl:choose> | |
62 <xsl:when test="@refid"> | |
63 <xsl:call-template name="link"> | |
64 <xsl:with-param name="class" select="'doxCompoundRef'"/> | |
65 <xsl:with-param name="refid" select="@refid" /> | |
66 <xsl:with-param name="kind" select="'compound'" /> | |
67 <xsl:with-param name="external" /> | |
68 <xsl:with-param name="text" select="text()" /> | |
69 </xsl:call-template> | |
70 </xsl:when> | |
71 <xsl:otherwise> | |
72 <span class="doxCompoundRef"> | |
73 <xsl:value-of select="text()" /> | |
74 </span> | |
75 </xsl:otherwise> | |
76 </xsl:choose> | |
77 </xsl:template> | |
78 | |
79 <xsl:template name="refTextType"> | |
80 <xsl:element name="a"> | |
81 <xsl:attribute name="href"> | |
82 <xsl:call-template name="ref"> | |
83 <xsl:with-param name="refid" select="@refid" /> | |
84 <xsl:with-param name="kind" select="@kindref" /> | |
85 <xsl:with-param name="external" select="@external" /> | |
86 </xsl:call-template> | |
87 </xsl:attribute> | |
88 <xsl:value-of select="text()" /> | |
89 </xsl:element> | |
90 </xsl:template> | |
91 | |
92 <xsl:template match="innerclass" mode="compounddefType"> | |
93 <xsl:call-template name="link"> | |
94 <xsl:with-param name="refid" select="@refid" /> | |
95 <xsl:with-param name="kind" select="'compound'" /> | |
96 <xsl:with-param name="external" /> | |
97 <xsl:with-param name="text" > | |
98 <xsl:call-template name="short-type-name"> | |
99 <xsl:with-param name="typename" select="text()" /> | |
100 </xsl:call-template> | |
101 </xsl:with-param> | |
102 </xsl:call-template> | |
103 </xsl:template> | |
104 | |
105 <xsl:template match="innernamespace" mode="compounddefType"> | |
106 <xsl:element name="a"> | |
107 <xsl:attribute name="href"> | |
108 <xsl:call-template name="ref"> | |
109 <xsl:with-param name="refid" select="@refid" /> | |
110 <xsl:with-param name="kind" select="'compound'" /> | |
111 <xsl:with-param name="external" /> | |
112 </xsl:call-template> | |
113 </xsl:attribute> | |
114 <xsl:call-template name="short-type-name"> | |
115 <xsl:with-param name="typename" select="text()" /> | |
116 </xsl:call-template> | |
117 </xsl:element> | |
118 </xsl:template> | |
119 | |
120 <xsl:template name="docRefTextType"> | |
121 <xsl:element name="a"> | |
122 <xsl:attribute name="href"> | |
123 <xsl:call-template name="ref"> | |
124 <xsl:with-param name="refid" select="@refid" /> | |
125 <xsl:with-param name="kind" select="@kindref" /> | |
126 <xsl:with-param name="external" select="@external" /> | |
127 </xsl:call-template> | |
128 </xsl:attribute> | |
129 <xsl:apply-templates mode="docRefTextType" /> | |
130 </xsl:element> | |
131 </xsl:template> | |
132 | |
133 <!-- paragraph --> | |
134 <xsl:template name="docParaType"> | |
135 <p class="para"> | |
136 <xsl:apply-templates mode="docParaType" /> | |
137 </p> | |
138 </xsl:template> | |
139 | |
140 <!-- inline markup --> | |
141 <xsl:template name="docMarkupType"> | |
142 <xsl:choose> | |
143 <xsl:when test="name() = 'computeroutput'"> | |
144 <span class="docTextPre"> | |
145 <xsl:apply-templates mode="docMarkupType" /> | |
146 </span> | |
147 </xsl:when> | |
148 <xsl:otherwise> | |
149 <xsl:apply-templates mode="docMarkupType" /> | |
150 </xsl:otherwise> | |
151 </xsl:choose> | |
152 </xsl:template> | |
153 | |
154 <!-- paramlist --> | |
155 <xsl:template name="docParamListType"> | |
156 <div class="parameterlist"> | |
157 <h4> | |
158 <xsl:call-template name="translate-paramlist"> | |
159 <xsl:with-param name="name" select="@kind"/> | |
160 </xsl:call-template> | |
161 </h4> | |
162 <xsl:choose> | |
163 <xsl:when test="@kind = 'param'"> | |
164 <xsl:call-template name="docParamListType-param"/> | |
165 </xsl:when> | |
166 <xsl:otherwise> | |
167 <table class="pretty-table"> | |
168 <tr> | |
169 <th> | |
170 Parameter | |
171 </th> | |
172 <th> | |
173 Description | |
174 </th> | |
175 </tr> | |
176 <xsl:apply-templates mode="docParamListType" /> | |
177 </table> | |
178 </xsl:otherwise> | |
179 </xsl:choose> | |
180 </div> | |
181 </xsl:template> | |
182 | |
183 <xsl:template match="parameteritem" mode="docParamListType"> | |
184 <tr> | |
185 <td> | |
186 <xsl:apply-templates select="parameternamelist" /> | |
187 </td> | |
188 <td> | |
189 <xsl:apply-templates select="parameterdescription" /> | |
190 </td> | |
191 </tr> | |
192 </xsl:template> | |
193 | |
194 <xsl:template name="docParamListType-param"> | |
195 <table class="pretty-table"> | |
196 <tr> | |
197 <th> | |
198 Type | |
199 </th> | |
200 <th> | |
201 Parameter | |
202 </th> | |
203 <th> | |
204 Description | |
205 </th> | |
206 </tr> | |
207 <xsl:apply-templates mode="docParamListType-param" /> | |
208 </table> | |
209 </xsl:template> | |
210 | |
211 <xsl:template match="parameteritem" mode="docParamListType-param"> | |
212 <tr> | |
213 <td> | |
214 <xsl:apply-templates select="key('param-key', concat(generate-id(ancestor::memberdef),parameternamelist/parametername/text()))/type" mode="paramType" /> | |
215 </td> | |
216 <td> | |
217 <xsl:apply-templates select="parameternamelist" mode="docParamListItem"/> | |
218 </td> | |
219 <td> | |
220 <xsl:apply-templates select="parameterdescription" mode="docParamListItem"/> | |
221 </td> | |
222 </tr> | |
223 </xsl:template> | |
224 | |
225 <!-- section --> | |
226 <xsl:template name="sectiondefType"> | |
227 <div class="sectiondef"> | |
228 <h3> | |
229 <xsl:call-template name="section-label"> | |
230 <xsl:with-param name="name" select="@kind"/> | |
231 </xsl:call-template> | |
232 </h3> | |
233 <div> | |
234 <xsl:apply-templates mode="sectiondefType" /> | |
235 </div> | |
236 </div> | |
237 </xsl:template> | |
238 | |
239 <xsl:template name="docSimpleSectType"> | |
240 <div class="simplesection"> | |
241 <h3> | |
242 <xsl:call-template name="translate-simplesection"> | |
243 <xsl:with-param name="name" select="@kind"/> | |
244 </xsl:call-template> | |
245 </h3> | |
246 <div> | |
247 <xsl:apply-templates mode="docSimpleSectType" /> | |
248 </div> | |
249 </div> | |
250 </xsl:template> | |
251 | |
252 <xsl:template match="simplesectsep" mode="docSimpleSectType"><hr class="simplesectsep" /></xsl:template> | |
253 | |
254 <!-- SOURCE CODE FORMATTING --> | |
255 | |
256 <xsl:template name="listingType"> | |
257 <xsl:apply-templates mode="listingType"/> | |
258 </xsl:template> | |
259 <xsl:template name="codelineType"> | |
260 <div> | |
261 <xsl:apply-templates mode="codelineType"/> | |
262 </div> | |
263 </xsl:template> | |
264 <xsl:template match="sp" mode="highlightType"> | |
265 <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text> | |
266 </xsl:template> | |
267 <xsl:template match="highlight" mode="codelineType"> | |
268 <span class="{@class}"><xsl:call-template name="highlightType"/></span> | |
269 </xsl:template> | |
270 | |
271 <!-- TOOLS --> | |
272 <xsl:template name="link"> | |
273 <xsl:param name="refid" /> | |
274 <xsl:param name="kind" /> | |
275 <xsl:param name="external" select="''" /> | |
276 <xsl:param name="text" select="'[ link here ]'" /> | |
277 <xsl:param name="class" select="''"/> | |
278 <xsl:element name="a"> | |
279 <xsl:attribute name="href"> | |
280 <xsl:call-template name="ref"> | |
281 <xsl:with-param name="refid" select="$refid" /> | |
282 <xsl:with-param name="kind" select="$kind" /> | |
283 <xsl:with-param name="external" select="$external" /> | |
284 </xsl:call-template> | |
285 </xsl:attribute> | |
286 <xsl:if test="$class"> | |
287 <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute> | |
288 </xsl:if> | |
289 <xsl:choose> | |
290 <xsl:when test="*"> | |
291 <xsl:copy-of select="$text"/> | |
292 </xsl:when> | |
293 <xsl:otherwise> | |
294 <xsl:value-of select="$text"/> | |
295 </xsl:otherwise> | |
296 </xsl:choose> | |
297 </xsl:element> | |
298 | |
299 </xsl:template> | |
300 <xsl:template name="ref"> | |
301 <xsl:param name="refid" /> | |
302 <xsl:param name="kind" /> | |
303 <xsl:param name="external" select="''" /> | |
304 <xsl:choose> | |
305 <xsl:when test="$kind = 'member'"> | |
306 <xsl:value-of select="concat($members,'/',$refid)" /> | |
307 </xsl:when> | |
308 <xsl:when test="$kind = 'compound'"> | |
309 <xsl:value-of select="concat($compounds,'/',$refid)" /> | |
310 </xsl:when> | |
311 <xsl:otherwise></xsl:otherwise> | |
312 </xsl:choose> | |
313 </xsl:template> | |
314 | |
315 <xsl:template name="string-replace-all"> | |
316 <xsl:param name="text" /> | |
317 <xsl:param name="replace" /> | |
318 <xsl:param name="with" /> | |
319 <xsl:choose> | |
320 <xsl:when test="contains($text, $replace)"> | |
321 <xsl:value-of select="substring-before($text,$replace)" /> | |
322 <xsl:value-of select="$with" /> | |
323 <xsl:call-template name="string-replace-all"> | |
324 <xsl:with-param name="text" | |
325 select="substring-after($text,$replace)" /> | |
326 <xsl:with-param name="replace" select="$replace" /> | |
327 <xsl:with-param name="with" select="$with" /> | |
328 </xsl:call-template> | |
329 </xsl:when> | |
330 <xsl:otherwise> | |
331 <xsl:value-of select="$text" /> | |
332 </xsl:otherwise> | |
333 </xsl:choose> | |
334 </xsl:template> | |
335 | |
336 <xsl:template name="full-type-name"> | |
337 <xsl:param name="typename" /> | |
338 <xsl:call-template name="string-replace-all"> | |
339 <xsl:with-param name="text" select="$typename" /> | |
340 <xsl:with-param name="replace" select="'::'" /> | |
341 <xsl:with-param name="with" select="'.'" /> | |
342 </xsl:call-template> | |
343 </xsl:template> | |
344 | |
345 <xsl:template name="short-type-name"> | |
346 <xsl:param name="typename" /> | |
347 <xsl:choose> | |
348 <xsl:when test="contains($typename,'::')"> | |
349 <xsl:call-template name="short-type-name"> | |
350 <xsl:with-param name="typename" | |
351 select="substring-after($typename,'::')" /> | |
352 </xsl:call-template> | |
353 </xsl:when> | |
354 <xsl:otherwise> | |
355 <xsl:value-of select="$typename" /> | |
356 </xsl:otherwise> | |
357 </xsl:choose> | |
358 </xsl:template> | |
359 | |
360 <xsl:template name="section-label"> | |
361 <xsl:param name="name"/> | |
362 <xsl:variable name="label" select="$labels/labels/sections/label[@name = $name]"/> | |
363 <xsl:choose> | |
364 <xsl:when test="$label"><xsl:value-of select="$label"/></xsl:when> | |
365 <xsl:otherwise><xsl:value-of select="$name" /></xsl:otherwise> | |
366 </xsl:choose> | |
367 </xsl:template> | |
368 | |
369 <xsl:template name="translate-section"> | |
370 <xsl:param name="name"/> | |
371 <xsl:variable name="label" select="$labels/labels/sections/label[@name = $name]"/> | |
372 <xsl:choose> | |
373 <xsl:when test="$label"><xsl:value-of select="$label"/></xsl:when> | |
374 <xsl:otherwise><xsl:value-of select="$name" /></xsl:otherwise> | |
375 </xsl:choose> | |
376 </xsl:template> | |
377 | |
378 <xsl:template name="translate-simplesection"> | |
379 <xsl:param name="name"/> | |
380 <xsl:variable name="label" select="$labels/labels/simplesections/label[@name = $name]"/> | |
381 <xsl:choose> | |
382 <xsl:when test="$label"><xsl:value-of select="$label"/></xsl:when> | |
383 <xsl:otherwise><xsl:value-of select="$name" /></xsl:otherwise> | |
384 </xsl:choose> | |
385 </xsl:template> | |
386 | |
387 <xsl:template name="translate-paramlist"> | |
388 <xsl:param name="name"/> | |
389 <xsl:variable name="label" select="$labels/labels/paramlists/label[@name = $name]"/> | |
390 <xsl:choose> | |
391 <xsl:when test="$label"><xsl:value-of select="$label"/></xsl:when> | |
392 <xsl:otherwise><xsl:value-of select="$name" /></xsl:otherwise> | |
393 </xsl:choose> | |
394 </xsl:template> | |
395 | |
396 </xsl:stylesheet> |