4 mono-ecma-impl.xsl: ECMA-style docs to HTML stylesheet trasformation
6 Author: Joshua Tauberer (tauberer@for.net)
7 Author: Jonathan Pryor (jpryor@novell.com)
9 This file requires that including files define the following callable
11 - CreateCodeBlock (language, content)
12 - CreateEnumerationTable (content)
13 - CreateHeader (content)
14 - CreateListTable (header, content)
15 - CreateMembersTable (content)
16 - CreateSignature (content)
17 - CreateTypeDocumentationTable (content)
23 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
24 xmlns:
monodoc=
"monodoc:///extensions"
25 exclude-result-prefixes=
"monodoc"
27 <xsl:include href=
"mdoc-html-utils.xsl" />
29 <!-- TEMPLATE PARAMETERS -->
31 <xsl:param name=
"show"/>
32 <xsl:param name=
"membertype"/>
33 <xsl:param name=
"namespace"/>
35 <!-- THE MAIN RENDERING TEMPLATE -->
37 <xsl:template match=
"Type|elements">
38 <!-- The namespace that the current type belongs to. -->
39 <xsl:variable name=
"TypeNamespace" select=
"substring(@FullName, 1, string-length(@FullName) - string-length(@Name) - 1)"/>
43 <xsl:variable name=
"typename" select=
"translate (@FullName, '+', '.')" />
44 <xsl:variable name=
"typelink">
45 <xsl:call-template name=
"GetEscapedTypeName">
46 <xsl:with-param name=
"typename" select=
"@FullName" />
49 <xsl:variable name=
"basename">
50 <xsl:if test=
"Base/BaseTypeName">
51 <xsl:value-of select=
"translate (Base/BaseTypeName, '+', '.')" />
54 <xsl:variable name=
"baselink">
55 <xsl:if test=
"Base/BaseTypeName">
56 <xsl:call-template name=
"GetEscapedTypeName">
57 <xsl:with-param name=
"typename" select=
"Base/BaseTypeName" />
62 <xsl:call-template name=
"CreateHeader">
63 <xsl:with-param name=
"content">
64 <i class=
"subtitle">Mono Class Library
</i>
67 <xsl:when test=
"$show='masteroverview'">
69 <xsl:when test=
"$show='typeoverview'">
70 <xsl:text>:
</xsl:text>
72 <xsl:attribute name=
"href">N:
<xsl:value-of select=
"$TypeNamespace"/></xsl:attribute>
73 <xsl:value-of select=
"$TypeNamespace"/> Namespace
</a>
75 <xsl:when test=
"$show='members'">
76 <xsl:text>:
</xsl:text>
78 <xsl:attribute name=
"href">
79 <xsl:text>T:
</xsl:text>
80 <xsl:value-of select=
"$typelink" />
82 <xsl:value-of select=
"typename"/> Overview
</a>
84 <xsl:when test=
"$show='member' or $show='overloads'">
85 <xsl:text>:
</xsl:text>
87 <xsl:attribute name=
"href">
88 <xsl:text>T:
</xsl:text>
89 <xsl:value-of select=
"$typelink" />
91 <xsl:value-of select=
"$typename"/> Overview
</a>
92 <xsl:text> |
</xsl:text>
94 <xsl:attribute name=
"href">
95 <xsl:text>T:
</xsl:text>
96 <xsl:value-of select=
"$typelink" />
97 <xsl:text>/*
</xsl:text>
99 <xsl:text>Members
</xsl:text>
102 <xsl:when test=
"$show='namespace'">
103 <xsl:text>:
</xsl:text>
104 <a href=
"root:/classlib">Namespaces
</a>
110 <xsl:when test=
"$show='masteroverview'">
111 <xsl:text>Master Overview
</xsl:text>
113 <xsl:when test=
"$show='typeoverview'">
114 <xsl:value-of select=
"$typename"/>
115 <xsl:value-of select=
"' '"/>
116 <xsl:call-template name=
"gettypetype"/>
118 <xsl:when test=
"$show='members' and $membertype='All'">
119 <xsl:value-of select=
"$typename"/>
120 <xsl:text>: Members
</xsl:text>
122 <xsl:when test=
"$show='members'">
123 <xsl:value-of select=
"$typename"/>
124 <xsl:text>:
</xsl:text>
125 <xsl:value-of select=
"$membertype"/>
126 <xsl:text> Members
</xsl:text>
128 <xsl:when test=
"$show='member'">
130 <xsl:when test=
"$membertype='Operator'">
131 <xsl:value-of select=
"$typename"/>
132 <xsl:value-of select=
"' '"/> <!-- hard space -->
133 <xsl:value-of select=
"substring-after(Members/Member[MemberType='Method'][position()=$index+1]/@MemberName, 'op_')"/>
135 <xsl:when test=
"$membertype='Constructor'">
136 <xsl:value-of select=
"$typename"/>
139 <xsl:value-of select=
"$typename"/>.
<xsl:value-of select=
"Members/Member[MemberType=$membertype][position()=$index+1]/@MemberName"/>
142 <xsl:value-of select=
"' '"/>
143 <xsl:value-of select=
"$membertype"/>
146 <xsl:when test=
"$show='namespace'">
147 <xsl:value-of select=
"$namespace"/>
148 <xsl:text> Namespace
</xsl:text>
151 <xsl:when test=
"$show='overloads'">
152 <xsl:value-of select=
"$typename"/>.
<xsl:value-of select=
"$index"/> Overloads
160 <!-- SELECT WHAT TYPE OF VIEW:
165 <div class=
"Content">
167 <xsl:when test=
"$show='masteroverview'">
169 <xsl:for-each select=
"namespace">
170 <xsl:sort select=
"@ns"/>
172 <!-- Don't display the namespace if it is a sub-namespace of another one.
173 But don't consider namespaces without periods, e.g. 'System', to be
174 parent namespaces because then most everything will get grouped under it. -->
175 <xsl:variable name=
"ns" select=
"@ns"/>
176 <xsl:if test=
"count(parent::*/namespace[not(substring-before(@ns, '.')='') and starts-with($ns, concat(@ns, '.'))])=0">
179 <b><a href=
"N:{@ns}"><xsl:value-of select=
"@ns"/></a></b>
183 <xsl:apply-templates select=
"summary" mode=
"notoppara"/>
186 <!-- Display the sub-namespaces of this namespace -->
187 <xsl:if test=
"not(substring-before($ns, '.')='')">
188 <xsl:for-each select=
"parent::*/namespace[starts-with(@ns, concat($ns, '.'))]">
190 <div><a href=
"N:{@ns}"><xsl:value-of select=
"@ns"/></a></div>
191 <div><xsl:apply-templates select=
"summary" mode=
"notoppara"/></div>
200 <!-- TYPE OVERVIEW -->
201 <xsl:when test=
"$show='typeoverview'">
202 <xsl:variable name=
"implemented" select=
"monodoc:MonoImpInfo(string(AssemblyInfo/AssemblyName), string(@FullName), true())" />
203 <xsl:call-template name=
"CreateTypeOverview">
204 <xsl:with-param name=
"implemented" select=
"$implemented" />
205 <xsl:with-param name=
"show-members-link" select=
"true()" />
210 <xsl:call-template name=
"CreateTypeSignature" />
212 <xsl:call-template name=
"DisplayDocsInformation">
213 <xsl:with-param name=
"linkid" select=
"concat ('T:', @FullName)" />
217 <!-- MEMBER LISTING -->
218 <xsl:when test=
"$show='members'">
219 <xsl:if test=
"$membertype='All'">
221 The members of
<xsl:value-of select=
"$typename"/> are listed below.
224 <xsl:if test=
"Base/BaseTypeName">
226 <xsl:text>See Also:
</xsl:text>
228 <xsl:attribute name=
"href">T:
<xsl:value-of select=
"$baselink"/>/*
</xsl:attribute>
229 <xsl:text>Inherited members from
</xsl:text>
230 <xsl:value-of select=
"$basename"/>
235 <ul class=
"TypeMembersIndex">
236 <xsl:if test=
"count(Members/Member[MemberType='Constructor'])">
238 <a><xsl:attribute name=
"href">T:
<xsl:value-of select=
"$typelink"/>/C
</xsl:attribute>Constructors
</a>
241 <xsl:if test=
"count(Members/Member[MemberType='Field'])">
243 <a><xsl:attribute name=
"href">T:
<xsl:value-of select=
"$typelink"/>/F
</xsl:attribute>Fields
</a>
246 <xsl:if test=
"count(Members/Member[MemberType='Property'])">
248 <a><xsl:attribute name=
"href">T:
<xsl:value-of select=
"$typelink"/>/P
</xsl:attribute>Properties
</a>
251 <xsl:if test=
"count(Members/Member[MemberType='Method' and not(starts-with(@MemberName,'op_'))])">
253 <a><xsl:attribute name=
"href">T:
<xsl:value-of select=
"$typelink"/>/M
</xsl:attribute>Methods
</a>
256 <xsl:if test=
"count(Members/Member[MemberType='Event'])">
258 <a><xsl:attribute name=
"href">T:
<xsl:value-of select=
"$typelink"/>/E
</xsl:attribute>Events
</a>
261 <xsl:if test=
"count(Members/Member[MemberType='Method' and starts-with(@MemberName,'op_')])">
263 <a><xsl:attribute name=
"href">T:
<xsl:value-of select=
"$typelink"/>/E
</xsl:attribute>Events
</a>
266 <xsl:if test=
"count(Members/Member[MemberType='ExtensionMethod'])">
268 <a><xsl:attribute name=
"href">T:
<xsl:value-of select=
"$typelink"/>/X
</xsl:attribute>Extension Methods
</a>
273 <!-- list each type of member (public, then protected) -->
275 <xsl:call-template name=
"ListAllMembers" />
278 <xsl:if test=
"not($membertype='All')">
279 <!-- list the members of this type (public, then protected) -->
283 <xsl:call-template name=
"membertypeplurallc"><xsl:with-param name=
"name" select=
"$membertype"/></xsl:call-template>
284 of
<xsl:value-of select=
"$typename"/> are listed below. For a list of all members, see the
<a>
285 <xsl:attribute name=
"href">T:
<xsl:value-of select=
"$typelink"/>/*
</xsl:attribute>
286 <xsl:value-of select=
"@Name"/> Members
</a> list.
289 <xsl:if test=
"Base/BaseTypeName">
291 <xsl:text>See Also:
</xsl:text>
293 <xsl:attribute name=
"href">T:
<xsl:value-of select=
"$baselink"/>/*
</xsl:attribute>
294 <xsl:text>Inherited members from
</xsl:text>
295 <xsl:value-of select=
"$basename"/>
300 <xsl:call-template name=
"ListMembers">
301 <xsl:with-param name=
"listmembertype" select=
"$membertype"/>
302 <xsl:with-param name=
"showprotected" select=
"false()"/>
305 <xsl:call-template name=
"ListMembers">
306 <xsl:with-param name=
"listmembertype" select=
"$membertype"/>
307 <xsl:with-param name=
"showprotected" select=
"true()"/>
313 <xsl:when test=
"$show='overloads'">
315 The overloads of
<xsl:value-of select=
"$index"/>
316 are listed below. For a list of all members, see the
<a>
317 <xsl:attribute name=
"href">T:
<xsl:value-of select=
"$typelink"/>/*
</xsl:attribute>
318 <xsl:value-of select=
"@Name"/> Members
</a> list.
321 <!-- TODO: can we make this actually test if there are any overloads
322 <xsl:if test="Base/BaseTypeName">
325 <xsl:attribute name="href">T:<xsl:value-of select="Base/BaseTypeName"/>/*</xsl:attribute>
326 Inherited members</a> from <xsl:value-of select="Base/BaseTypeName"/>
331 <xsl:call-template name=
"ListMembers">
332 <xsl:with-param name=
"listmembertype" select=
"$membertype"/>
333 <xsl:with-param name=
"showprotected" select=
"false()"/>
334 <xsl:with-param name=
"overloads-mode" select=
"true()"/>
337 <xsl:call-template name=
"ListMembers">
338 <xsl:with-param name=
"listmembertype" select=
"$membertype"/>
339 <xsl:with-param name=
"showprotected" select=
"true()"/>
340 <xsl:with-param name=
"overloads-mode" select=
"true()"/>
343 <!-- MEMBER DETAILS -->
344 <xsl:when test=
"$show='member'">
345 <xsl:variable name=
"Type" select=
"."/>
347 <!-- select the member, this just loops through the one member that we are to display -->
348 <xsl:for-each select=
"Members/Member[MemberType=$membertype or ($membertype='Operator' and MemberType='Method')][position()=$index+1]">
352 <xsl:call-template name=
"CreateMemberOverview">
353 <xsl:with-param name=
"implemented" select=
"monodoc:MonoImpInfo(string(AssemblyInfo/AssemblyName), string(@FullName), true())" />
356 <xsl:call-template name=
"CreateMemberSignature">
357 <xsl:with-param name=
"linkid" select=
"concat ('T:', @FullName)" />
360 <div class=
"MemberBox">
361 <xsl:call-template name=
"DisplayDocsInformation">
362 <xsl:with-param name=
"linkid" select=
"concat ('T:', @FullName)" />
370 <!-- NAMESPACE SUMMARY -->
371 <xsl:when test=
"$show='namespace'">
376 <xsl:apply-templates select=
"summary" mode=
"notoppara"/>
377 <xsl:if test=
"monodoc:MonoEditing()">
378 <xsl:value-of select=
"' '" />
379 [
<a href=
"{monodoc:EditUrlNamespace (., $namespace, 'summary')}">Edit
</a>]
385 <xsl:if test=
"not(remarks = '')">
388 <xsl:apply-templates select=
"remarks"/>
389 <xsl:if test=
"monodoc:MonoEditing()">
390 <xsl:value-of select=
"' '" />
391 [
<a href=
"{monodoc:EditUrlNamespace (., $namespace, 'remarks')}">Edit
</a>]
396 <xsl:call-template name=
"namespacetypes">
397 <xsl:with-param name=
"typetype" select=
"'class'"/>
398 <xsl:with-param name=
"typetitle" select=
"'Classes'"/>
401 <xsl:call-template name=
"namespacetypes">
402 <xsl:with-param name=
"typetype" select=
"'interface'"/>
403 <xsl:with-param name=
"typetitle" select=
"'Interfaces'"/>
406 <xsl:call-template name=
"namespacetypes">
407 <xsl:with-param name=
"typetype" select=
"'struct'"/>
408 <xsl:with-param name=
"typetitle" select=
"'Structs'"/>
411 <xsl:call-template name=
"namespacetypes">
412 <xsl:with-param name=
"typetype" select=
"'delegate'"/>
413 <xsl:with-param name=
"typetitle" select=
"'Delegates'"/>
416 <xsl:call-template name=
"namespacetypes">
417 <xsl:with-param name=
"typetype" select=
"'enum'"/>
418 <xsl:with-param name=
"typetitle" select=
"'Enumerations'"/>
424 <!-- don't know what kind of page this is -->
426 Don't know what to do!
436 This documentation is part of the
<a target=
"_top" title=
"Mono Project" href=
"http://www.mono-project.com/">Mono Project
</a>.
441 <xsl:template name=
"GetLinkTarget">
442 <xsl:param name=
"type" />
443 <xsl:param name=
"cref" />
445 <xsl:value-of select=
"$cref" />
448 <xsl:template name=
"namespacetypes">
449 <xsl:param name=
"typetype"/>
450 <xsl:param name=
"typetitle"/>
452 <xsl:variable name=
"NODES" select=
"*[name()=$typetype]"/>
454 <xsl:if test=
"count($NODES)">
456 <xsl:call-template name=
"CreateH4Section">
457 <xsl:with-param name=
"name" select=
"$typetitle" />
458 <xsl:with-param name=
"child-id" select=
"$typetitle" />
459 <xsl:with-param name=
"content">
461 <xsl:call-template name=
"CreateTypeDocumentationTable">
462 <xsl:with-param name=
"content">
463 <xsl:for-each select=
"$NODES">
464 <xsl:sort select=
"@name"/>
469 <xsl:attribute name=
"href">
470 <xsl:text>T:
</xsl:text>
471 <xsl:call-template name=
"GetEscapedTypeName">
472 <xsl:with-param name=
"typename" select=
"@fullname" />
475 <xsl:value-of select=
"@name"/>
478 <xsl:variable name=
"containingtype" select=
"substring-before(@fullname, concat('+',@name))"/>
479 <xsl:if test=
"$containingtype">
481 <xsl:call-template name=
"maketypelink">
482 <xsl:with-param name=
"type" select=
"$containingtype"/>
483 <xsl:with-param name=
"wrt" select=
"$namespace"/>
484 </xsl:call-template>)
488 <xsl:apply-templates select=
"summary" mode=
"notoppara"/>
490 <xsl:variable name=
"MonoImplInfo" select=
"monodoc:MonoImpInfo(string(@assembly), string(@fullname), false())"/>
491 <xsl:if test=
"$MonoImplInfo"><br/><b><xsl:value-of disable-output-escaping=
"yes" select=
"$MonoImplInfo"/></b></xsl:if>
503 <xsl:template name=
"CreateEditLink">
504 <xsl:param name=
"e" />
505 <xsl:if test=
"monodoc:MonoEditing()">
506 <xsl:value-of select=
"' '" />
507 [
<a href=
"{monodoc:EditUrl ($e)}">Edit
</a>]