2010-05-19 Jb Evain <jbevain@novell.com>
[mcs.git] / tools / monodoc / Resources / mdoc-html-utils.xsl
blob43e327fac40ac5084ad81b0c82485b460fbe124f
1 <?xml version="1.0"?>
3 <!--
4 mdoc-html-utils.xsl: ECMA-style docs to HTML stylesheet transformation utils
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
10 templates:
11 - CreateCodeBlock (language, content)
12 - CreateEnumerationTable (content)
13 - CreateHeader (content)
14 - CreateListTable (header, content)
15 - CreateMembersTable (content)
16 - CreateSignature (content)
17 - CreateTypeDocumentationTable (content)
18 - GetLinkTarget (type, cref)
19 - CreateEditLink (e)
21 -->
23 <xsl:stylesheet
24 version="1.0"
25 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
26 xmlns:msxsl="urn:schemas-microsoft-com:xslt"
27 exclude-result-prefixes="msxsl"
29 <xsl:import href="mdoc-html-format.xsl" />
31 <!-- TEMPLATE PARAMETERS -->
32 <xsl:param name="language" select="'C#'"/>
33 <xsl:param name="index" />
35 <xsl:variable name="ThisType" select="/Type"/>
37 <!-- The namespace that the current type belongs to. -->
38 <xsl:variable name="TypeNamespace" select="substring(/Type/@FullName, 1, string-length(/Type/@FullName) - string-length(/Type/@Name) - 1)"/>
40 <!-- THE MAIN RENDERING TEMPLATE -->
42 <!-- TYPE OVERVIEW -->
44 <xsl:template name="CreateTypeOverview">
45 <xsl:param name="implemented" />
46 <xsl:param name="show-members-link" />
48 <xsl:attribute name="id">
49 <xsl:text>T:</xsl:text>
50 <xsl:call-template name="GetEscapedTypeName">
51 <xsl:with-param name="typename" select="@FullName" />
52 </xsl:call-template>
53 <xsl:text>:Summary</xsl:text>
54 </xsl:attribute>
55 <!-- summary -->
56 <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
57 <xsl:apply-templates select="Docs/summary" mode="editlink"/>
59 <xsl:if test="$implemented">
60 <p><b>Mono Implementation Note: </b></p>
61 <blockquote>
62 <xsl:value-of disable-output-escaping="yes" select="$implemented"/>
63 </blockquote>
64 </xsl:if>
66 <xsl:if test="$show-members-link and not(Base/BaseTypeName='System.Enum' or Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.MulticastDelegate') and count(Members)">
67 <p>
68 See Also:
69 <a>
70 <xsl:attribute name="href">
71 <xsl:text>T</xsl:text>
72 <xsl:call-template name="GetLinkId">
73 <xsl:with-param name="type" select="." />
74 <xsl:with-param name="member" select="." />
75 </xsl:call-template>
76 <xsl:text>/*</xsl:text>
77 </xsl:attribute>
78 <xsl:value-of select="translate(@Name, '+', '.')"/>
79 <xsl:value-of select="' '" />
80 <xsl:text>Members</xsl:text>
81 </a>
82 </p>
83 </xsl:if>
85 <!--
86 Inheritance tree, but only for non-standard classes and not for interfaces
87 -->
88 <xsl:if test="not(Base/BaseTypeName='System.Enum' or Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.ValueType' or Base/BaseTypeName='System.Object' or Base/BaseTypeName='System.MulticatDelegate' or count(Base/ParentType)=0)">
89 <p>
90 <xsl:for-each select="Base/ParentType">
91 <xsl:sort select="@Order" order="descending"/>
92 <xsl:variable name="p" select="position()" />
93 <xsl:for-each select="parent::Base/ParentType[position() &lt; $p]">
94 <xsl:value-of select="'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'" disable-output-escaping="yes"/>
95 </xsl:for-each>
96 <a>
97 <xsl:attribute name="href">
98 <xsl:call-template name="GetLinkTargetHtml">
99 <xsl:with-param name="type" select="@Type" />
100 <xsl:with-param name="cref">
101 <xsl:text>T:</xsl:text>
102 <xsl:call-template name="GetEscapedTypeName">
103 <xsl:with-param name="typename" select="@Type" />
104 </xsl:call-template>
105 </xsl:with-param>
106 </xsl:call-template>
107 </xsl:attribute>
108 <xsl:value-of select="@Type"/>
109 </a>
110 <br/>
111 </xsl:for-each>
113 <xsl:for-each select="Base/ParentType">
114 <xsl:value-of select="'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'" disable-output-escaping="yes"/>
115 </xsl:for-each>
116 <xsl:value-of select="@FullName"/>
117 </p>
118 </xsl:if>
119 <!--
120 <xsl:if test="Base/BaseTypeName='System.Enum'">
121 <br/>
122 The type of the values in this enumeration is
123 <xsl:apply-templates select="Members/Member[@MemberName='value__']/ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>.
124 </xsl:if>
126 </xsl:template>
128 <xsl:template name="CreateTypeSignature">
129 <xsl:attribute name="id">
130 <xsl:text>T:</xsl:text>
131 <xsl:call-template name="GetEscapedTypeName">
132 <xsl:with-param name="typename" select="@FullName" />
133 </xsl:call-template>
134 <xsl:text>:Signature</xsl:text>
135 </xsl:attribute>
136 <!-- signature -->
137 <xsl:call-template name="CreateSignature">
138 <xsl:with-param name="content">
139 <xsl:choose>
140 <xsl:when test="$language='C#'">
142 <xsl:for-each select="Attributes/Attribute">
143 <xsl:text>[</xsl:text>
144 <xsl:value-of select="AttributeName"/>
145 <xsl:text>]</xsl:text>
146 <br/>
147 </xsl:for-each>
149 <xsl:for-each select="ReturnValue/Attributes/Attribute">
150 <xsl:text>[return:</xsl:text>
151 <xsl:value-of select="AttributeName"/>
152 <xsl:text>]</xsl:text>
153 <br/>
154 </xsl:for-each>
156 <xsl:choose>
158 <xsl:when test="Base/BaseTypeName='System.Enum'">
159 <xsl:call-template name="getmodifiers">
160 <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
161 </xsl:call-template>
163 <xsl:text>enum </xsl:text>
165 <!-- member name, argument list -->
167 <xsl:value-of select="translate (@Name, '+', '.')"/>
168 </b>
169 </xsl:when>
171 <xsl:when test="Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.MulticastDelegate'">
172 <xsl:choose>
174 <xsl:when test="count(Parameters) &gt; 0 and count(ReturnValue) &gt; 0">
175 <!-- Only recreate the delegate signature if the appropriate information
176 is present in the XML file. -->
178 <xsl:call-template name="getmodifiers">
179 <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
180 </xsl:call-template>
182 <xsl:text>delegate </xsl:text>
184 <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
186 <!-- hard space -->
187 <xsl:value-of select="' '"/>
189 <!-- member name, argument list -->
191 <xsl:call-template name="GetDefinitionName">
192 <xsl:with-param name="name" select="translate (@Name, '+', '.')" />
193 <xsl:with-param name="TypeParameters" select="TypeParameters" />
194 </xsl:call-template>
195 </b>
197 <!-- hard space -->
198 <xsl:value-of select="' '"/>
200 <xsl:value-of select="'('"/> <!-- prevents whitespace issues -->
202 <xsl:for-each select="Parameters/Parameter">
203 <xsl:call-template name="ShowParameter">
204 <xsl:with-param name="Param" select="."/>
205 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
206 </xsl:call-template>
208 <xsl:if test="not(position()=last())">, </xsl:if>
209 </xsl:for-each>
211 <xsl:value-of select="')'"/>
213 </xsl:when>
215 <xsl:otherwise>
216 <xsl:apply-templates select="TypeSignature[@Language=$language]/@Value"/>
217 </xsl:otherwise>
219 </xsl:choose>
222 </xsl:when>
224 <xsl:otherwise>
225 <xsl:call-template name="getmodifiers">
226 <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
227 <xsl:with-param name="typetype" select="true()"/>
228 </xsl:call-template>
230 <xsl:value-of select="' '"/>
233 <xsl:call-template name="GetDefinitionName">
234 <xsl:with-param name="name" select="translate (@Name, '+', '.')" />
235 <xsl:with-param name="TypeParameters" select="TypeParameters" />
236 </xsl:call-template>
237 </b>
239 <xsl:variable name="HasStandardBaseType" select="Base/BaseTypeName='System.Object' or Base/BaseTypeName='System.ValueType'"/>
240 <xsl:variable name="HasBaseType" select="count(Base/BaseTypeName)>0"/>
241 <xsl:if test="(($HasBaseType) and not($HasStandardBaseType)) or not(count(Interfaces/Interface)=0)">
242 <xsl:text> : </xsl:text>
244 <xsl:if test="$HasBaseType and not($HasStandardBaseType)">
245 <xsl:apply-templates select="Base/BaseTypeName" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
246 <xsl:if test="not(count(Interfaces/Interface)=0)">, </xsl:if>
247 </xsl:if>
249 <xsl:for-each select="Interfaces/Interface">
250 <xsl:if test="not(position()=1)">, </xsl:if>
251 <xsl:apply-templates select="InterfaceName" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
252 </xsl:for-each>
254 </xsl:if>
255 </xsl:otherwise>
257 </xsl:choose>
259 <xsl:call-template name="CreateGenericConstraints">
260 <xsl:with-param name="TypeParameters" select="TypeParameters" />
261 </xsl:call-template>
263 </xsl:when>
265 <xsl:otherwise>
266 <xsl:apply-templates select="TypeSignature[@Language=$language]/@Value"/>
267 </xsl:otherwise>
269 </xsl:choose>
270 </xsl:with-param>
271 </xsl:call-template>
272 </xsl:template>
274 <xsl:template name="GetDefinitionName">
275 <xsl:param name="name" />
276 <xsl:param name="TypeParameters" />
278 <xsl:choose>
279 <!-- do NOT process explicitly implemented generic interface members
280 unless they're actually generic methods. -->
281 <xsl:when test="contains ($name, '&gt;') and
282 '&gt;' = substring ($name, string-length ($name), 1)">
283 <xsl:value-of select="substring-before ($name, '&lt;')" />
284 <xsl:text>&lt;</xsl:text>
285 <xsl:for-each select="$TypeParameters/TypeParameter">
286 <xsl:for-each select="Attributes/Attribute">
287 <xsl:text>[</xsl:text>
288 <xsl:value-of select="AttributeName"/>
289 <xsl:text>] </xsl:text>
290 </xsl:for-each>
291 <xsl:choose>
292 <xsl:when test="@Name">
293 <xsl:value-of select="@Name" />
294 </xsl:when>
295 <xsl:otherwise>
296 <xsl:value-of select="." />
297 </xsl:otherwise>
298 </xsl:choose>
299 <xsl:if test="not(position()=last())">, </xsl:if>
300 </xsl:for-each>
301 <xsl:text>&gt;</xsl:text>
302 </xsl:when>
303 <xsl:otherwise>
304 <xsl:value-of select="$name" />
305 </xsl:otherwise>
306 </xsl:choose>
307 </xsl:template>
309 <xsl:template name="CreateGenericConstraints">
310 <xsl:param name="TypeParameters" />
312 <xsl:for-each select="$TypeParameters/TypeParameter">
313 <xsl:if test="count(Constraints/*) > 0">
314 <xsl:call-template name="CreateGenericParameterConstraints">
315 <xsl:with-param name="constraints" select="Constraints" />
316 </xsl:call-template>
317 </xsl:if>
318 </xsl:for-each>
319 </xsl:template>
321 <xsl:template name="CreateGenericParameterConstraints">
322 <xsl:param name="constraints" />
324 <br />
325 <xsl:text> where </xsl:text>
326 <xsl:value-of select="@Name" />
327 <xsl:text> : </xsl:text>
328 <xsl:variable name="kind"
329 select="count($constraints[ParameterAttribute='ReferenceTypeConstraint'])+
330 count($constraints[ParameterAttribute='NotNullableValueTypeConstraint'])" />
331 <xsl:variable name="base" select="count($constraints/BaseTypeName)" />
332 <xsl:variable name="iface" select="count($constraints/InterfaceName)" />
333 <xsl:variable name="struct" select="$constraints/ParameterAttribute='NotNullableValueTypeConstraint'" />
334 <xsl:if test="$constraints/ParameterAttribute='ReferenceTypeConstraint'">
335 <xsl:text>class</xsl:text>
336 </xsl:if>
337 <xsl:if test="$constraints/ParameterAttribute='NotNullableValueTypeConstraint'">
338 <xsl:text>struct</xsl:text>
339 </xsl:if>
340 <xsl:if test="$constraints/BaseTypeName and not($struct)">
341 <xsl:if test="$kind">, </xsl:if>
342 <xsl:apply-templates select="$constraints/BaseTypeName" mode="typelink" />
343 </xsl:if>
344 <xsl:for-each select="$constraints/InterfaceName">
345 <xsl:if test="position()=1">
346 <xsl:if test="$kind or $base">, </xsl:if>
347 </xsl:if>
348 <xsl:apply-templates select="." mode="typelink" />
349 <xsl:if test="not(position()=last())">, </xsl:if>
350 </xsl:for-each>
351 <xsl:if test="$constraints/ParameterAttribute='DefaultConstructorConstraint' and not($struct)">
352 <xsl:if test="$base or $iface">, </xsl:if>
353 <xsl:text>new()</xsl:text>
354 </xsl:if>
355 </xsl:template>
357 <xsl:template name="CreateMemberOverview">
358 <xsl:param name="implemented" />
360 <p class="Summary">
361 <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
362 <xsl:apply-templates select="Docs/summary" mode="editlink"/>
363 </p>
365 <xsl:if test="$implemented">
366 <p><b>Mono Implementation Note: </b></p>
367 <blockquote>
368 <xsl:value-of disable-output-escaping="yes" select="$implemented"/>
369 </blockquote>
370 </xsl:if>
372 <!-- member value -->
373 <xsl:if test="MemberValue">
374 <p><b>Value: </b>
375 <xsl:value-of select="MemberValue"/>
376 </p>
377 </xsl:if>
379 </xsl:template>
381 <xsl:template name="CreateMemberSignature">
382 <xsl:param name="linkid" select="''" />
384 <xsl:call-template name="CreateSignature">
385 <xsl:with-param name="content">
386 <xsl:if test="contains(MemberSignature[@Language='C#']/@Value,'this[')">
387 <p><i>This is the default property for this class.</i></p>
388 </xsl:if>
390 <!-- recreate the signature -->
392 <xsl:for-each select="Attributes/Attribute[AttributeName != 'System.Runtime.CompilerServices.Extension']">
393 <xsl:text>[</xsl:text>
394 <xsl:value-of select="AttributeName"/>
395 <xsl:text>]</xsl:text>
396 <br/>
397 </xsl:for-each>
399 <xsl:for-each select="ReturnValue/Attributes/Attribute">
400 <xsl:text>[return:</xsl:text>
401 <xsl:value-of select="AttributeName"/>
402 <xsl:text>]</xsl:text>
403 <br/>
404 </xsl:for-each>
406 <xsl:call-template name="getmodifiers">
407 <xsl:with-param name="sig" select="MemberSignature[@Language='C#']/@Value"/>
408 </xsl:call-template>
410 <xsl:if test="MemberType = 'Event'">
411 <xsl:text>event </xsl:text>
413 <xsl:if test="ReturnValue/ReturnType=''">
414 <xsl:value-of select="substring-before(substring-after(MemberSignature[@Language='C#']/@Value, 'event '), concat(' ', @MemberName))"/>
415 </xsl:if>
416 </xsl:if>
418 <!-- return value (comes out "" where not applicable/available) -->
419 <xsl:choose>
420 <xsl:when test="@MemberName='op_Implicit'">
421 <xsl:text>implicit operator</xsl:text>
422 </xsl:when>
423 <xsl:when test="@MemberName='op_Explicit'">
424 <xsl:text>explicit operator</xsl:text>
425 </xsl:when>
426 <xsl:otherwise>
427 <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink">
428 <xsl:with-param name="wrt" select="$TypeNamespace"/>
429 </xsl:apply-templates>
430 </xsl:otherwise>
431 </xsl:choose>
433 <!-- hard space -->
434 <xsl:value-of select="' '"/>
436 <!-- member name -->
437 <xsl:choose>
439 <!-- Constructors get the name of the class -->
440 <xsl:when test="MemberType='Constructor'">
442 <xsl:call-template name="GetConstructorName">
443 <xsl:with-param name="type" select="../.." />
444 <xsl:with-param name="ctor" select="." />
445 </xsl:call-template>
446 </b>
447 </xsl:when>
449 <!-- Conversion operators get the return type -->
450 <xsl:when test="@MemberName='op_Implicit' or @MemberName='op_Explicit'">
451 <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink">
452 <xsl:with-param name="wrt" select="$TypeNamespace"/>
453 </xsl:apply-templates>
454 </xsl:when>
456 <!-- Regular operators get their symbol -->
457 <xsl:when test="@MemberName='op_UnaryPlus'">operator+</xsl:when>
458 <xsl:when test="@MemberName='op_UnaryNegation'">operator-</xsl:when>
459 <xsl:when test="@MemberName='op_LogicalNot'">operator!</xsl:when>
460 <xsl:when test="@MemberName='op_OnesComplement'">operator~</xsl:when>
461 <xsl:when test="@MemberName='op_Increment'">operator++</xsl:when>
462 <xsl:when test="@MemberName='op_Decrement'">operator--</xsl:when>
463 <xsl:when test="@MemberName='op_True'">operator true</xsl:when>
464 <xsl:when test="@MemberName='op_False'">operator false</xsl:when>
465 <xsl:when test="@MemberName='op_Addition'">operator+</xsl:when>
466 <xsl:when test="@MemberName='op_Subtraction'">operator-</xsl:when>
467 <xsl:when test="@MemberName='op_Multiply'">operator*</xsl:when>
468 <xsl:when test="@MemberName='op_Division'">operator/</xsl:when>
469 <xsl:when test="@MemberName='op_Modulus'">operator%</xsl:when>
470 <xsl:when test="@MemberName='op_BitwiseAnd'">operator&amp;</xsl:when>
471 <xsl:when test="@MemberName='op_BitwiseOr'">operator|</xsl:when>
472 <xsl:when test="@MemberName='op_ExclusiveOr'">operator^</xsl:when>
473 <xsl:when test="@MemberName='op_LeftShift'">operator&lt;&lt;</xsl:when>
474 <xsl:when test="@MemberName='op_RightShift'">operator&gt;&gt;</xsl:when>
475 <xsl:when test="@MemberName='op_Equality'">operator==</xsl:when>
476 <xsl:when test="@MemberName='op_Inequality'">operator!=</xsl:when>
477 <xsl:when test="@MemberName='op_GreaterThan'">operator&gt;</xsl:when>
478 <xsl:when test="@MemberName='op_LessThan'">operator&lt;</xsl:when>
479 <xsl:when test="@MemberName='op_GreaterThanOrEqual'">operator&gt;=</xsl:when>
480 <xsl:when test="@MemberName='op_LessThanOrEqual'">operator&lt;=</xsl:when>
482 <xsl:when test="MemberType='Property' and count(Parameters/Parameter) &gt; 0">
483 <!-- C# only permits indexer properties to have arguments -->
484 <xsl:text>this</xsl:text>
485 </xsl:when>
487 <!-- Everything else just gets its name -->
488 <xsl:when test="contains (@MemberName, '&lt;')">
490 <xsl:call-template name="GetDefinitionName">
491 <xsl:with-param name="name" select="@MemberName" />
492 <xsl:with-param name="TypeParameters" select="TypeParameters" />
493 </xsl:call-template>
494 </b>
495 </xsl:when>
497 <xsl:otherwise>
498 <b><xsl:value-of select="@MemberName"/></b>
499 </xsl:otherwise>
500 </xsl:choose>
502 <!-- hard space -->
503 <xsl:value-of select="' '"/>
505 <!-- argument list -->
506 <xsl:if test="MemberType='Method' or MemberType='Constructor' or (MemberType='Property' and count(Parameters/Parameter))">
507 <xsl:if test="not(MemberType='Property')">(</xsl:if>
508 <xsl:if test="MemberType='Property'">[</xsl:if>
510 <xsl:for-each select="Parameters/Parameter">
511 <xsl:call-template name="ShowParameter">
512 <xsl:with-param name="Param" select="."/>
513 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
514 </xsl:call-template>
516 <xsl:if test="not(position()=last())">, </xsl:if>
517 </xsl:for-each>
518 <xsl:if test="not(MemberType='Property')">)</xsl:if>
519 <xsl:if test="MemberType='Property'">]</xsl:if>
520 </xsl:if>
522 <xsl:if test="MemberType='Property'">
523 <xsl:value-of select="' '"/>
524 <xsl:text>{</xsl:text>
525 <xsl:value-of select="substring-before(substring-after(MemberSignature[@Language='C#']/@Value, '{'), '}')"/>
526 <xsl:text>}</xsl:text>
527 </xsl:if>
528 <xsl:call-template name="CreateGenericConstraints">
529 <xsl:with-param name="TypeParameters" select="TypeParameters" />
530 </xsl:call-template>
531 </xsl:with-param>
532 </xsl:call-template>
534 </xsl:template>
536 <xsl:template name="GetConstructorName">
537 <xsl:param name="type" />
538 <xsl:param name="ctor" />
540 <xsl:choose>
541 <xsl:when test="contains($type/@Name, '&lt;')">
542 <xsl:value-of select="translate (substring-before ($type/@Name, '&lt;'), '+', '.')" />
543 </xsl:when>
544 <xsl:otherwise>
545 <xsl:value-of select="translate ($type/@Name, '+', '.')" />
546 </xsl:otherwise>
547 </xsl:choose>
548 </xsl:template>
550 <xsl:template name="ShowParameter">
551 <xsl:param name="Param"/>
552 <xsl:param name="TypeNamespace"/>
553 <xsl:param name="prototype" select="false()"/>
555 <xsl:if test="not($prototype)">
556 <xsl:for-each select="$Param/Attributes/Attribute[not(Exclude='1') and not(AttributeName='ParamArrayAttribute' or AttributeName='System.ParamArray')]">
557 <xsl:text>[</xsl:text>
558 <xsl:value-of select="AttributeName"/>
559 <xsl:text>]</xsl:text>
560 <xsl:value-of select="' '"/>
561 </xsl:for-each>
562 </xsl:if>
564 <xsl:if test="count($Param/Attributes/Attribute/AttributeName[.='ParamArrayAttribute' or .='System.ParamArray'])">
565 <b>params</b>
566 <xsl:value-of select="' '"/>
567 </xsl:if>
569 <xsl:if test="$Param/@RefType">
570 <i><xsl:value-of select="$Param/@RefType"/></i>
571 <!-- hard space -->
572 <xsl:value-of select="' '"/>
573 </xsl:if>
575 <!-- parameter type link -->
576 <xsl:apply-templates select="$Param/@Type" mode="typelink">
577 <xsl:with-param name="wrt" select="$TypeNamespace"/>
578 </xsl:apply-templates>
580 <xsl:if test="not($prototype)">
581 <!-- hard space -->
582 <xsl:value-of select="' '"/>
584 <!-- parameter name -->
585 <xsl:value-of select="$Param/@Name"/>
586 </xsl:if>
587 </xsl:template>
589 <xsl:template name="DisplayDocsInformation">
590 <xsl:param name="linkid" />
592 <!-- The namespace that the current type belongs to. -->
593 <xsl:variable name="TypeNamespace" select="substring(@FullName, 1, string-length(@FullName) - string-length(@Name) - 1)"/>
595 <!-- alt member: not sure what these are for, actually -->
597 <xsl:if test="count(Docs/altmember)">
598 <xsl:call-template name="CreateH4Section">
599 <xsl:with-param name="name" select="'See Also'"/>
600 <xsl:with-param name="child-id" select="concat ($linkid, ':See Also')" />
601 <xsl:with-param name="content">
602 <xsl:for-each select="Docs/altmember">
603 <div><xsl:apply-templates select="@cref" mode="cref"/></div>
604 </xsl:for-each>
605 </xsl:with-param>
606 </xsl:call-template>
607 </xsl:if>
609 <!-- parameters & return & value -->
611 <xsl:if test="count(Docs/typeparam)">
612 <xsl:call-template name="CreateH4Section">
613 <xsl:with-param name="name" select="'Type Parameters'"/>
614 <xsl:with-param name="child-id" select="concat ($linkid, ':Type Parameters')" />
615 <xsl:with-param name="content">
616 <dl>
617 <xsl:for-each select="Docs/typeparam">
618 <dt><i><xsl:value-of select="@name"/></i></dt>
619 <dd>
620 <xsl:apply-templates select="." mode="notoppara"/>
621 <xsl:apply-templates select="." mode="editlink"/>
622 </dd>
623 </xsl:for-each>
624 </dl>
625 </xsl:with-param>
626 </xsl:call-template>
627 </xsl:if>
628 <xsl:if test="count(Docs/param)">
629 <xsl:call-template name="CreateH4Section">
630 <xsl:with-param name="name" select="'Parameters'"/>
631 <xsl:with-param name="child-id" select="concat ($linkid, ':Parameters')" />
632 <xsl:with-param name="content">
633 <dl>
634 <xsl:for-each select="Docs/param">
635 <dt><i><xsl:value-of select="@name"/></i></dt>
636 <dd>
637 <xsl:apply-templates select="." mode="notoppara"/>
638 <xsl:apply-templates select="." mode="editlink"/>
639 </dd>
640 </xsl:for-each>
641 </dl>
642 </xsl:with-param>
643 </xsl:call-template>
644 </xsl:if>
645 <xsl:if test="count(Docs/returns)">
646 <xsl:call-template name="CreateH4Section">
647 <xsl:with-param name="name" select="'Returns'"/>
648 <xsl:with-param name="child-id" select="concat ($linkid, ':Returns')" />
649 <xsl:with-param name="content">
650 <xsl:apply-templates select="Docs/returns" mode="notoppara"/>
651 <xsl:apply-templates select="Docs/returns" mode="editlink"/>
652 </xsl:with-param>
653 </xsl:call-template>
654 </xsl:if>
655 <xsl:if test="count(Docs/value)">
656 <xsl:call-template name="CreateH4Section">
657 <xsl:with-param name="name" select="'Value'"/>
658 <xsl:with-param name="child-id" select="concat ($linkid, ':Value')" />
659 <xsl:with-param name="content">
660 <xsl:apply-templates select="Docs/value" mode="notoppara"/>
661 <xsl:apply-templates select="Docs/value" mode="editlink"/>
662 </xsl:with-param>
663 </xsl:call-template>
664 </xsl:if>
666 <!-- thread safety -->
668 <xsl:if test="count(ThreadingSafetyStatement)">
669 <xsl:call-template name="CreateH4Section">
670 <xsl:with-param name="name" select="'Thread Safety'"/>
671 <xsl:with-param name="child-id" select="concat ($linkid, ':Thread Safety')" />
672 <xsl:with-param name="content">
673 <xsl:apply-templates select="ThreadingSafetyStatement" mode="notoppara"/>
674 </xsl:with-param>
675 </xsl:call-template>
676 </xsl:if>
679 <!-- permissions -->
681 <xsl:if test="count(Docs/permission)">
682 <xsl:call-template name="CreateH4Section">
683 <xsl:with-param name="name" select="'Permissions'"/>
684 <xsl:with-param name="child-id" select="concat ($linkid, ':Permissions')" />
685 <xsl:with-param name="content">
686 <xsl:call-template name="CreateTypeDocumentationTable">
687 <xsl:with-param name="content">
688 <xsl:for-each select="Docs/permission">
689 <tr valign="top">
690 <td>
691 <xsl:apply-templates select="@cref" mode="typelink">
692 <xsl:with-param name="wrt" select="$TypeNamespace"/>
693 </xsl:apply-templates>
694 <xsl:apply-templates select="." mode="editlink"/>
695 </td>
696 <td>
697 <xsl:apply-templates select="." mode="notoppara"/>
698 </td>
699 </tr>
700 </xsl:for-each>
701 </xsl:with-param>
702 </xsl:call-template>
703 </xsl:with-param>
704 </xsl:call-template>
705 </xsl:if>
707 <!-- method/property/constructor exceptions -->
709 <xsl:if test="count(Docs/exception)">
710 <xsl:call-template name="CreateH4Section">
711 <xsl:with-param name="name" select="'Exceptions'"/>
712 <xsl:with-param name="child-id" select="concat ($linkid, ':Exceptions')" />
713 <xsl:with-param name="content">
714 <xsl:call-template name="CreateTypeDocumentationTable">
715 <xsl:with-param name="content">
716 <xsl:for-each select="Docs/exception">
717 <tr valign="top">
718 <td>
719 <xsl:apply-templates select="@cref" mode="typelink">
720 <xsl:with-param name="wrt" select="$TypeNamespace"/>
721 </xsl:apply-templates>
722 </td>
723 <td>
724 <xsl:apply-templates select="." mode="notoppara"/>
725 <xsl:apply-templates select="." mode="editlink"/>
726 </td>
727 </tr>
728 </xsl:for-each>
729 </xsl:with-param>
730 </xsl:call-template>
731 </xsl:with-param>
732 </xsl:call-template>
733 </xsl:if>
735 <!-- remarks -->
737 <xsl:if test="count(Docs/remarks)">
738 <xsl:call-template name="CreateH4Section">
739 <xsl:with-param name="name" select="'Remarks'"/>
740 <xsl:with-param name="child-id" select="concat ($linkid, ':Remarks')" />
741 <xsl:with-param name="content">
742 <xsl:apply-templates select="Docs/remarks" mode="notoppara"/>
743 <xsl:apply-templates select="Docs/remarks" mode="editlink"/>
744 </xsl:with-param>
745 </xsl:call-template>
746 </xsl:if>
748 <!-- enumeration values -->
750 <xsl:if test="Base/BaseTypeName = 'System.Enum'">
751 <xsl:call-template name="CreateH4Section">
752 <xsl:with-param name="name" select="'Members'"/>
753 <xsl:with-param name="child-id" select="concat ($linkid, ':Members')" />
754 <xsl:with-param name="content">
755 <xsl:call-template name="CreateEnumerationTable">
756 <xsl:with-param name="content">
758 <xsl:for-each select="Members/Member[MemberType='Field']">
759 <xsl:if test="not(@MemberName='value__')">
760 <tr valign="top"><td>
761 <xsl:attribute name="id">
762 <xsl:text>F:</xsl:text>
763 <xsl:value-of select="translate (/Type/@FullName, '+', '.')" />
764 <xsl:text>.</xsl:text>
765 <xsl:value-of select="@MemberName" />
766 </xsl:attribute>
768 <xsl:value-of select="@MemberName"/>
769 </b>
770 </td>
771 <td>
772 <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
773 <xsl:apply-templates select="Docs/summary" mode="editlink"/>
774 </td>
775 </tr>
776 </xsl:if>
777 </xsl:for-each>
778 </xsl:with-param>
779 </xsl:call-template>
780 </xsl:with-param>
781 </xsl:call-template>
782 </xsl:if>
784 <!-- examples -->
786 <xsl:if test="count(Docs/example)">
787 <xsl:for-each select="Docs/example">
788 <xsl:call-template name="CreateH4Section">
789 <xsl:with-param name="name" select="'Example'"/>
790 <xsl:with-param name="child-id" select="concat ($linkid, ':Example:', position())" />
791 <xsl:with-param name="content">
792 <xsl:apply-templates select="." mode="notoppara"/>
793 </xsl:with-param>
794 </xsl:call-template>
795 </xsl:for-each>
796 </xsl:if>
798 <xsl:call-template name="CreateH4Section">
799 <xsl:with-param name="name" select="'Requirements'"/>
800 <xsl:with-param name="child-id" select="concat ($linkid, ':Version Information')" />
801 <xsl:with-param name="content">
802 <b>Namespace: </b><xsl:value-of select="substring(/Type/@FullName, 1, string-length(/Type/@FullName) - string-length(/Type/@Name) - 1)" />
803 <xsl:if test="count(/Type/AssemblyInfo/AssemblyName) &gt; 0">
804 <br />
805 <b>Assembly: </b>
806 <xsl:value-of select="/Type/AssemblyInfo/AssemblyName" />
807 <xsl:text> (in </xsl:text>
808 <xsl:value-of select="/Type/AssemblyInfo/AssemblyName" />
809 <xsl:text>.dll)</xsl:text>
810 </xsl:if>
811 <xsl:if test="count(AssemblyInfo/AssemblyVersion) &gt; 0">
812 <br />
813 <b>Assembly Versions: </b>
814 <xsl:for-each select="AssemblyInfo/AssemblyVersion">
815 <xsl:if test="not(position()=1)">, </xsl:if>
816 <xsl:value-of select="."/>
817 </xsl:for-each>
818 </xsl:if>
819 <xsl:if test="count(Docs/since) &gt; 0">
820 <br />
821 <b>Since: </b>
822 <xsl:for-each select="Docs/since">
823 <xsl:if test="not(position()=1)">; </xsl:if>
824 <xsl:value-of select="@version"/>
825 </xsl:for-each>
826 </xsl:if>
827 <xsl:if test="count(Docs/since)=0 and count(/Type/Docs/since) &gt; 0">
828 <br />
829 <b>Since: </b>
830 <xsl:for-each select="/Type/Docs/since">
831 <xsl:if test="not(position()=1)">; </xsl:if>
832 <xsl:value-of select="@version"/>
833 </xsl:for-each>
834 </xsl:if>
835 </xsl:with-param>
836 </xsl:call-template>
837 </xsl:template>
840 <!-- Transforms the contents of the selected node into a hyperlink to the type named by the node. The node can contain a type name (eg System.Object) or a type link (eg T:System.String). Use wrt parameter to specify the current namespace. -->
842 <xsl:template match="*|@*" mode="typelink">
843 <xsl:param name="wrt" select="'notset'"/>
845 <xsl:call-template name="maketypelink">
846 <xsl:with-param name="type" select="."/>
847 <xsl:with-param name="wrt" select="$wrt"/>
848 </xsl:call-template>
849 </xsl:template>
851 <xsl:template name="makenamespacelink">
852 <xsl:param name="cref" select="''"/>
855 <xsl:attribute name="href">
856 <xsl:call-template name="GetLinkTargetHtml">
857 <xsl:with-param name="cref" select="$cref" />
858 </xsl:call-template>
859 </xsl:attribute>
861 <xsl:value-of select="substring-after ($cref, 'N:')" />
862 </a>
863 </xsl:template>
865 <xsl:template name="maketypelink">
866 <xsl:param name="type" select="'notset'"/>
867 <xsl:param name="wrt" select="'notset'"/>
868 <xsl:param name="nested" select="0"/>
870 <xsl:variable name="btype">
871 <xsl:call-template name="ToBrackets">
872 <xsl:with-param name="s" select="$type" />
873 </xsl:call-template>
874 </xsl:variable>
876 <xsl:variable name="array">
877 <xsl:call-template name="GetArraySuffix">
878 <xsl:with-param name="type" select="$type" />
879 </xsl:call-template>
880 </xsl:variable>
882 <xsl:choose>
884 <!-- chop off T: -->
885 <xsl:when test="starts-with($type, 'T:')">
886 <xsl:call-template name="maketypelink">
887 <xsl:with-param name="type" select="substring($type, 3)"/>
888 <xsl:with-param name="wrt" select="$wrt"/>
889 </xsl:call-template>
890 </xsl:when>
892 <xsl:when test="contains ($type, '&amp;') and
893 '&amp;' = substring ($type, string-length ($type), 1)">
894 <xsl:call-template name="maketypelink">
895 <xsl:with-param name="type" select="substring($type, 1, string-length($type)-1)"/>
896 <xsl:with-param name="wrt" select="$wrt"/>
897 </xsl:call-template>
898 </xsl:when>
900 <xsl:when test="string($array)">
901 <xsl:call-template name="maketypelink">
902 <xsl:with-param name="type" select="substring($type, 1, string-length($type) - string-length ($array))"/>
903 <xsl:with-param name="wrt" select="$wrt"/>
904 </xsl:call-template>
905 <xsl:value-of select="$array"/>
906 </xsl:when>
908 <xsl:when test="contains ($type, '*') and
909 '*' = substring ($type, string-length ($type), 1)">
910 <xsl:call-template name="maketypelink">
911 <xsl:with-param name="type" select="substring($type, 1, string-length($type)-1)"/>
912 <xsl:with-param name="wrt" select="$wrt"/>
913 </xsl:call-template>
914 <xsl:value-of select="'*'"/>
915 </xsl:when>
917 <!-- if this is a generic type parameter, don't make a link but italicize it and give it a tooltip instead -->
918 <xsl:when test="count($ThisType/TypeParameters/TypeParameter[@Name=$type] |
919 $ThisType/TypeParameters/TypeParameter[child::text()=$type] |
920 ancestor::Member/Docs/typeparam[@name=$type]) = 1">
921 <!-- note that we check if it is a generic type using /Type/TypeParameters because that will have type parameters declared in an outer class if this is a nested class, but then we get the tooltip text from the type parameters documented in this file -->
922 <i title="{$ThisType/Docs/typeparam[@name=$type] | ancestor::Member/Docs/typeparam[@name=$type]}"><xsl:value-of select="$type"/></i>
923 </xsl:when>
925 <!-- if this is a generic type parameter of a base type, replace it with the type that it was instantiated with -->
926 <xsl:when test="count(ancestor::Members/BaseTypeArgument[@TypeParamName=$type]) = 1">
927 <!-- note that an overridden type parameter may be referenced in a type parameter within $type, but we can't replace that nicely since we can't parse generic type names here -->
928 <xsl:call-template name="maketypelink">
929 <xsl:with-param name="type" select="ancestor::Members/BaseTypeArgument[@TypeParamName=$type]"/>
930 <xsl:with-param name="wrt" select="$wrt"/>
931 </xsl:call-template>
932 </xsl:when>
935 <xsl:otherwise>
936 <xsl:variable name="escaped-type">
937 <xsl:call-template name="GetEscapedTypeName">
938 <xsl:with-param name="typename" select="$btype" />
939 </xsl:call-template>
940 </xsl:variable>
942 <xsl:attribute name="href">
943 <xsl:call-template name="GetLinkTargetHtml">
944 <xsl:with-param name="type" select="$escaped-type" />
945 <xsl:with-param name="cref" select="concat ('T:', $escaped-type)" />
946 </xsl:call-template>
947 </xsl:attribute>
949 <xsl:call-template name="GetTypeDisplayName">
950 <xsl:with-param name="T" select="$btype"/>
951 <xsl:with-param name="wrt" select="$wrt"/>
952 </xsl:call-template>
953 </a>
954 </xsl:otherwise>
955 </xsl:choose>
956 </xsl:template>
958 <xsl:template name="GetArraySuffix">
959 <xsl:param name="type" />
961 <xsl:if test="contains ($type, ']') and
962 ']' = substring ($type, string-length ($type), 1)">
963 <xsl:variable name="start">
964 <xsl:call-template name="GetArraySuffixStart">
965 <xsl:with-param name="type" select="$type" />
966 <xsl:with-param name="i" select="string-length ($type) - 1" />
967 </xsl:call-template>
968 </xsl:variable>
969 <xsl:value-of select="substring ($type, $start)" />
970 </xsl:if>
971 </xsl:template>
973 <xsl:template name="GetArraySuffixStart">
974 <xsl:param name="type" />
975 <xsl:param name="i" />
977 <xsl:choose>
978 <xsl:when test="substring ($type, $i, 1) = '['">
979 <xsl:value-of select="$i" />
980 </xsl:when>
981 <xsl:otherwise>
982 <xsl:call-template name="GetArraySuffixStart">
983 <xsl:with-param name="type" select="$type" />
984 <xsl:with-param name="i" select="$i - 1" />
985 </xsl:call-template>
986 </xsl:otherwise>
987 </xsl:choose>
988 </xsl:template>
990 <xsl:template name="GetTypeDisplayName">
991 <xsl:param name="T"/>
992 <xsl:param name="wrt"/>
994 <!-- use C#-style names -->
995 <xsl:choose>
996 <xsl:when test="$T='System.Object'">object</xsl:when>
997 <xsl:when test="$T='System.Boolean'">bool</xsl:when>
998 <xsl:when test="$T='System.Byte'">byte</xsl:when>
999 <xsl:when test="$T='System.Char'">char</xsl:when>
1000 <xsl:when test="$T='System.Decimal'">decimal</xsl:when>
1001 <xsl:when test="$T='System.Double'">double</xsl:when>
1002 <xsl:when test="$T='System.Int16'">short</xsl:when>
1003 <xsl:when test="$T='System.Int32'">int</xsl:when>
1004 <xsl:when test="$T='System.Int64'">long</xsl:when>
1005 <xsl:when test="$T='System.SByte'">sbyte</xsl:when>
1006 <xsl:when test="$T='System.Single'">float</xsl:when>
1007 <xsl:when test="$T='System.String'">string</xsl:when>
1008 <xsl:when test="$T='System.UInt16'">ushort</xsl:when>
1009 <xsl:when test="$T='System.UInt32'">uint</xsl:when>
1010 <xsl:when test="$T='System.UInt64'">ulong</xsl:when>
1011 <xsl:when test="$T='System.Void'">void</xsl:when>
1013 <xsl:when test="contains($T, '&lt;')">
1014 <xsl:call-template name="GetTypeDisplayName">
1015 <xsl:with-param name="T" select="substring-before ($T, '&lt;')" />
1016 <xsl:with-param name="wrt" select="$wrt" />
1017 </xsl:call-template>
1018 <xsl:text>&lt;</xsl:text>
1019 <xsl:call-template name="GetMemberArgList">
1020 <xsl:with-param name="arglist" select="substring-after ($T, '&lt;')" />
1021 <xsl:with-param name="wrt" select="$wrt" />
1022 </xsl:call-template>
1023 <!-- don't need to append &gt; as GetMemberArgList (eventually) appends it -->
1024 </xsl:when>
1026 <!-- if the type is in the wrt namespace, omit the namespace name -->
1027 <xsl:when test="not($wrt='') and starts-with($T, concat($wrt,'.')) and not(contains(substring-after($T,concat($wrt,'.')), '.'))">
1028 <xsl:value-of select="translate (substring-after($T,concat($wrt,'.')), '+', '.')"/>
1029 </xsl:when>
1031 <!-- if the type is in the System namespace, omit the namespace name -->
1032 <xsl:when test="starts-with($T, 'System.') and not(contains(substring-after($T, 'System.'), '.'))">
1033 <xsl:value-of select="translate (substring-after($T,'System.'), '+', '.')"/>
1034 </xsl:when>
1036 <!-- if the type is in the System.Collections namespace, omit the namespace name -->
1037 <xsl:when test="starts-with($T, 'System.Collections.') and not(contains(substring-after($T, 'System.Collections.'), '.'))">
1038 <xsl:value-of select="translate (substring-after($T,'System.Collections.'), '+', '.')"/>
1039 </xsl:when>
1041 <!-- if the type is in the System.Collections.Generic namespace, omit the namespace name -->
1042 <xsl:when test="starts-with($T, 'System.Collections.Generic.') and not(contains(substring-after($T, 'System.Collections.Generic.'), '.'))">
1043 <xsl:value-of select="translate (substring-after($T,'System.Collections.Generic.'), '+', '.')"/>
1044 </xsl:when>
1046 <xsl:otherwise>
1047 <xsl:value-of select="translate ($T, '+', '.')" />
1048 </xsl:otherwise>
1049 </xsl:choose>
1050 </xsl:template>
1052 <xsl:template name="GetMemberDisplayName">
1053 <xsl:param name="memberName" />
1054 <xsl:param name="isproperty" select="false()" />
1056 <xsl:choose>
1057 <xsl:when test="contains($memberName, '.')">
1058 <xsl:call-template name="GetTypeDisplayName">
1059 <xsl:with-param name="T">
1060 <xsl:call-template name="GetTypeName">
1061 <xsl:with-param name="type" select="$memberName"/>
1062 </xsl:call-template>
1063 </xsl:with-param>
1064 <xsl:with-param name="wrt" select="''" />
1065 </xsl:call-template>
1066 <xsl:text>.</xsl:text>
1067 <xsl:call-template name="GetMemberName">
1068 <xsl:with-param name="type" select="$memberName" />
1069 <xsl:with-param name="isproperty" select="$isproperty"/>
1070 </xsl:call-template>
1071 </xsl:when>
1072 <xsl:otherwise>
1073 <xsl:value-of select="$memberName" />
1074 </xsl:otherwise>
1075 </xsl:choose>
1076 </xsl:template>
1078 <xsl:template name="ToBrackets">
1079 <xsl:param name="s" />
1080 <xsl:value-of select="translate (translate ($s, '{', '&lt;'), '}', '&gt;')" />
1081 </xsl:template>
1083 <xsl:template name="ToBraces">
1084 <xsl:param name="s" />
1085 <xsl:value-of select="translate (translate ($s, '&lt;', '{'), '&gt;', '}')" />
1086 </xsl:template>
1088 <xsl:template name="memberlinkprefix">
1089 <xsl:param name="member" />
1090 <xsl:choose>
1091 <xsl:when test="$member/MemberType='Constructor'">C</xsl:when>
1092 <xsl:when test="$member/MemberType='Method'">M</xsl:when>
1093 <xsl:when test="$member/MemberType='Property'">P</xsl:when>
1094 <xsl:when test="$member/MemberType='Field'">F</xsl:when>
1095 <xsl:when test="$member/MemberType='Event'">E</xsl:when>
1096 </xsl:choose>
1097 </xsl:template>
1099 <xsl:template name="makememberlink">
1100 <xsl:param name="cref"/>
1102 <xsl:variable name="bcref">
1103 <xsl:call-template name="ToBrackets">
1104 <xsl:with-param name="s" select="$cref" />
1105 </xsl:call-template>
1106 </xsl:variable>
1108 <xsl:variable name="fullname">
1109 <xsl:choose>
1110 <xsl:when test="starts-with($bcref, 'C:') or starts-with($bcref, 'T:')">
1111 <xsl:choose>
1112 <xsl:when test="contains($bcref, '(')">
1113 <xsl:value-of select="substring (substring-before ($bcref, '('), 3)" />
1114 </xsl:when>
1115 <xsl:otherwise>
1116 <xsl:value-of select="substring($bcref, 3)" />
1117 </xsl:otherwise>
1118 </xsl:choose>
1119 </xsl:when>
1120 <xsl:otherwise>
1121 <xsl:call-template name="GetTypeName">
1122 <xsl:with-param name="type" select="substring($bcref, 3)"/>
1123 </xsl:call-template>
1124 </xsl:otherwise>
1125 </xsl:choose>
1126 </xsl:variable>
1128 <xsl:variable name="memberName">
1129 <xsl:choose>
1130 <xsl:when test="starts-with($bcref, 'T:')" />
1131 <xsl:when test="starts-with($bcref, 'C:') and not(contains($bcref, '('))" />
1132 <xsl:when test="starts-with($bcref, 'C:') and contains($bcref, '(')">
1133 <xsl:text>(</xsl:text>
1134 <xsl:call-template name="GetMemberArgList">
1135 <xsl:with-param name="arglist" select="substring-before(substring-after($bcref, '('), ')')" />
1136 <xsl:with-param name="wrt" select="$TypeNamespace" />
1137 </xsl:call-template>
1138 <xsl:text>)</xsl:text>
1139 </xsl:when>
1140 <xsl:otherwise>
1141 <xsl:text>.</xsl:text>
1142 <xsl:call-template name="GetMemberName">
1143 <xsl:with-param name="type" select="substring($bcref, 3)" />
1144 <xsl:with-param name="wrt" select="$fullname"/>
1145 <xsl:with-param name="isproperty" select="starts-with($bcref, 'P:')"/>
1146 </xsl:call-template>
1147 </xsl:otherwise>
1148 </xsl:choose>
1149 </xsl:variable>
1151 <xsl:variable name="escaped-type">
1152 <xsl:call-template name="GetEscapedTypeName">
1153 <xsl:with-param name="typename">
1154 <xsl:call-template name="ToBrackets">
1155 <xsl:with-param name="s" select="$fullname" />
1156 </xsl:call-template>
1157 </xsl:with-param>
1158 </xsl:call-template>
1159 </xsl:variable>
1160 <xsl:variable name="displayname">
1161 <xsl:call-template name="GetTypeDisplayName">
1162 <xsl:with-param name="T" select="$fullname" />
1163 <xsl:with-param name="wrt" select="$TypeNamespace"/>
1164 </xsl:call-template>
1165 </xsl:variable>
1167 <xsl:attribute name="href">
1168 <xsl:call-template name="GetLinkTargetHtml">
1169 <xsl:with-param name="type" select="$escaped-type" />
1170 <xsl:with-param name="cref">
1171 <xsl:call-template name="ToBraces">
1172 <xsl:with-param name="s" select="$cref" />
1173 </xsl:call-template>
1174 </xsl:with-param>
1175 </xsl:call-template>
1176 </xsl:attribute>
1177 <xsl:value-of select="translate (concat($displayname, $memberName), '+', '.')" />
1178 </a>
1179 </xsl:template>
1181 <xsl:template name="GetTypeName">
1182 <xsl:param name="type" />
1183 <xsl:variable name="prefix" select="substring-before($type, '.')" />
1184 <xsl:variable name="suffix" select="substring-after($type, '.')" />
1185 <xsl:choose>
1186 <xsl:when test="contains($type, '(')">
1187 <xsl:call-template name="GetTypeName">
1188 <xsl:with-param name="type" select="substring-before($type, '(')" />
1189 </xsl:call-template>
1190 </xsl:when>
1191 <xsl:when test="not(contains($suffix, '.'))">
1192 <xsl:value-of select="$prefix" />
1193 </xsl:when>
1194 <xsl:otherwise>
1195 <xsl:value-of select="$prefix" />
1196 <xsl:text>.</xsl:text>
1197 <xsl:call-template name="GetTypeName">
1198 <xsl:with-param name="type" select="$suffix" />
1199 </xsl:call-template>
1200 </xsl:otherwise>
1201 </xsl:choose>
1202 </xsl:template>
1204 <xsl:template name="GetMemberName">
1205 <xsl:param name="type" />
1206 <xsl:param name="isproperty" select="0"/>
1207 <xsl:variable name="prefix" select="substring-before($type, '.')" />
1208 <xsl:variable name="suffix" select="substring-after($type, '.')" />
1209 <xsl:choose>
1210 <xsl:when test="contains($type, '(')">
1211 <xsl:call-template name="GetMemberName">
1212 <xsl:with-param name="type" select="substring-before($type, '(')" />
1213 </xsl:call-template>
1214 <xsl:text>(</xsl:text>
1215 <xsl:call-template name="GetMemberArgList">
1216 <xsl:with-param name="arglist" select="substring-before(substring-after($type, '('), ')')" />
1217 <xsl:with-param name="wrt" select="$TypeNamespace" />
1218 </xsl:call-template>
1219 <xsl:text>)</xsl:text>
1220 </xsl:when>
1221 <xsl:when test="not(contains($suffix, '.'))">
1222 <xsl:value-of select="$suffix" />
1223 </xsl:when>
1224 <xsl:otherwise>
1225 <xsl:call-template name="GetMemberName">
1226 <xsl:with-param name="type" select="$suffix" />
1227 </xsl:call-template>
1228 </xsl:otherwise>
1229 </xsl:choose>
1230 </xsl:template>
1232 <xsl:template name="GetMemberArgList">
1233 <xsl:param name="arglist" />
1234 <xsl:param name="wrt" select="''"/>
1236 <xsl:variable name="_arglist">
1237 <xsl:choose>
1238 <xsl:when test="starts-with ($arglist, ',')">
1239 <xsl:value-of select="substring-after ($arglist, ',')" />
1240 </xsl:when>
1241 <xsl:otherwise>
1242 <xsl:value-of select="$arglist" />
1243 </xsl:otherwise>
1244 </xsl:choose>
1245 </xsl:variable>
1247 <xsl:if test="starts-with ($arglist, ',')">
1248 <xsl:text>, </xsl:text>
1249 </xsl:if>
1251 <xsl:variable name="c" select="substring-before ($_arglist, ',')" />
1252 <xsl:variable name="lt" select="substring-before ($_arglist, '&lt;')" />
1253 <xsl:variable name="gt" select="substring-before ($_arglist, '&gt;')" />
1255 <xsl:choose>
1256 <!-- Need to insert ',' between type arguments -->
1257 <xsl:when test="
1258 ($c != '' and $lt != '' and $gt != '' and
1259 string-length ($c) &lt; string-length ($lt) and
1260 string-length ($c) &lt; string-length ($gt)) or
1261 ($c != '' and $lt != '' and $gt = '' and
1262 string-length ($c) &lt; string-length ($lt)) or
1263 ($c != '' and $lt = '' and $gt != '' and
1264 string-length ($c) &lt; string-length ($gt)) or
1265 ($c != '' and $lt = '' and $gt = '')">
1266 <xsl:call-template name="GetTypeDisplayName">
1267 <xsl:with-param name="T" select="$c"/>
1268 <xsl:with-param name="wrt" select="$wrt"/>
1269 </xsl:call-template>
1270 <xsl:text>, </xsl:text>
1271 <xsl:call-template name="GetMemberArgList">
1272 <xsl:with-param name="arglist" select="substring-after($_arglist, ',')" />
1273 <xsl:with-param name="wrt" select="$wrt" />
1274 </xsl:call-template>
1275 </xsl:when>
1277 <!-- start of nested type argument list < -->
1278 <xsl:when test="
1279 ($c != '' and $lt != '' and $gt != '' and
1280 string-length ($lt) &lt; string-length ($c) and
1281 string-length ($lt) &lt; string-length ($gt)) or
1282 ($c != '' and $lt != '' and $gt = '' and
1283 string-length ($lt) &lt; string-length ($c)) or
1284 ($c = '' and $lt != '' and $gt != '' and
1285 string-length ($lt) &lt; string-length ($gt))">
1286 <xsl:call-template name="GetTypeDisplayName">
1287 <xsl:with-param name="T" select="$lt"/>
1288 <xsl:with-param name="wrt" select="$wrt"/>
1289 </xsl:call-template>
1290 <xsl:text>&lt;</xsl:text>
1291 <xsl:call-template name="GetMemberArgList">
1292 <xsl:with-param name="arglist" select="substring-after($_arglist, '&lt;')" />
1293 <xsl:with-param name="wrt" select="$wrt" />
1294 </xsl:call-template>
1295 </xsl:when>
1297 <!-- end of (nested?) type argument list > -->
1298 <xsl:when test="
1299 ($c != '' and $lt != '' and $gt != '' and
1300 string-length ($gt) &lt; string-length ($c) and
1301 string-length ($gt) &lt; string-length ($lt)) or
1302 ($c != '' and $lt = '' and $gt = '' and
1303 string-length ($gt) &lt; string-length ($c)) or
1304 ($c = '' and $lt != '' and $gt != '' and
1305 string-length ($gt) &lt; string-length ($lt)) or
1306 ($c = '' and $lt = '' and $gt != '')">
1307 <xsl:call-template name="GetTypeDisplayName">
1308 <xsl:with-param name="T" select="$gt"/>
1309 <xsl:with-param name="wrt" select="$wrt"/>
1310 </xsl:call-template>
1311 <xsl:text>&gt;</xsl:text>
1312 <xsl:call-template name="GetMemberArgList">
1313 <xsl:with-param name="arglist" select="substring-after($_arglist, '&gt;')" />
1314 <xsl:with-param name="wrt" select="$wrt" />
1315 </xsl:call-template>
1316 </xsl:when>
1318 <!-- nothing left to do -->
1319 <xsl:otherwise>
1320 <xsl:call-template name="GetTypeDisplayName">
1321 <xsl:with-param name="T" select="$_arglist"/>
1322 <xsl:with-param name="wrt" select="$wrt"/>
1323 </xsl:call-template>
1324 </xsl:otherwise>
1325 </xsl:choose>
1326 </xsl:template>
1328 <!-- Transforms the contents of the selected node containing a cref into a hyperlink. -->
1329 <xsl:template match="*|@*" mode="cref">
1330 <xsl:call-template name="makememberlink">
1331 <xsl:with-param name="cref" select="."/>
1332 </xsl:call-template>
1333 <!--
1335 <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
1336 <xsl:value-of select="substring-after(., ':')"/></a>
1338 </xsl:template>
1340 <xsl:template name="membertypeplural">
1341 <xsl:param name="name"/>
1342 <xsl:choose>
1343 <xsl:when test="$name='ExtensionMethod'">Extension Methods</xsl:when>
1344 <xsl:when test="$name='Constructor'">Constructors</xsl:when>
1345 <xsl:when test="$name='Property'">Properties</xsl:when>
1346 <xsl:when test="$name='Method'">Methods</xsl:when>
1347 <xsl:when test="$name='Field'">Fields</xsl:when>
1348 <xsl:when test="$name='Event'">Events</xsl:when>
1349 <xsl:when test="$name='Operator'">Operators</xsl:when>
1350 <xsl:when test="$name='Explicit'">Explicitly Implemented Interface Members</xsl:when>
1351 </xsl:choose>
1352 </xsl:template>
1353 <xsl:template name="membertypeplurallc">
1354 <xsl:param name="name"/>
1355 <xsl:choose>
1356 <xsl:when test="$name='ExtensionMethod'">extension methods</xsl:when>
1357 <xsl:when test="$name='Constructor'">constructors</xsl:when>
1358 <xsl:when test="$name='Property'">properties</xsl:when>
1359 <xsl:when test="$name='Method'">methods</xsl:when>
1360 <xsl:when test="$name='Field'">fields</xsl:when>
1361 <xsl:when test="$name='Event'">events</xsl:when>
1362 <xsl:when test="$name='Operator'">operators</xsl:when>
1363 <xsl:when test="$name='Explicit'">explicitly implemented interface members</xsl:when>
1364 </xsl:choose>
1365 </xsl:template>
1366 <xsl:template name="gettypetype">
1367 <xsl:variable name="sig" select="concat(' ', TypeSignature[@Language='C#']/@Value, ' ')"/>
1368 <xsl:choose>
1369 <xsl:when test="contains($sig,'class')">Class</xsl:when>
1370 <xsl:when test="contains($sig,'enum')">Enumeration</xsl:when>
1371 <xsl:when test="contains($sig,'struct')">Structure</xsl:when>
1372 <xsl:when test="contains($sig,'delegate')">Delegate</xsl:when>
1373 </xsl:choose>
1374 </xsl:template>
1376 <!-- Ensures that the resuting node is not surrounded by a para tag. -->
1377 <xsl:template match="*|@*" mode="editlink">
1378 <xsl:call-template name="CreateEditLink">
1379 <xsl:with-param name="e" select="." />
1380 </xsl:call-template>
1381 </xsl:template>
1383 <xsl:template match="*" mode="notoppara">
1384 <xsl:choose>
1385 <xsl:when test="starts-with (string(.), 'To be added')">
1386 <span class="NotEntered">Documentation for this section has not yet been entered.</span>
1387 </xsl:when>
1388 <xsl:when test="count(*) = 1 and count(para)=1">
1389 <xsl:apply-templates select="para/node()"/>
1390 </xsl:when>
1391 <xsl:otherwise>
1392 <xsl:apply-templates select="."/>
1393 </xsl:otherwise>
1394 </xsl:choose>
1395 </xsl:template>
1397 <xsl:template match="para">
1399 <xsl:apply-templates/>
1400 </p>
1401 </xsl:template>
1403 <xsl:template match="paramref">
1404 <i><xsl:value-of select="@name"/>
1405 <xsl:apply-templates/>
1406 </i>
1407 </xsl:template>
1409 <xsl:template match="typeparamref">
1410 <i><xsl:value-of select="@name"/>
1411 <xsl:apply-templates/>
1412 </i>
1413 </xsl:template>
1415 <xsl:template match="block[@type='note']">
1416 <div>
1417 <i>Note: </i>
1418 <xsl:apply-templates/>
1419 </div>
1420 </xsl:template>
1421 <xsl:template match="block[@type='behaviors']">
1422 <h5 class="Subsection">Operation</h5>
1423 <xsl:apply-templates/>
1424 </xsl:template>
1425 <xsl:template match="block[@type='overrides']">
1426 <h5 class="Subsection">Note to Inheritors</h5>
1427 <xsl:apply-templates/>
1428 </xsl:template>
1429 <xsl:template match="block[@type='usage']">
1430 <h5 class="Subsection">Usage</h5>
1431 <xsl:apply-templates/>
1432 </xsl:template>
1434 <xsl:template match="c">
1435 <tt>
1436 <xsl:apply-templates/>
1437 </tt>
1438 </xsl:template>
1439 <xsl:template match="c//para">
1440 <xsl:apply-templates/><br/>
1441 </xsl:template>
1443 <xsl:template match="code">
1444 <xsl:call-template name="CreateCodeBlock">
1445 <xsl:with-param name="language" select="@lang" />
1446 <xsl:with-param name="content" select="string(descendant-or-self::text())" />
1447 </xsl:call-template>
1448 </xsl:template>
1450 <xsl:template match="onequarter">
1452 </xsl:template>
1453 <xsl:template match="pi">pi</xsl:template>
1454 <xsl:template match="theta">theta</xsl:template>
1455 <xsl:template match="subscript">
1456 <sub><xsl:value-of select="@term"/></sub>
1457 </xsl:template>
1458 <xsl:template match="superscript">
1459 <sup><xsl:value-of select="@term"/></sup>
1460 </xsl:template>
1462 <!-- tabular data
1463 example:
1465 <list type="table">
1466 <listheader>
1467 <term>First Col Header</term>
1468 <description>Second Col Header</description>
1469 <description>Third Col Header</description>
1470 </listheader>
1471 <item>
1472 <term>First Row First Col</term>
1473 <description>First Row Second Col</description>
1474 <description>First Row Third Col</description>
1475 </item>
1476 <item>
1477 <term>Second Row First Col</term>
1478 <description>Second Row Second Col</description>
1479 <description>Second Row Third Col</description>
1480 </item>
1481 </list>
1484 <xsl:template match="list[@type='table']">
1485 <xsl:call-template name="CreateListTable">
1486 <xsl:with-param name="header">
1487 <th><xsl:apply-templates select="listheader/term" mode="notoppara"/></th>
1488 <xsl:for-each select="listheader/description">
1489 <th><xsl:apply-templates mode="notoppara"/></th>
1490 </xsl:for-each>
1491 </xsl:with-param>
1493 <xsl:with-param name="content">
1494 <xsl:for-each select="item">
1495 <tr valign="top">
1496 <td>
1497 <xsl:apply-templates select="term" mode="notoppara"/>
1498 </td>
1499 <xsl:for-each select="description">
1500 <td>
1501 <xsl:apply-templates mode="notoppara"/>
1502 </td>
1503 </xsl:for-each>
1504 </tr>
1505 </xsl:for-each>
1506 </xsl:with-param>
1507 </xsl:call-template>
1508 </xsl:template>
1510 <xsl:template match="list[@type='bullet']">
1511 <ul>
1512 <xsl:for-each select="item">
1513 <li>
1514 <xsl:apply-templates select="term" mode="notoppara"/>
1515 </li>
1516 </xsl:for-each>
1517 </ul>
1518 </xsl:template>
1519 <xsl:template match="list[@type='number']">
1520 <ol>
1521 <xsl:for-each select="item">
1522 <li>
1523 <xsl:apply-templates select="term" mode="notoppara"/>
1524 </li>
1525 </xsl:for-each>
1526 </ol>
1527 </xsl:template>
1529 <xsl:template match="list">
1530 [<i>The '<xsl:value-of select="@type"/>' type of list has not been implemented in the ECMA stylesheet.</i>]
1532 <xsl:message>
1533 [<i>The '<xsl:value-of select="@type"/>' type of list has not been implemented in the ECMA stylesheet.</i>]
1534 </xsl:message>
1535 </xsl:template>
1537 <xsl:template match="see[@cref]">
1538 <xsl:choose>
1539 <xsl:when test="not(substring-after(@cref, 'T:')='')">
1540 <xsl:call-template name="maketypelink">
1541 <xsl:with-param name="type" select="normalize-space (@cref)"/>
1542 </xsl:call-template>
1543 </xsl:when>
1544 <xsl:when test="not(substring-after(@cref, 'N:')='')">
1545 <xsl:call-template name="makenamespacelink">
1546 <xsl:with-param name="cref" select="normalize-space (@cref)"/>
1547 </xsl:call-template>
1548 </xsl:when>
1549 <xsl:otherwise>
1550 <xsl:call-template name="makememberlink">
1551 <xsl:with-param name="cref" select="normalize-space (@cref)"/>
1552 </xsl:call-template>
1553 </xsl:otherwise>
1554 </xsl:choose>
1555 </xsl:template>
1557 <xsl:template match="see[@langword]">
1558 <tt><xsl:value-of select="@langword"/></tt>
1559 </xsl:template>
1561 <xsl:template name="GetInheritedMembers">
1562 <xsl:param name="declaringtype"/>
1563 <xsl:param name="generictypereplacements"/>
1564 <xsl:param name="listmembertype"/>
1565 <xsl:param name="showprotected"/>
1566 <xsl:param name="overloads-mode" select="false()" />
1567 <xsl:param name="showstatic" select='1'/>
1569 <xsl:choose>
1570 <xsl:when test="$listmembertype='ExtensionMethod' and $showprotected=false()">
1571 <xsl:for-each select="$declaringtype/Members/Member[MemberType=$listmembertype]">
1572 <Members Name="Link/@Type" FullName="Link/@Type">
1573 <Member MemberName="{@MemberName}">
1574 <xsl:attribute name="ExplicitMemberName">
1575 <xsl:call-template name="GetMemberNameWithoutGenericTypes">
1576 <xsl:with-param name="m" select="@MemberName" />
1577 </xsl:call-template>
1578 </xsl:attribute>
1579 <xsl:attribute name="TypeParameters">
1580 <xsl:call-template name="GetTypeParameterNames">
1581 <xsl:with-param name="member" select="." />
1582 </xsl:call-template>
1583 </xsl:attribute>
1584 <xsl:attribute name="Parameters">
1585 <xsl:call-template name="GetParameterTypes">
1586 <xsl:with-param name="member" select="." />
1587 </xsl:call-template>
1588 </xsl:attribute>
1589 <xsl:copy-of select="./*" />
1590 </Member>
1591 </Members>
1592 </xsl:for-each>
1593 </xsl:when>
1594 <xsl:otherwise>
1595 <Members Name="{$declaringtype/@Name}" FullName="{$declaringtype/@FullName}">
1597 <xsl:copy-of select="$generictypereplacements"/>
1599 <!-- Get all members in this type that are of listmembertype and are either
1600 protected or not protected according to showprotected. -->
1601 <xsl:choose>
1602 <xsl:when test="$listmembertype = 'Explicit'">
1603 <xsl:for-each select="$declaringtype/Members/Member
1604 [MemberType != 'Constructor']
1605 [contains (@MemberName, '.')]">
1606 <Member MemberName="{@MemberName}">
1607 <xsl:attribute name="ExplicitMemberName">
1608 <xsl:call-template name="GetMemberName">
1609 <xsl:with-param name="type" select="@MemberName" />
1610 <xsl:with-param name="isproperty" select="$listmembertype = 'Property'"/>
1611 </xsl:call-template>
1612 </xsl:attribute>
1613 <xsl:attribute name="TypeParameters">
1614 <xsl:call-template name="GetTypeParameterNames">
1615 <xsl:with-param name="member" select="." />
1616 </xsl:call-template>
1617 </xsl:attribute>
1618 <xsl:attribute name="Parameters">
1619 <xsl:call-template name="GetParameterTypes">
1620 <xsl:with-param name="member" select="." />
1621 </xsl:call-template>
1622 </xsl:attribute>
1623 <xsl:copy-of select="./*" />
1624 </Member>
1625 </xsl:for-each>
1626 </xsl:when>
1627 <xsl:otherwise>
1628 <xsl:for-each select="$declaringtype/Members/Member
1629 [(MemberType=$listmembertype or ($listmembertype='Operator' and MemberType='Method'))]
1630 [(not($overloads-mode) or @MemberName=$index or
1631 ($index='Conversion' and (@MemberName='op_Implicit' or @MemberName='op_Explicit'))) ]
1632 [$showprotected=starts-with(MemberSignature[@Language='C#']/@Value, 'protected ')]
1633 [($listmembertype='Method' and not(starts-with(@MemberName,'op_')))
1634 or ($listmembertype='Operator' and starts-with(@MemberName,'op_'))
1635 or (not($listmembertype='Method') and not($listmembertype='Operator'))]
1636 [$showstatic or not(contains(MemberSignature[@Language='C#']/@Value,' static '))]
1637 [$listmembertype = 'Constructor' or not(contains(@MemberName, '.'))]
1639 <Member MemberName="{@MemberName}">
1640 <xsl:attribute name="ExplicitMemberName">
1641 <xsl:call-template name="GetMemberNameWithoutGenericTypes">
1642 <xsl:with-param name="m" select="@MemberName" />
1643 </xsl:call-template>
1644 </xsl:attribute>
1645 <xsl:attribute name="TypeParameters">
1646 <xsl:call-template name="GetTypeParameterNames">
1647 <xsl:with-param name="member" select="." />
1648 </xsl:call-template>
1649 </xsl:attribute>
1650 <xsl:attribute name="Parameters">
1651 <xsl:call-template name="GetParameterTypes">
1652 <xsl:with-param name="member" select="." />
1653 </xsl:call-template>
1654 </xsl:attribute>
1655 <xsl:copy-of select="./*" />
1656 </Member>
1657 </xsl:for-each>
1658 </xsl:otherwise>
1659 </xsl:choose>
1661 <Docs>
1662 <xsl:copy-of select="$declaringtype/Docs/typeparam" />
1663 </Docs>
1665 </Members>
1666 </xsl:otherwise>
1667 </xsl:choose>
1669 <xsl:if test="not($listmembertype='Constructor') and count($declaringtype/Base/BaseTypeName)=1">
1670 <xsl:variable name="basedocsfile">
1671 <xsl:call-template name="GetLinkTarget">
1672 <xsl:with-param name="type">
1673 <xsl:call-template name="GetEscapedTypeName">
1674 <xsl:with-param name="typename" select="$declaringtype/Base/BaseTypeName" />
1675 </xsl:call-template>
1676 </xsl:with-param>
1677 <xsl:with-param name="cref">
1678 </xsl:with-param>
1679 <xsl:with-param name="local-suffix" />
1680 <xsl:with-param name="remote"/>
1681 <xsl:with-param name="xmltarget" select='1'/>
1682 </xsl:call-template>
1683 </xsl:variable>
1685 <xsl:if test="not(string($basedocsfile) = '')">
1686 <xsl:call-template name="GetInheritedMembers">
1687 <xsl:with-param name="listmembertype" select="$listmembertype"/>
1688 <xsl:with-param name="showprotected" select="$showprotected"/>
1689 <xsl:with-param name="declaringtype" select="document(string($basedocsfile),.)/Type"/>
1690 <xsl:with-param name="generictypereplacements" select="$declaringtype/Base/BaseTypeArguments/*"/>
1691 <xsl:with-param name="showstatic" select='0'/>
1692 </xsl:call-template>
1693 </xsl:if>
1694 </xsl:if>
1695 </xsl:template>
1697 <xsl:template name="GetMemberNameWithoutGenericTypes">
1698 <xsl:param name="m" />
1699 <xsl:choose>
1700 <xsl:when test="contains ($m, '&lt;')">
1701 <xsl:value-of select="substring-before ($m, '&lt;')" />
1702 </xsl:when>
1703 <xsl:otherwise>
1704 <xsl:value-of select="$m" />
1705 </xsl:otherwise>
1706 </xsl:choose>
1707 </xsl:template>
1709 <xsl:template name="GetTypeParameterNames">
1710 <xsl:param name="member" />
1712 <xsl:for-each select="$member/TypeParameters/TypeParameter">
1713 <xsl:if test="not(position()=1)">, </xsl:if>
1714 <xsl:value-of select="@Name" />
1715 </xsl:for-each>
1716 </xsl:template>
1718 <xsl:template name="GetParameterTypes">
1719 <xsl:param name="member" />
1721 <xsl:for-each select="$member/Parameters/Parameter">
1722 <xsl:if test="not(position()=1)">, </xsl:if>
1723 <xsl:value-of select="@Type" />
1724 </xsl:for-each>
1725 </xsl:template>
1727 <xsl:template name="ListAllMembers">
1728 <xsl:param name="html-anchor" select="false()" />
1730 <xsl:call-template name="ListMembers">
1731 <xsl:with-param name="listmembertype" select="'Constructor'"/>
1732 <xsl:with-param name="showprotected" select="false()"/>
1733 <xsl:with-param name="html-anchor" select="$html-anchor" />
1734 </xsl:call-template>
1736 <xsl:call-template name="ListMembers">
1737 <xsl:with-param name="listmembertype" select="'Constructor'"/>
1738 <xsl:with-param name="showprotected" select="true()"/>
1739 <xsl:with-param name="html-anchor" select="$html-anchor" />
1740 </xsl:call-template>
1742 <xsl:call-template name="ListMembers">
1743 <xsl:with-param name="listmembertype" select="'Field'"/>
1744 <xsl:with-param name="showprotected" select="false()"/>
1745 <xsl:with-param name="html-anchor" select="$html-anchor" />
1746 </xsl:call-template>
1748 <xsl:call-template name="ListMembers">
1749 <xsl:with-param name="listmembertype" select="'Field'"/>
1750 <xsl:with-param name="showprotected" select="true()"/>
1751 <xsl:with-param name="html-anchor" select="$html-anchor" />
1752 </xsl:call-template>
1754 <xsl:call-template name="ListMembers">
1755 <xsl:with-param name="listmembertype" select="'Property'"/>
1756 <xsl:with-param name="showprotected" select="false()"/>
1757 <xsl:with-param name="html-anchor" select="$html-anchor" />
1758 </xsl:call-template>
1760 <xsl:call-template name="ListMembers">
1761 <xsl:with-param name="listmembertype" select="'Property'"/>
1762 <xsl:with-param name="showprotected" select="true()"/>
1763 <xsl:with-param name="html-anchor" select="$html-anchor" />
1764 </xsl:call-template>
1766 <xsl:call-template name="ListMembers">
1767 <xsl:with-param name="listmembertype" select="'Method'"/>
1768 <xsl:with-param name="showprotected" select="false()"/>
1769 <xsl:with-param name="html-anchor" select="$html-anchor" />
1770 </xsl:call-template>
1772 <xsl:call-template name="ListMembers">
1773 <xsl:with-param name="listmembertype" select="'Method'"/>
1774 <xsl:with-param name="showprotected" select="true()"/>
1775 <xsl:with-param name="html-anchor" select="$html-anchor" />
1776 </xsl:call-template>
1778 <xsl:call-template name="ListMembers">
1779 <xsl:with-param name="listmembertype" select="'Event'"/>
1780 <xsl:with-param name="showprotected" select="false()"/>
1781 <xsl:with-param name="html-anchor" select="$html-anchor" />
1782 </xsl:call-template>
1784 <xsl:call-template name="ListMembers">
1785 <xsl:with-param name="listmembertype" select="'Event'"/>
1786 <xsl:with-param name="showprotected" select="true()"/>
1787 <xsl:with-param name="html-anchor" select="$html-anchor" />
1788 </xsl:call-template>
1790 <xsl:call-template name="ListMembers">
1791 <xsl:with-param name="listmembertype" select="'Operator'"/>
1792 <xsl:with-param name="showprotected" select="false()"/>
1793 <xsl:with-param name="html-anchor" select="$html-anchor" />
1794 </xsl:call-template>
1796 <xsl:call-template name="ListMembers">
1797 <xsl:with-param name="listmembertype" select="'Explicit'"/>
1798 <xsl:with-param name="showprotected" select="true()"/>
1799 <xsl:with-param name="html-anchor" select="$html-anchor" />
1800 </xsl:call-template>
1802 <xsl:call-template name="ListMembers">
1803 <xsl:with-param name="listmembertype" select="'ExtensionMethod'"/>
1804 <xsl:with-param name="showprotected" select="false()"/>
1805 <xsl:with-param name="html-anchor" select="$html-anchor" />
1806 </xsl:call-template>
1807 </xsl:template>
1809 <!-- Lists the members in the current Type node.
1810 Only lists members of type listmembertype.
1811 Displays the signature in siglanguage.
1812 showprotected = true() or false()
1814 <xsl:template name="ListMembers">
1815 <xsl:param name="listmembertype"/>
1816 <xsl:param name="showprotected"/>
1817 <xsl:param name="overloads-mode" select="false()" />
1818 <xsl:param name="html-anchor" select="false()" />
1820 <!-- get name and namespace of current type -->
1821 <xsl:variable name="TypeFullName" select="@FullName"/>
1822 <xsl:variable name="TypeName" select="@Name"/>
1823 <xsl:variable name="TypeNamespace" select="substring-before(@FullName, concat('.',@Name))"/>
1825 <xsl:variable name="MEMBERS-rtf">
1826 <xsl:call-template name="GetInheritedMembers">
1827 <xsl:with-param name="listmembertype" select="$listmembertype"/>
1828 <xsl:with-param name="showprotected" select="$showprotected"/>
1829 <xsl:with-param name="declaringtype" select="."/>
1830 <xsl:with-param name="overloads-mode" select="$overloads-mode" />
1831 </xsl:call-template>
1832 </xsl:variable>
1833 <xsl:variable name="MEMBERS" select="msxsl:node-set($MEMBERS-rtf)" />
1835 <!--
1836 <xsl:variable name="MEMBERS" select="
1837 $ALLMEMBERS/Member
1838 [(MemberType=$listmembertype or ($listmembertype='Operator' and MemberType='Method'))]
1839 [$showprotected=contains(MemberSignature[@Language='C#']/@Value,'protected')]
1840 [($listmembertype='Method' and not(starts-with(@MemberName,'op_')))
1841 or ($listmembertype='Operator' and starts-with(@MemberName,'op_'))
1842 or (not($listmembertype='Method') and not($listmembertype='Operator'))]
1846 <!-- if there aren't any, skip this -->
1847 <xsl:if test="count($MEMBERS//Member)">
1849 <xsl:variable name="SectionName">
1850 <xsl:if test="$listmembertype != 'Explicit' and $listmembertype != 'ExtensionMethod'">
1851 <xsl:if test="$showprotected">Protected </xsl:if>
1852 <xsl:if test="not($showprotected)">Public </xsl:if>
1853 </xsl:if>
1854 <xsl:call-template name="membertypeplural"><xsl:with-param name="name" select="$listmembertype"/></xsl:call-template>
1855 </xsl:variable>
1857 <!-- header -->
1858 <xsl:call-template name="CreateH3Section">
1859 <xsl:with-param name="name" select="$SectionName" />
1860 <xsl:with-param name="child-id" select="$SectionName" />
1861 <xsl:with-param name="content">
1862 <div class="SubsectionBox">
1863 <xsl:call-template name="CreateMembersTable">
1864 <xsl:with-param name="content">
1866 <xsl:for-each select="$MEMBERS/Members/Member">
1867 <!--<xsl:sort select="contains(MemberSignature[@Language='C#']/@Value,' static ')" data-type="text"/>-->
1868 <xsl:sort select="@MemberName = 'op_Implicit' or @MemberName = 'op_Explicit'"/>
1869 <xsl:sort select="@ExplicitMemberName" data-type="text"/>
1870 <xsl:sort select="count(TypeParameters/TypeParameter)"/>
1871 <xsl:sort select="@TypeParameters"/>
1872 <xsl:sort select="count(Parameters/Parameter)"/>
1873 <xsl:sort select="@Parameters"/>
1875 <xsl:variable name="local-id">
1876 <xsl:choose>
1877 <xsl:when test="count(Link) = 1">
1878 <xsl:value-of select="Link/@Member" />
1879 </xsl:when>
1880 <xsl:otherwise>
1881 <xsl:call-template name="GetLinkId" >
1882 <xsl:with-param name="type" select="parent::Members" />
1883 <xsl:with-param name="member" select="." />
1884 </xsl:call-template>
1885 </xsl:otherwise>
1886 </xsl:choose>
1887 </xsl:variable>
1889 <xsl:variable name="linkfile">
1890 <xsl:if test="not(parent::Members/@FullName = $TypeFullName)">
1891 <xsl:call-template name="GetLinkTargetHtml">
1892 <xsl:with-param name="type">
1893 <xsl:choose>
1894 <xsl:when test="count(Link) = 1">
1895 <xsl:value-of select="Link/@Type"/>
1896 </xsl:when>
1897 <xsl:otherwise>
1898 <xsl:call-template name="GetEscapedTypeName">
1899 <xsl:with-param name="typename" select="parent::Members/@FullName" />
1900 </xsl:call-template>
1901 </xsl:otherwise>
1902 </xsl:choose>
1903 </xsl:with-param>
1904 <xsl:with-param name="cref" />
1905 </xsl:call-template>
1906 </xsl:if>
1907 </xsl:variable>
1909 <xsl:variable name="linkid">
1910 <xsl:if test="$html-anchor">
1911 <xsl:value-of select="$linkfile" />
1912 <xsl:text>#</xsl:text>
1913 </xsl:if>
1914 <xsl:value-of select="$local-id" />
1915 </xsl:variable>
1917 <xsl:variable name="isinherited">
1918 <xsl:if test="$listmembertype != 'ExtensionMethod' and not(parent::Members/@FullName = $TypeFullName)">
1919 <xsl:text> (</xsl:text>
1921 <xsl:text>Inherited from </xsl:text>
1922 <xsl:call-template name="maketypelink">
1923 <xsl:with-param name="type" select="parent::Members/@FullName"/>
1924 <xsl:with-param name="wrt" select="$TypeNamespace"/>
1925 </xsl:call-template>
1926 <xsl:text>.</xsl:text>
1927 </i>
1928 <xsl:text>)</xsl:text>
1929 </xsl:if>
1930 </xsl:variable>
1932 <tr valign="top">
1933 <td>
1934 <!-- random info -->
1936 <!-- check if it has get and set accessors -->
1937 <xsl:if test="MemberType='Property' and not(contains(MemberSignature[@Language='C#']/@Value, 'set;'))">
1938 <xsl:text>[read-only]</xsl:text>
1939 </xsl:if>
1940 <xsl:if test="MemberType='Property' and not(contains(MemberSignature[@Language='C#']/@Value, 'get;'))">
1941 <xsl:text>[write-only]</xsl:text>
1942 </xsl:if>
1944 <xsl:if test="contains(MemberSignature[@Language='C#']/@Value,'this[')">
1945 <div><i>default property</i></div>
1946 </xsl:if>
1948 <div>
1949 <xsl:call-template name="getmodifiers">
1950 <xsl:with-param name="sig" select="MemberSignature[@Language='C#']/@Value"/>
1951 <xsl:with-param name="protection" select="false()"/>
1952 <xsl:with-param name="inheritance" select="true()"/>
1953 <xsl:with-param name="extra" select="false()"/>
1954 </xsl:call-template>
1955 </div>
1956 </td>
1958 <xsl:choose>
1959 <!-- constructor listing -->
1960 <xsl:when test="MemberType='Constructor'">
1961 <!-- link to constructor page -->
1962 <td>
1963 <div>
1965 <a href="{$linkid}">
1966 <xsl:call-template name="GetConstructorName">
1967 <xsl:with-param name="type" select="parent::Members" />
1968 <xsl:with-param name="ctor" select="." />
1969 </xsl:call-template>
1970 </a>
1971 </b>
1973 <!-- argument list -->
1974 <xsl:value-of select="'('"/>
1975 <xsl:for-each select="Parameters/Parameter">
1976 <xsl:if test="not(position()=1)">, </xsl:if>
1978 <xsl:call-template name="ShowParameter">
1979 <xsl:with-param name="Param" select="."/>
1980 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
1981 <xsl:with-param name="prototype" select="true()"/>
1982 </xsl:call-template>
1983 </xsl:for-each>
1984 <xsl:value-of select="')'"/>
1985 </div>
1987 <!-- TODO: $implemented? -->
1989 </td>
1990 </xsl:when>
1992 <xsl:when test="$listmembertype = 'Explicit'">
1993 <td>
1994 <a href="{$linkid}">
1996 <xsl:call-template name="GetMemberDisplayName">
1997 <xsl:with-param name="memberName" select="@MemberName" />
1998 <xsl:with-param name="isproperty" select="MemberType='Property'" />
1999 </xsl:call-template>
2000 </b>
2001 </a>
2002 </td>
2003 </xsl:when>
2005 <!-- field, property and event listing -->
2006 <xsl:when test="MemberType='Field' or MemberType='Property' or MemberType='Event'">
2007 <td>
2009 <!-- link to member page -->
2011 <a href="{$linkid}">
2012 <xsl:call-template name="GetMemberDisplayName">
2013 <xsl:with-param name="memberName" select="@MemberName" />
2014 <xsl:with-param name="isproperty" select="MemberType='Property'" />
2015 </xsl:call-template>
2016 </a>
2017 </b>
2019 <!-- argument list for accessors -->
2020 <xsl:if test="Parameters/Parameter">
2021 <xsl:value-of select="'('"/>
2022 <xsl:for-each select="Parameters/Parameter">
2023 <xsl:if test="not(position()=1)">, </xsl:if>
2025 <xsl:call-template name="ShowParameter">
2026 <xsl:with-param name="Param" select="."/>
2027 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
2028 <xsl:with-param name="prototype" select="true()"/>
2029 </xsl:call-template>
2031 </xsl:for-each>
2032 <xsl:value-of select="')'"/>
2033 </xsl:if>
2035 </td>
2036 </xsl:when>
2038 <!-- method listing -->
2039 <xsl:when test="$listmembertype='Method' or $listmembertype = 'ExtensionMethod'">
2040 <td colspan="2">
2042 <!-- link to method page -->
2044 <a href="{$linkid}">
2045 <xsl:call-template name="GetMemberDisplayName">
2046 <xsl:with-param name="memberName" select="@MemberName" />
2047 <xsl:with-param name="isproperty" select="MemberType='Property'" />
2048 </xsl:call-template>
2049 </a>
2050 </b>
2052 <!-- argument list -->
2053 <xsl:value-of select="'('"/>
2054 <xsl:for-each select="Parameters/Parameter">
2055 <xsl:if test="not(position()=1)">, </xsl:if>
2057 <xsl:call-template name="ShowParameter">
2058 <xsl:with-param name="Param" select="."/>
2059 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
2060 <xsl:with-param name="prototype" select="true()"/>
2061 </xsl:call-template>
2063 </xsl:for-each>
2064 <xsl:value-of select="')'"/>
2066 <!-- return type -->
2067 <xsl:if test="not(ReturnValue/ReturnType='System.Void')">
2068 <nobr>
2069 <xsl:text> : </xsl:text>
2070 <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
2071 </nobr>
2072 </xsl:if>
2074 <blockquote>
2075 <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
2076 <xsl:copy-of select="$isinherited"/>
2077 </blockquote>
2078 </td>
2079 </xsl:when>
2081 <xsl:when test="$listmembertype='Operator'">
2082 <td>
2084 <!-- link to operator page -->
2085 <xsl:choose>
2086 <xsl:when test="@MemberName='op_Implicit' or @MemberName='op_Explicit'">
2088 <a href="{$linkid}">
2089 <xsl:text>Conversion</xsl:text>
2090 <xsl:choose>
2091 <xsl:when test="ReturnValue/ReturnType = //Type/@FullName">
2092 <xsl:text> From </xsl:text>
2093 <xsl:value-of select="Parameters/Parameter/@Type"/>
2094 </xsl:when>
2095 <xsl:otherwise>
2096 <xsl:text> to </xsl:text>
2097 <xsl:value-of select="ReturnValue/ReturnType"/>
2098 </xsl:otherwise>
2099 </xsl:choose>
2100 </a>
2101 </b>
2103 <xsl:choose>
2104 <xsl:when test="@MemberName='op_Implicit'">
2105 <xsl:text>(Implicit)</xsl:text>
2106 </xsl:when>
2107 <xsl:otherwise>
2108 <xsl:text>(Explicit)</xsl:text>
2109 </xsl:otherwise>
2110 </xsl:choose>
2111 </xsl:when>
2112 <xsl:when test="count(Parameters/Parameter)=1">
2114 <a href="{$linkid}">
2115 <xsl:value-of select="substring-after(@MemberName, 'op_')"/>
2116 </a>
2117 </b>
2118 </xsl:when>
2119 <xsl:otherwise>
2121 <a href="{$linkid}">
2122 <xsl:value-of select="substring-after(@MemberName, 'op_')"/>
2123 </a>
2124 </b>
2125 <xsl:value-of select="'('"/>
2126 <xsl:for-each select="Parameters/Parameter">
2127 <xsl:if test="not(position()=1)">, </xsl:if>
2129 <xsl:call-template name="ShowParameter">
2130 <xsl:with-param name="Param" select="."/>
2131 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
2132 <xsl:with-param name="prototype" select="true()"/>
2133 </xsl:call-template>
2135 </xsl:for-each>
2136 <xsl:value-of select="')'"/>
2137 </xsl:otherwise>
2138 </xsl:choose>
2139 </td>
2140 </xsl:when>
2142 <xsl:otherwise>
2143 <!-- Other types: just provide a link -->
2144 <td>
2145 <a href="{$linkid}">
2146 <xsl:call-template name="GetMemberDisplayName">
2147 <xsl:with-param name="memberName" select="@MemberName" />
2148 <xsl:with-param name="isproperty" select="MemberType='Property'" />
2149 </xsl:call-template>
2150 </a>
2151 </td>
2152 </xsl:otherwise>
2153 </xsl:choose>
2155 <xsl:if test="$listmembertype != 'Method' and $listmembertype != 'ExtensionMethod'">
2156 <td>
2157 <!-- description -->
2158 <xsl:if test="MemberType='Field' or MemberType = 'Property'">
2159 <i><xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates></i>
2160 <xsl:if test="MemberValue"> (<xsl:value-of select="MemberValue"/>)</xsl:if>
2161 <xsl:text>. </xsl:text>
2162 </xsl:if>
2164 <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
2165 <xsl:copy-of select="$isinherited"/>
2166 </td>
2167 </xsl:if>
2169 </tr>
2170 </xsl:for-each>
2172 </xsl:with-param>
2173 </xsl:call-template>
2174 </div>
2175 </xsl:with-param>
2176 </xsl:call-template>
2178 </xsl:if>
2180 </xsl:template>
2182 <xsl:template name="GetLinkName">
2183 <xsl:param name="type"/>
2184 <xsl:param name="member"/>
2185 <xsl:call-template name="memberlinkprefix">
2186 <xsl:with-param name="member" select="$member"/>
2187 </xsl:call-template>
2188 <xsl:text>:</xsl:text>
2189 <xsl:call-template name="GetEscapedTypeName">
2190 <xsl:with-param name="typename" select="$type/@FullName" />
2191 </xsl:call-template>
2192 <xsl:if test="$member/MemberType != 'Constructor'">
2193 <xsl:text>.</xsl:text>
2194 <xsl:variable name="memberName">
2195 <xsl:call-template name="GetGenericName">
2196 <xsl:with-param name="membername" select="$member/@MemberName" />
2197 <xsl:with-param name="member" select="$member" />
2198 </xsl:call-template>
2199 </xsl:variable>
2200 <xsl:call-template name="Replace">
2201 <xsl:with-param name="s">
2202 <xsl:call-template name="ToBraces">
2203 <xsl:with-param name="s" select="$memberName" />
2204 </xsl:call-template>
2205 </xsl:with-param>
2206 <xsl:with-param name="from">.</xsl:with-param>
2207 <xsl:with-param name="to">#</xsl:with-param>
2208 </xsl:call-template>
2209 </xsl:if>
2210 </xsl:template>
2212 <xsl:template name="GetGenericName">
2213 <xsl:param name="membername" />
2214 <xsl:param name="member" />
2215 <xsl:variable name="numgenargs" select="count($member/Docs/typeparam)" />
2216 <xsl:choose>
2217 <xsl:when test="$numgenargs = 0">
2218 <xsl:value-of select="$membername" />
2219 </xsl:when>
2220 <xsl:otherwise>
2221 <xsl:if test="contains($membername, '&lt;')">
2222 <xsl:value-of select="substring-before ($membername, '&lt;')" />
2223 </xsl:if>
2224 <xsl:text>``</xsl:text>
2225 <xsl:value-of select="$numgenargs" />
2226 </xsl:otherwise>
2227 </xsl:choose>
2228 </xsl:template>
2230 <xsl:template name="GetEscapedTypeName">
2231 <xsl:param name="typename" />
2232 <xsl:variable name="base" select="substring-before ($typename, '&lt;')" />
2234 <xsl:choose>
2235 <xsl:when test="$base != ''">
2236 <xsl:value-of select="translate ($base, '+', '.')" />
2237 <xsl:text>`</xsl:text>
2238 <xsl:call-template name="GetGenericArgumentCount">
2239 <xsl:with-param name="arglist" select="substring-after ($typename, '&lt;')" />
2240 <xsl:with-param name="count">1</xsl:with-param>
2241 </xsl:call-template>
2242 </xsl:when>
2243 <xsl:otherwise><xsl:value-of select="translate ($typename, '+', '.')" /></xsl:otherwise>
2244 </xsl:choose>
2245 </xsl:template>
2247 <xsl:template name="GetGenericArgumentCount">
2248 <xsl:param name="arglist" />
2249 <xsl:param name="count" />
2251 <xsl:variable name="rest-rtf">
2252 <xsl:call-template name="SkipTypeArgument">
2253 <xsl:with-param name="s" select="$arglist" />
2254 </xsl:call-template>
2255 </xsl:variable>
2256 <xsl:variable name="rest" select="string($rest-rtf)" />
2258 <xsl:choose>
2259 <xsl:when test="$arglist != '' and $rest = ''">
2260 <xsl:value-of select="$count" />
2261 </xsl:when>
2262 <xsl:when test="$arglist = '' and $rest = ''">
2263 <xsl:message terminate="yes">
2264 !WTF? arglist=<xsl:value-of select="$arglist" />; rest=<xsl:value-of select="$rest" />
2265 </xsl:message>
2266 </xsl:when>
2267 <xsl:when test="starts-with ($rest, '>')">
2268 <xsl:value-of select="$count" />
2269 <xsl:call-template name="GetEscapedTypeName">
2270 <xsl:with-param name="typename" select="substring-after ($rest, '>')" />
2271 </xsl:call-template>
2272 </xsl:when>
2273 <xsl:when test="starts-with ($rest, ',')">
2274 <xsl:call-template name="GetGenericArgumentCount">
2275 <xsl:with-param name="arglist" select="substring-after ($rest, ',')" />
2276 <xsl:with-param name="count" select="$count+1" />
2277 </xsl:call-template>
2278 </xsl:when>
2279 <xsl:otherwise>
2280 <xsl:message terminate="yes">
2281 !WTF 2? arglist=<xsl:value-of select="$arglist" />; rest=<xsl:value-of select="$rest" />
2282 </xsl:message>
2283 </xsl:otherwise>
2284 </xsl:choose>
2285 </xsl:template>
2287 <xsl:template name="SkipTypeArgument">
2288 <xsl:param name="s" />
2290 <xsl:variable name="p-rtf">
2291 <xsl:call-template name="GetCLtGtPositions">
2292 <xsl:with-param name="s" select="$s" />
2293 </xsl:call-template>
2294 </xsl:variable>
2295 <xsl:variable name="p" select="msxsl:node-set($p-rtf)"/>
2297 <xsl:choose>
2298 <!--
2299 Have to select between three `s' patterns:
2300 A,B>: need to return ",B>"
2301 Foo<A,B>>: Need to forward to SkipGenericArgument to eventually return ">"
2302 Foo<A,B>+C>: Need to forward to SkipGenericArgument to eventually return ">"
2304 <xsl:when test="starts-with ($s, '>')">
2305 <xsl:message terminate="yes">
2306 SkipTypeArgument: invalid type substring '<xsl:value-of select="$s" />'
2307 </xsl:message>
2308 </xsl:when>
2309 <xsl:when test="$p/Comma/@Length > 0 and
2310 ($p/Lt/@Length = 0 or $p/Comma/@Length &lt; $p/Lt/@Length) and
2311 ($p/Gt/@Length > 0 and $p/Comma/@Length &lt; $p/Gt/@Length)">
2312 <xsl:text>,</xsl:text>
2313 <xsl:value-of select="substring-after ($s, ',')" />
2314 </xsl:when>
2315 <xsl:when test="$p/Lt/@Length > 0 and $p/Lt/@Length &lt; $p/Gt/@Length">
2316 <xsl:variable name="r">
2317 <xsl:call-template name="SkipGenericArgument">
2318 <xsl:with-param name="s" select="substring-after ($s, '&lt;')" />
2319 </xsl:call-template>
2320 </xsl:variable>
2321 <xsl:value-of select="substring-after ($r, '&gt;')" />
2322 </xsl:when>
2323 <xsl:when test="$p/Gt/@Length > 0">
2324 <xsl:text>&gt;</xsl:text>
2325 <xsl:value-of select="substring-after ($s, '&gt;')" />
2326 </xsl:when>
2327 <xsl:otherwise><xsl:value-of select="$s" /></xsl:otherwise>
2328 </xsl:choose>
2329 </xsl:template>
2331 <xsl:template name="GetCLtGtPositions">
2332 <xsl:param name="s" />
2334 <xsl:variable name="c" select="substring-before ($s, ',')" />
2335 <xsl:variable name="lt" select="substring-before ($s, '&lt;')" />
2336 <xsl:variable name="gt" select="substring-before ($s, '&gt;')" />
2338 <Comma String="{$c}" Length="{string-length ($c)}" />
2339 <Lt String="{$lt}" Length="{string-length ($lt)}" />
2340 <Gt String="{$gt}" Length="{string-length ($gt)}" />
2341 </xsl:template>
2343 <!--
2344 when given 'Foo<A,Bar<Baz<C,D,E>>>>', returns '>'
2345 when given 'Bar<C>+Nested>', returns '>'
2346 when given 'Foo<A,Bar<Baz<C,D,E>>>,', returns ','
2347 (basically, it matches '<' to '>' and "skips" the intermediate type-name contents.
2349 <xsl:template name="SkipGenericArgument">
2350 <xsl:param name="s" />
2352 <xsl:variable name="p-rtf">
2353 <xsl:call-template name="GetCLtGtPositions">
2354 <xsl:with-param name="s" select="$s" />
2355 </xsl:call-template>
2356 </xsl:variable>
2357 <xsl:variable name="p" select="msxsl:node-set($p-rtf)" />
2359 <xsl:choose>
2360 <xsl:when test="starts-with ($s, '>')">
2361 <xsl:message terminate="yes">
2362 SkipGenericArgument: invalid type substring '<xsl:value-of select="$s" />'
2363 </xsl:message>
2364 </xsl:when>
2365 <xsl:when test="$p/Lt/@Length > 0 and $p/Lt/@Length &lt; $p/Gt/@Length">
2366 <!-- within 'Foo<A...'; look for matching '>' -->
2367 <xsl:variable name="r">
2368 <xsl:call-template name="SkipGenericArgument">
2369 <xsl:with-param name="s" select="substring-after ($s, '&lt;')" />
2370 </xsl:call-template>
2371 </xsl:variable>
2372 <xsl:value-of select="substring-after ($r, '&gt;')" />
2373 </xsl:when>
2374 <xsl:when test="$p/Gt/@Length > 0">
2375 <!--<xsl:value-of select="substring ($s, string-length ($gt)+1)" />-->
2376 <xsl:value-of select="substring-after ($s, '&gt;')" />
2377 </xsl:when>
2378 <xsl:otherwise>
2379 <xsl:value-of select="$s" />
2380 </xsl:otherwise>
2381 </xsl:choose>
2382 </xsl:template>
2384 <xsl:template name="GetEscapedParameter">
2385 <xsl:param name="orig-parameter-type" />
2386 <xsl:param name="parameter-type" />
2387 <xsl:param name="parameter-types" />
2388 <xsl:param name="escape" />
2389 <xsl:param name="index" />
2391 <xsl:choose>
2392 <xsl:when test="$index &gt; count($parameter-types)">
2393 <xsl:if test="$parameter-type != $orig-parameter-type">
2394 <xsl:value-of select="$parameter-type" />
2395 </xsl:if>
2396 <!-- ignore -->
2397 </xsl:when>
2398 <xsl:when test="$parameter-types[position() = $index]/@name = $parameter-type">
2399 <xsl:value-of select="concat ($escape, $index - 1)" />
2400 </xsl:when>
2401 <xsl:otherwise>
2402 <xsl:variable name="typeparam" select="$parameter-types[position() = $index]/@name" />
2403 <xsl:call-template name="GetEscapedParameter">
2404 <xsl:with-param name="orig-parameter-type" select="$orig-parameter-type" />
2405 <xsl:with-param name="parameter-type">
2406 <xsl:call-template name="Replace">
2407 <xsl:with-param name="s">
2408 <xsl:call-template name="Replace">
2409 <xsl:with-param name="s">
2410 <xsl:call-template name="Replace">
2411 <xsl:with-param name="s">
2412 <xsl:call-template name="Replace">
2413 <xsl:with-param name="s" select="$parameter-type"/>
2414 <xsl:with-param name="from" select="concat('&lt;', $typeparam, '&gt;')" />
2415 <xsl:with-param name="to" select="concat('&lt;', $escape, $index - 1, '&gt;')" />
2416 </xsl:call-template>
2417 </xsl:with-param>
2418 <xsl:with-param name="from" select="concat('&lt;', $typeparam, ',')" />
2419 <xsl:with-param name="to" select="concat('&lt;', $escape, $index - 1, ',')" />
2420 </xsl:call-template>
2421 </xsl:with-param>
2422 <xsl:with-param name="from" select="concat (',', $typeparam, '&gt;')" />
2423 <xsl:with-param name="to" select="concat(',', $escape, $index - 1, '&gt;')" />
2424 </xsl:call-template>
2425 </xsl:with-param>
2426 <xsl:with-param name="from" select="concat (',', $typeparam, ',')" />
2427 <xsl:with-param name="to" select="concat(',', $escape, $index - 1, ',')" />
2428 </xsl:call-template>
2429 </xsl:with-param>
2430 <xsl:with-param name="parameter-types" select="$parameter-types" />
2431 <xsl:with-param name="typeparam" select="$typeparam" />
2432 <xsl:with-param name="escape" select="$escape" />
2433 <xsl:with-param name="index" select="$index + 1" />
2434 </xsl:call-template>
2435 </xsl:otherwise>
2436 </xsl:choose>
2437 </xsl:template>
2439 <xsl:template name="GetLinkId">
2440 <xsl:param name="type"/>
2441 <xsl:param name="member"/>
2442 <xsl:call-template name="GetLinkName">
2443 <xsl:with-param name="type" select="$type" />
2444 <xsl:with-param name="member" select="$member" />
2445 </xsl:call-template>
2446 <xsl:if test="count($member/Parameters/Parameter) &gt; 0">
2447 <xsl:text>(</xsl:text>
2448 <xsl:for-each select="Parameters/Parameter">
2449 <xsl:if test="not(position()=1)">,</xsl:if>
2450 <xsl:call-template name="GetParameterType">
2451 <xsl:with-param name="type" select="$type" />
2452 <xsl:with-param name="member" select="$member" />
2453 <xsl:with-param name="parameter" select="." />
2454 </xsl:call-template>
2455 </xsl:for-each>
2456 <xsl:text>)</xsl:text>
2457 </xsl:if>
2458 <xsl:if test="$member/@MemberName='op_Implicit' or $member/@MemberName='op_Explicit'">
2459 <xsl:text>~</xsl:text>
2460 <xsl:variable name="parameter-rtf">
2461 <Parameter Type="{$member/ReturnValue/ReturnType}" />
2462 </xsl:variable>
2463 <xsl:call-template name="GetParameterType">
2464 <xsl:with-param name="type" select="$type" />
2465 <xsl:with-param name="member" select="$member" />
2466 <xsl:with-param name="parameter" select="msxsl:node-set($parameter-rtf)/Parameter" />
2467 </xsl:call-template>
2468 </xsl:if>
2469 </xsl:template>
2471 <!--
2472 - what should be <xsl:value-of select="@Type" /> becomes a nightmare once
2473 - generics enter the picture, since a parameter type could come from the
2474 - type itelf (becoming `N) or from the method (becoming ``N).
2476 <xsl:template name="GetParameterType">
2477 <xsl:param name="type" />
2478 <xsl:param name="member" />
2479 <xsl:param name="parameter" />
2481 <!-- the actual parameter type -->
2482 <xsl:variable name="ptype">
2483 <xsl:choose>
2484 <xsl:when test="contains($parameter/@Type, '[')">
2485 <xsl:value-of select="substring-before ($parameter/@Type, '[')" />
2486 </xsl:when>
2487 <xsl:when test="contains($parameter/@Type, '&amp;')">
2488 <xsl:value-of select="substring-before ($parameter/@Type, '&amp;')" />
2489 </xsl:when>
2490 <xsl:when test="contains($parameter/@Type, '*')">
2491 <xsl:value-of select="substring-before ($parameter/@Type, '*')" />
2492 </xsl:when>
2493 <xsl:otherwise>
2494 <xsl:value-of select="$parameter/@Type" />
2495 </xsl:otherwise>
2496 </xsl:choose>
2497 </xsl:variable>
2499 <!-- parameter modifiers -->
2500 <xsl:variable name="pmodifier">
2501 <xsl:call-template name="Replace">
2502 <xsl:with-param name="s" select="substring-after ($parameter/@Type, $ptype)" />
2503 <xsl:with-param name="from">&amp;</xsl:with-param>
2504 <xsl:with-param name="to">@</xsl:with-param>
2505 </xsl:call-template>
2506 </xsl:variable>
2508 <xsl:variable name="gen-type">
2509 <xsl:call-template name="GetEscapedParameter">
2510 <xsl:with-param name="orig-parameter-type" select="$ptype" />
2511 <xsl:with-param name="parameter-type">
2512 <xsl:variable name="nested">
2513 <xsl:call-template name="GetEscapedParameter">
2514 <xsl:with-param name="orig-parameter-type" select="$ptype" />
2515 <xsl:with-param name="parameter-type" select="$ptype" />
2516 <xsl:with-param name="parameter-types" select="$type/Docs/typeparam" />
2517 <xsl:with-param name="escape" select="'`'" />
2518 <xsl:with-param name="index" select="1" />
2519 </xsl:call-template>
2520 </xsl:variable>
2521 <xsl:choose>
2522 <xsl:when test="$nested != ''">
2523 <xsl:value-of select="$nested" />
2524 </xsl:when>
2525 <xsl:otherwise>
2526 <xsl:value-of select="$ptype" />
2527 </xsl:otherwise>
2528 </xsl:choose>
2529 </xsl:with-param>
2530 <xsl:with-param name="parameter-types" select="$member/Docs/typeparam" />
2531 <xsl:with-param name="escape" select="'``'" />
2532 <xsl:with-param name="index" select="1" />
2533 </xsl:call-template>
2534 </xsl:variable>
2536 <!-- the actual parameter type -->
2537 <xsl:variable name="parameter-type">
2538 <xsl:choose>
2539 <xsl:when test="$gen-type != ''">
2540 <xsl:value-of select="$gen-type" />
2541 <xsl:value-of select="$pmodifier" />
2542 </xsl:when>
2543 <xsl:otherwise>
2544 <xsl:value-of select="concat($ptype, $pmodifier)" />
2545 </xsl:otherwise>
2546 </xsl:choose>
2547 </xsl:variable>
2549 <!-- s/</{/g; s/>/}/g; so that less escaping is needed. -->
2550 <xsl:call-template name="Replace">
2551 <xsl:with-param name="s">
2552 <xsl:call-template name="Replace">
2553 <xsl:with-param name="s" select="translate ($parameter-type, '+', '.')" />
2554 <xsl:with-param name="from">&gt;</xsl:with-param>
2555 <xsl:with-param name="to">}</xsl:with-param>
2556 </xsl:call-template>
2557 </xsl:with-param>
2558 <xsl:with-param name="from">&lt;</xsl:with-param>
2559 <xsl:with-param name="to">{</xsl:with-param>
2560 </xsl:call-template>
2561 </xsl:template>
2563 <xsl:template name="Replace">
2564 <xsl:param name="s" />
2565 <xsl:param name="from" />
2566 <xsl:param name="to" />
2567 <xsl:choose>
2568 <xsl:when test="not(contains($s, $from))">
2569 <xsl:value-of select="$s" />
2570 </xsl:when>
2571 <xsl:otherwise>
2572 <xsl:variable name="prefix" select="substring-before($s, $from)"/>
2573 <xsl:variable name="suffix" select="substring-after($s, $from)" />
2574 <xsl:value-of select="$prefix" />
2575 <xsl:value-of select="$to" />
2576 <xsl:call-template name="Replace">
2577 <xsl:with-param name="s" select="$suffix" />
2578 <xsl:with-param name="from" select="$from" />
2579 <xsl:with-param name="to" select="$to" />
2580 </xsl:call-template>
2581 </xsl:otherwise>
2582 </xsl:choose>
2583 </xsl:template>
2585 <xsl:template name="getmodifiers">
2586 <xsl:param name="sig"/>
2587 <xsl:param name="protection" select="true()"/>
2588 <xsl:param name="inheritance" select="true()"/>
2589 <xsl:param name="extra" select="true()"/>
2590 <xsl:param name="typetype" select="false()"/>
2592 <xsl:variable name="Sig">
2593 <xsl:text> </xsl:text>
2594 <xsl:choose>
2595 <xsl:when test="contains($sig, '{')">
2596 <xsl:value-of select="substring-before ($sig, '{')" />
2597 </xsl:when>
2598 <xsl:otherwise>
2599 <xsl:value-of select="$sig" />
2600 </xsl:otherwise>
2601 </xsl:choose>
2602 <xsl:text> </xsl:text>
2603 </xsl:variable>
2605 <xsl:if test="$protection">
2606 <xsl:if test="contains($Sig, ' public ')">public </xsl:if>
2607 <xsl:if test="contains($Sig, ' private ')">private </xsl:if>
2608 <xsl:if test="contains($Sig, ' protected ')">protected </xsl:if>
2609 <xsl:if test="contains($Sig, ' internal ')">internal </xsl:if>
2610 </xsl:if>
2612 <xsl:if test="contains($Sig, ' static ')">static </xsl:if>
2613 <xsl:if test="contains($Sig, ' abstract ')">abstract </xsl:if>
2614 <xsl:if test="contains($Sig, ' operator ')">operator </xsl:if>
2616 <xsl:if test="contains($Sig, ' const ')">const </xsl:if>
2617 <xsl:if test="contains($Sig, ' readonly ')">readonly </xsl:if>
2619 <xsl:if test="$inheritance">
2620 <xsl:if test="contains($Sig, ' override ')">override </xsl:if>
2621 <xsl:if test="contains($Sig, ' new ')">new </xsl:if>
2622 </xsl:if>
2624 <xsl:if test="$extra">
2625 <xsl:if test="contains($Sig, ' sealed ')">sealed </xsl:if>
2626 <xsl:if test="contains($Sig, ' virtual ')">virtual </xsl:if>
2628 <xsl:if test="contains($Sig, ' extern ')">extern </xsl:if>
2629 <xsl:if test="contains($Sig, ' checked ')">checked </xsl:if>
2630 <xsl:if test="contains($Sig, ' unsafe ')">unsafe </xsl:if>
2631 <xsl:if test="contains($Sig, ' volatile ')">volatile </xsl:if>
2632 <xsl:if test="contains($Sig, ' explicit ')">explicit </xsl:if>
2633 <xsl:if test="contains($Sig, ' implicit ')">implicit </xsl:if>
2634 </xsl:if>
2636 <xsl:if test="$typetype">
2637 <xsl:if test="contains($Sig, ' class ')">class </xsl:if>
2638 <xsl:if test="contains($Sig, ' interface ')">interface </xsl:if>
2639 <xsl:if test="contains($Sig, ' struct ')">struct </xsl:if>
2640 <xsl:if test="contains($Sig, ' delegate ')">delegate </xsl:if>
2641 <xsl:if test="contains($Sig, ' enum ')">enum </xsl:if>
2642 </xsl:if>
2643 </xsl:template>
2645 <xsl:template name="GetTypeDescription">
2646 <xsl:variable name="sig" select="TypeSignature[@Language='C#']/@Value"/>
2647 <xsl:choose>
2648 <xsl:when test="contains($sig, ' class ')">Class</xsl:when>
2649 <xsl:when test="contains($sig, ' interface ')">Interface</xsl:when>
2650 <xsl:when test="contains($sig, ' struct ')">Struct</xsl:when>
2651 <xsl:when test="contains($sig, ' delegate ')">Delegate</xsl:when>
2652 <xsl:when test="contains($sig, ' enum ')">Enum</xsl:when>
2653 </xsl:choose>
2654 </xsl:template>
2656 <xsl:template match="since">
2658 <i>Note: This namespace, class, or member is supported only in version <xsl:value-of select="@version" />
2659 and later.</i>
2660 </p>
2661 </xsl:template>
2663 <xsl:template name="GetLinkTargetHtml">
2664 <xsl:param name="type" />
2665 <xsl:param name="cref" />
2667 <xsl:variable name="href">
2668 <xsl:call-template name="GetLinkTarget">
2669 <xsl:with-param name="type" select="$type" />
2670 <xsl:with-param name="cref" select="$cref" />
2671 </xsl:call-template>
2672 </xsl:variable>
2673 <xsl:choose>
2674 <xsl:when test="string($href) = ''">
2675 <xsl:text>javascript:alert("Documentation not found.")</xsl:text>
2676 </xsl:when>
2677 <xsl:otherwise><xsl:value-of select="$href" /></xsl:otherwise>
2678 </xsl:choose>
2679 </xsl:template>
2681 </xsl:stylesheet>