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
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)
25 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
28 <!-- TEMPLATE PARAMETERS -->
29 <xsl:param name="language" select="'C#'"/>
30 <xsl:param name="index" />
32 <xsl:variable name="ThisType" select="/Type"/>
34 <!-- The namespace that the current type belongs to. -->
35 <xsl:variable name="TypeNamespace" select="substring(/Type/@FullName, 1, string-length(/Type/@FullName) - string-length(/Type/@Name) - 1)"/>
37 <!-- THE MAIN RENDERING TEMPLATE -->
39 <!-- TYPE OVERVIEW -->
41 <xsl:template name="CreateTypeOverview">
42 <xsl:param name="implemented" />
43 <xsl:param name="show-members-link" />
45 <xsl:attribute name="id">
46 <xsl:text>T:</xsl:text>
47 <xsl:call-template name="GetEscapedTypeName">
48 <xsl:with-param name="typename" select="@FullName" />
50 <xsl:text>:Summary</xsl:text>
53 <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
54 <xsl:apply-templates select="Docs/summary" mode="editlink"/>
56 <xsl:if test="$implemented">
57 <p><b>Mono Implementation Note: </b></p>
59 <xsl:value-of disable-output-escaping="yes" select="$implemented"/>
63 <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 <xsl:attribute name="href">
68 <xsl:text>T</xsl:text>
69 <xsl:call-template name="GetLinkId">
70 <xsl:with-param name="type" select="." />
71 <xsl:with-param name="member" select="." />
73 <xsl:text>/*</xsl:text>
75 <xsl:value-of select="translate(@Name, '+', '.')"/>
76 <xsl:value-of select="' '" />
77 <xsl:text>Members</xsl:text>
83 Inheritance tree, but only for non-standard classes and not for interfaces
85 <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)">
87 <xsl:for-each select="Base/ParentType">
88 <xsl:sort select="@Order" order="descending"/>
89 <xsl:variable name="p" select="position()" />
90 <xsl:for-each select="parent::Base/ParentType[position() < $p]">
91 <xsl:value-of select="'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'" disable-output-escaping="yes"/>
94 <xsl:attribute name="href">
95 <xsl:call-template name="GetLinkTarget">
96 <xsl:with-param name="type" select="@Type" />
97 <xsl:with-param name="cref">
98 <xsl:text>T:</xsl:text>
99 <xsl:call-template name="GetEscapedTypeName">
100 <xsl:with-param name="typename" select="@Type" />
105 <xsl:value-of select="@Type"/>
110 <xsl:for-each select="Base/ParentType">
111 <xsl:value-of select="'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'" disable-output-escaping="yes"/>
113 <xsl:value-of select="@FullName"/>
117 <xsl:if test="Base/BaseTypeName='System.Enum'">
119 The type of the values in this enumeration is
120 <xsl:apply-templates select="Members/Member[@MemberName='value__']/ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>.
125 <xsl:template name="CreateTypeSignature">
126 <xsl:attribute name="id">
127 <xsl:text>T:</xsl:text>
128 <xsl:call-template name="GetEscapedTypeName">
129 <xsl:with-param name="typename" select="@FullName" />
131 <xsl:text>:Signature</xsl:text>
134 <xsl:call-template name="CreateSignature">
135 <xsl:with-param name="content">
137 <xsl:when test="$language='C#'">
139 <xsl:for-each select="Attributes/Attribute">
140 <xsl:text>[</xsl:text>
141 <xsl:value-of select="AttributeName"/>
142 <xsl:text>]</xsl:text>
146 <xsl:for-each select="ReturnValue/Attributes/Attribute">
147 <xsl:text>[return:</xsl:text>
148 <xsl:value-of select="AttributeName"/>
149 <xsl:text>]</xsl:text>
155 <xsl:when test="Base/BaseTypeName='System.Enum'">
156 <xsl:call-template name="getmodifiers">
157 <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
160 <xsl:text>enum </xsl:text>
162 <!-- member name, argument list -->
164 <xsl:value-of select="translate (@Name, '+', '.')"/>
168 <xsl:when test="Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.MulticastDelegate'">
171 <xsl:when test="count(Parameters) > 0 and count(ReturnValue) > 0">
172 <!-- Only recreate the delegate signature if the appropriate information
173 is present in the XML file. -->
175 <xsl:call-template name="getmodifiers">
176 <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
179 <xsl:text>delegate </xsl:text>
181 <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
184 <xsl:value-of select="' '"/>
186 <!-- member name, argument list -->
188 <xsl:call-template name="GetDefinitionName">
189 <xsl:with-param name="name" select="translate (@Name, '+', '.')" />
190 <xsl:with-param name="TypeParameters" select="TypeParameters" />
195 <xsl:value-of select="' '"/>
197 <xsl:value-of select="'('"/> <!-- prevents whitespace issues -->
199 <xsl:for-each select="Parameters/Parameter">
200 <xsl:call-template name="ShowParameter">
201 <xsl:with-param name="Param" select="."/>
202 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
205 <xsl:if test="not(position()=last())">, </xsl:if>
208 <xsl:value-of select="')'"/>
213 <xsl:apply-templates select="TypeSignature[@Language=$language]/@Value"/>
222 <xsl:call-template name="getmodifiers">
223 <xsl:with-param name="sig" select="TypeSignature[@Language='C#']/@Value"/>
224 <xsl:with-param name="typetype" select="true()"/>
227 <xsl:value-of select="' '"/>
230 <xsl:call-template name="GetDefinitionName">
231 <xsl:with-param name="name" select="translate (@Name, '+', '.')" />
232 <xsl:with-param name="TypeParameters" select="TypeParameters" />
236 <xsl:variable name="HasStandardBaseType" select="Base/BaseTypeName='System.Object' or Base/BaseTypeName='System.ValueType'"/>
237 <xsl:variable name="HasBaseType" select="count(Base/BaseTypeName)>0"/>
238 <xsl:if test="(($HasBaseType) and not($HasStandardBaseType)) or not(count(Interfaces/Interface)=0)">
239 <xsl:text> : </xsl:text>
241 <xsl:if test="$HasBaseType and not($HasStandardBaseType)">
242 <xsl:apply-templates select="Base/BaseTypeName" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
243 <xsl:if test="not(count(Interfaces/Interface)=0)">, </xsl:if>
246 <xsl:for-each select="Interfaces/Interface">
247 <xsl:if test="not(position()=1)">, </xsl:if>
248 <xsl:apply-templates select="InterfaceName" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
256 <xsl:call-template name="CreateGenericConstraints">
257 <xsl:with-param name="TypeParameters" select="TypeParameters" />
263 <xsl:apply-templates select="TypeSignature[@Language=$language]/@Value"/>
271 <xsl:template name="GetDefinitionName">
272 <xsl:param name="name" />
273 <xsl:param name="TypeParameters" />
276 <!-- do NOT process explicitly implemented generic interface members
277 unless they're actually generic methods. -->
278 <xsl:when test="contains ($name, '>') and
279 '>' = substring ($name, string-length ($name), 1)">
280 <xsl:value-of select="substring-before ($name, '<')" />
281 <xsl:text><</xsl:text>
282 <xsl:for-each select="$TypeParameters/TypeParameter">
283 <xsl:for-each select="Attributes/Attribute">
284 <xsl:text>[</xsl:text>
285 <xsl:value-of select="AttributeName"/>
286 <xsl:text>] </xsl:text>
289 <xsl:when test="@Name">
290 <xsl:value-of select="@Name" />
293 <xsl:value-of select="." />
296 <xsl:if test="not(position()=last())">, </xsl:if>
298 <xsl:text>></xsl:text>
301 <xsl:value-of select="$name" />
306 <xsl:template name="CreateGenericConstraints">
307 <xsl:param name="TypeParameters" />
309 <xsl:for-each select="$TypeParameters/TypeParameter">
310 <xsl:if test="count(Constraints/*) > 0">
311 <xsl:call-template name="CreateGenericParameterConstraints">
312 <xsl:with-param name="constraints" select="Constraints" />
318 <xsl:template name="CreateGenericParameterConstraints">
319 <xsl:param name="constraints" />
322 <xsl:text> where </xsl:text>
323 <xsl:value-of select="@Name" />
324 <xsl:text> : </xsl:text>
325 <xsl:variable name="kind"
326 select="count($constraints[ParameterAttribute='ReferenceTypeConstraint'])+
327 count($constraints[ParameterAttribute='NotNullableValueTypeConstraint'])" />
328 <xsl:variable name="base" select="count($constraints/BaseTypeName)" />
329 <xsl:variable name="iface" select="count($constraints/InterfaceName)" />
330 <xsl:variable name="struct" select="$constraints/ParameterAttribute='NotNullableValueTypeConstraint'" />
331 <xsl:if test="$constraints/ParameterAttribute='ReferenceTypeConstraint'">
332 <xsl:text>class</xsl:text>
334 <xsl:if test="$constraints/ParameterAttribute='NotNullableValueTypeConstraint'">
335 <xsl:text>struct</xsl:text>
337 <xsl:if test="$constraints/BaseTypeName and not($struct)">
338 <xsl:if test="$kind">, </xsl:if>
339 <xsl:apply-templates select="$constraints/BaseTypeName" mode="typelink" />
341 <xsl:for-each select="$constraints/InterfaceName">
342 <xsl:if test="position()=1">
343 <xsl:if test="$kind or $base">, </xsl:if>
345 <xsl:apply-templates select="." mode="typelink" />
346 <xsl:if test="not(position()=last())">, </xsl:if>
348 <xsl:if test="$constraints/ParameterAttribute='DefaultConstructorConstraint' and not($struct)">
349 <xsl:if test="$base or $iface">, </xsl:if>
350 <xsl:text>new()</xsl:text>
354 <xsl:template name="CreateMemberOverview">
355 <xsl:param name="implemented" />
358 <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
359 <xsl:apply-templates select="Docs/summary" mode="editlink"/>
362 <xsl:if test="$implemented">
363 <p><b>Mono Implementation Note: </b></p>
365 <xsl:value-of disable-output-escaping="yes" select="$implemented"/>
369 <!-- member value -->
370 <xsl:if test="MemberValue">
372 <xsl:value-of select="MemberValue"/>
378 <xsl:template name="CreateMemberSignature">
379 <xsl:param name="linkid" select="''" />
381 <xsl:call-template name="CreateSignature">
382 <xsl:with-param name="content">
383 <xsl:if test="contains(MemberSignature[@Language='C#']/@Value,'this[')">
384 <p><i>This is the default property for this class.</i></p>
387 <!-- recreate the signature -->
389 <xsl:for-each select="Attributes/Attribute[AttributeName != 'System.Runtime.CompilerServices.Extension']">
390 <xsl:text>[</xsl:text>
391 <xsl:value-of select="AttributeName"/>
392 <xsl:text>]</xsl:text>
396 <xsl:for-each select="ReturnValue/Attributes/Attribute">
397 <xsl:text>[return:</xsl:text>
398 <xsl:value-of select="AttributeName"/>
399 <xsl:text>]</xsl:text>
403 <xsl:call-template name="getmodifiers">
404 <xsl:with-param name="sig" select="MemberSignature[@Language='C#']/@Value"/>
407 <xsl:if test="MemberType = 'Event'">
408 <xsl:text>event </xsl:text>
410 <xsl:if test="ReturnValue/ReturnType=''">
411 <xsl:value-of select="substring-before(substring-after(MemberSignature[@Language='C#']/@Value, 'event '), concat(' ', @MemberName))"/>
415 <!-- return value (comes out "" where not applicable/available) -->
417 <xsl:when test="@MemberName='op_Implicit'">
418 <xsl:text>implicit operator</xsl:text>
420 <xsl:when test="@MemberName='op_Explicit'">
421 <xsl:text>explicit operator</xsl:text>
424 <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink">
425 <xsl:with-param name="wrt" select="$TypeNamespace"/>
426 </xsl:apply-templates>
431 <xsl:value-of select="' '"/>
436 <!-- Constructors get the name of the class -->
437 <xsl:when test="MemberType='Constructor'">
439 <xsl:call-template name="GetConstructorName">
440 <xsl:with-param name="type" select="../.." />
441 <xsl:with-param name="ctor" select="." />
446 <!-- Conversion operators get the return type -->
447 <xsl:when test="@MemberName='op_Implicit' or @MemberName='op_Explicit'">
448 <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink">
449 <xsl:with-param name="wrt" select="$TypeNamespace"/>
450 </xsl:apply-templates>
453 <!-- Regular operators get their symbol -->
454 <xsl:when test="@MemberName='op_UnaryPlus'">operator+</xsl:when>
455 <xsl:when test="@MemberName='op_UnaryNegation'">operator-</xsl:when>
456 <xsl:when test="@MemberName='op_LogicalNot'">operator!</xsl:when>
457 <xsl:when test="@MemberName='op_OnesComplement'">operator~</xsl:when>
458 <xsl:when test="@MemberName='op_Increment'">operator++</xsl:when>
459 <xsl:when test="@MemberName='op_Decrement'">operator--</xsl:when>
460 <xsl:when test="@MemberName='op_True'">operator true</xsl:when>
461 <xsl:when test="@MemberName='op_False'">operator false</xsl:when>
462 <xsl:when test="@MemberName='op_Addition'">operator+</xsl:when>
463 <xsl:when test="@MemberName='op_Subtraction'">operator-</xsl:when>
464 <xsl:when test="@MemberName='op_Multiply'">operator*</xsl:when>
465 <xsl:when test="@MemberName='op_Division'">operator/</xsl:when>
466 <xsl:when test="@MemberName='op_Modulus'">operator%</xsl:when>
467 <xsl:when test="@MemberName='op_BitwiseAnd'">operator&</xsl:when>
468 <xsl:when test="@MemberName='op_BitwiseOr'">operator|</xsl:when>
469 <xsl:when test="@MemberName='op_ExclusiveOr'">operator^</xsl:when>
470 <xsl:when test="@MemberName='op_LeftShift'">operator<<</xsl:when>
471 <xsl:when test="@MemberName='op_RightShift'">operator>></xsl:when>
472 <xsl:when test="@MemberName='op_Equality'">operator==</xsl:when>
473 <xsl:when test="@MemberName='op_Inequality'">operator!=</xsl:when>
474 <xsl:when test="@MemberName='op_GreaterThan'">operator></xsl:when>
475 <xsl:when test="@MemberName='op_LessThan'">operator<</xsl:when>
476 <xsl:when test="@MemberName='op_GreaterThanOrEqual'">operator>=</xsl:when>
477 <xsl:when test="@MemberName='op_LessThanOrEqual'">operator<=</xsl:when>
479 <xsl:when test="MemberType='Property' and count(Parameters/Parameter) > 0">
480 <!-- C# only permits indexer properties to have arguments -->
481 <xsl:text>this</xsl:text>
484 <!-- Everything else just gets its name -->
485 <xsl:when test="contains (@MemberName, '<')">
487 <xsl:call-template name="GetDefinitionName">
488 <xsl:with-param name="name" select="@MemberName" />
489 <xsl:with-param name="TypeParameters" select="TypeParameters" />
495 <b><xsl:value-of select="@MemberName"/></b>
500 <xsl:value-of select="' '"/>
502 <!-- argument list -->
503 <xsl:if test="MemberType='Method' or MemberType='Constructor' or (MemberType='Property' and count(Parameters/Parameter))">
504 <xsl:if test="not(MemberType='Property')">(</xsl:if>
505 <xsl:if test="MemberType='Property'">[</xsl:if>
507 <xsl:for-each select="Parameters/Parameter">
508 <xsl:call-template name="ShowParameter">
509 <xsl:with-param name="Param" select="."/>
510 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
513 <xsl:if test="not(position()=last())">, </xsl:if>
515 <xsl:if test="not(MemberType='Property')">)</xsl:if>
516 <xsl:if test="MemberType='Property'">]</xsl:if>
519 <xsl:if test="MemberType='Property'">
520 <xsl:value-of select="' '"/>
521 <xsl:text>{</xsl:text>
522 <xsl:value-of select="substring-before(substring-after(MemberSignature[@Language='C#']/@Value, '{'), '}')"/>
523 <xsl:text>}</xsl:text>
525 <xsl:call-template name="CreateGenericConstraints">
526 <xsl:with-param name="TypeParameters" select="TypeParameters" />
533 <xsl:template name="GetConstructorName">
534 <xsl:param name="type" />
535 <xsl:param name="ctor" />
538 <xsl:when test="contains($type/@Name, '<')">
539 <xsl:value-of select="translate (substring-before ($type/@Name, '<'), '+', '.')" />
542 <xsl:value-of select="translate ($type/@Name, '+', '.')" />
547 <xsl:template name="ShowParameter">
548 <xsl:param name="Param"/>
549 <xsl:param name="TypeNamespace"/>
550 <xsl:param name="prototype" select="false()"/>
552 <xsl:if test="not($prototype)">
553 <xsl:for-each select="$Param/Attributes/Attribute[not(Exclude='1') and not(AttributeName='ParamArrayAttribute' or AttributeName='System.ParamArray')]">
554 <xsl:text>[</xsl:text>
555 <xsl:value-of select="AttributeName"/>
556 <xsl:text>]</xsl:text>
557 <xsl:value-of select="' '"/>
561 <xsl:if test="count($Param/Attributes/Attribute/AttributeName[.='ParamArrayAttribute' or .='System.ParamArray'])">
563 <xsl:value-of select="' '"/>
566 <xsl:if test="$Param/@RefType">
567 <i><xsl:value-of select="$Param/@RefType"/></i>
569 <xsl:value-of select="' '"/>
572 <!-- parameter type link -->
573 <xsl:apply-templates select="$Param/@Type" mode="typelink">
574 <xsl:with-param name="wrt" select="$TypeNamespace"/>
575 </xsl:apply-templates>
577 <xsl:if test="not($prototype)">
579 <xsl:value-of select="' '"/>
581 <!-- parameter name -->
582 <xsl:value-of select="$Param/@Name"/>
586 <xsl:template name="DisplayDocsInformation">
587 <xsl:param name="linkid" />
589 <!-- The namespace that the current type belongs to. -->
590 <xsl:variable name="TypeNamespace" select="substring(@FullName, 1, string-length(@FullName) - string-length(@Name) - 1)"/>
592 <!-- alt member: not sure what these are for, actually -->
594 <xsl:if test="count(Docs/altmember)">
595 <xsl:call-template name="CreateH4Section">
596 <xsl:with-param name="name" select="'See Also'"/>
597 <xsl:with-param name="child-id" select="concat ($linkid, ':See Also')" />
598 <xsl:with-param name="content">
599 <xsl:for-each select="Docs/altmember">
600 <div><xsl:apply-templates select="@cref" mode="cref"/></div>
606 <!-- parameters & return & value -->
608 <xsl:if test="count(Docs/typeparam)">
609 <xsl:call-template name="CreateH4Section">
610 <xsl:with-param name="name" select="'Type Parameters'"/>
611 <xsl:with-param name="child-id" select="concat ($linkid, ':Type Parameters')" />
612 <xsl:with-param name="content">
614 <xsl:for-each select="Docs/typeparam">
615 <dt><i><xsl:value-of select="@name"/></i></dt>
617 <xsl:apply-templates select="." mode="notoppara"/>
618 <xsl:apply-templates select="." mode="editlink"/>
625 <xsl:if test="count(Docs/param)">
626 <xsl:call-template name="CreateH4Section">
627 <xsl:with-param name="name" select="'Parameters'"/>
628 <xsl:with-param name="child-id" select="concat ($linkid, ':Parameters')" />
629 <xsl:with-param name="content">
631 <xsl:for-each select="Docs/param">
632 <dt><i><xsl:value-of select="@name"/></i></dt>
634 <xsl:apply-templates select="." mode="notoppara"/>
635 <xsl:apply-templates select="." mode="editlink"/>
642 <xsl:if test="count(Docs/returns)">
643 <xsl:call-template name="CreateH4Section">
644 <xsl:with-param name="name" select="'Returns'"/>
645 <xsl:with-param name="child-id" select="concat ($linkid, ':Returns')" />
646 <xsl:with-param name="content">
647 <xsl:apply-templates select="Docs/returns" mode="notoppara"/>
648 <xsl:apply-templates select="Docs/returns" mode="editlink"/>
652 <xsl:if test="count(Docs/value)">
653 <xsl:call-template name="CreateH4Section">
654 <xsl:with-param name="name" select="'Value'"/>
655 <xsl:with-param name="child-id" select="concat ($linkid, ':Value')" />
656 <xsl:with-param name="content">
657 <xsl:apply-templates select="Docs/value" mode="notoppara"/>
658 <xsl:apply-templates select="Docs/value" mode="editlink"/>
663 <!-- thread safety -->
665 <xsl:if test="count(ThreadingSafetyStatement)">
666 <xsl:call-template name="CreateH4Section">
667 <xsl:with-param name="name" select="'Thread Safety'"/>
668 <xsl:with-param name="child-id" select="concat ($linkid, ':Thread Safety')" />
669 <xsl:with-param name="content">
670 <xsl:apply-templates select="ThreadingSafetyStatement" mode="notoppara"/>
678 <xsl:if test="count(Docs/permission)">
679 <xsl:call-template name="CreateH4Section">
680 <xsl:with-param name="name" select="'Permissions'"/>
681 <xsl:with-param name="child-id" select="concat ($linkid, ':Permissions')" />
682 <xsl:with-param name="content">
683 <xsl:call-template name="CreateTypeDocumentationTable">
684 <xsl:with-param name="content">
685 <xsl:for-each select="Docs/permission">
688 <xsl:apply-templates select="@cref" mode="typelink">
689 <xsl:with-param name="wrt" select="$TypeNamespace"/>
690 </xsl:apply-templates>
691 <xsl:apply-templates select="." mode="editlink"/>
694 <xsl:apply-templates select="." mode="notoppara"/>
704 <!-- method/property/constructor exceptions -->
706 <xsl:if test="count(Docs/exception)">
707 <xsl:call-template name="CreateH4Section">
708 <xsl:with-param name="name" select="'Exceptions'"/>
709 <xsl:with-param name="child-id" select="concat ($linkid, ':Exceptions')" />
710 <xsl:with-param name="content">
711 <xsl:call-template name="CreateTypeDocumentationTable">
712 <xsl:with-param name="content">
713 <xsl:for-each select="Docs/exception">
716 <xsl:apply-templates select="@cref" mode="typelink">
717 <xsl:with-param name="wrt" select="$TypeNamespace"/>
718 </xsl:apply-templates>
721 <xsl:apply-templates select="." mode="notoppara"/>
722 <xsl:apply-templates select="." mode="editlink"/>
734 <xsl:if test="count(Docs/remarks)">
735 <xsl:call-template name="CreateH4Section">
736 <xsl:with-param name="name" select="'Remarks'"/>
737 <xsl:with-param name="child-id" select="concat ($linkid, ':Remarks')" />
738 <xsl:with-param name="content">
739 <xsl:apply-templates select="Docs/remarks" mode="notoppara"/>
740 <xsl:apply-templates select="Docs/remarks" mode="editlink"/>
745 <!-- enumeration values -->
747 <xsl:if test="Base/BaseTypeName = 'System.Enum'">
748 <xsl:call-template name="CreateH4Section">
749 <xsl:with-param name="name" select="'Members'"/>
750 <xsl:with-param name="child-id" select="concat ($linkid, ':Members')" />
751 <xsl:with-param name="content">
752 <xsl:call-template name="CreateEnumerationTable">
753 <xsl:with-param name="content">
755 <xsl:for-each select="Members/Member[MemberType='Field']">
756 <xsl:if test="not(@MemberName='value__')">
757 <tr valign="top"><td>
758 <xsl:attribute name="id">
759 <xsl:text>F:</xsl:text>
760 <xsl:value-of select="translate (/Type/@FullName, '+', '.')" />
761 <xsl:text>.</xsl:text>
762 <xsl:value-of select="@MemberName" />
765 <xsl:value-of select="@MemberName"/>
769 <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
770 <xsl:apply-templates select="Docs/summary" mode="editlink"/>
783 <xsl:if test="count(Docs/example)">
784 <xsl:for-each select="Docs/example">
785 <xsl:call-template name="CreateH4Section">
786 <xsl:with-param name="name" select="'Example'"/>
787 <xsl:with-param name="child-id" select="concat ($linkid, ':Example:', position())" />
788 <xsl:with-param name="content">
789 <xsl:apply-templates select="." mode="notoppara"/>
795 <xsl:call-template name="CreateH4Section">
796 <xsl:with-param name="name" select="'Requirements'"/>
797 <xsl:with-param name="child-id" select="concat ($linkid, ':Version Information')" />
798 <xsl:with-param name="content">
799 <b>Namespace: </b><xsl:value-of select="substring(/Type/@FullName, 1, string-length(/Type/@FullName) - string-length(/Type/@Name) - 1)" />
800 <xsl:if test="count(/Type/AssemblyInfo/AssemblyName) > 0">
803 <xsl:value-of select="/Type/AssemblyInfo/AssemblyName" />
804 <xsl:text> (in </xsl:text>
805 <xsl:value-of select="/Type/AssemblyInfo/AssemblyName" />
806 <xsl:text>.dll)</xsl:text>
808 <xsl:if test="count(AssemblyInfo/AssemblyVersion) > 0">
810 <b>Assembly Versions: </b>
811 <xsl:for-each select="AssemblyInfo/AssemblyVersion">
812 <xsl:if test="not(position()=1)">, </xsl:if>
813 <xsl:value-of select="."/>
816 <xsl:if test="count(Docs/since) > 0">
819 <xsl:for-each select="Docs/since">
820 <xsl:if test="not(position()=1)">; </xsl:if>
821 <xsl:value-of select="@version"/>
824 <xsl:if test="count(Docs/since)=0 and count(/Type/Docs/since) > 0">
827 <xsl:for-each select="/Type/Docs/since">
828 <xsl:if test="not(position()=1)">; </xsl:if>
829 <xsl:value-of select="@version"/>
837 <!-- 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. -->
839 <xsl:template match="*|@*" mode="typelink">
840 <xsl:param name="wrt" select="'notset'"/>
842 <xsl:call-template name="maketypelink">
843 <xsl:with-param name="type" select="."/>
844 <xsl:with-param name="wrt" select="$wrt"/>
848 <xsl:template name="maketypelink">
849 <xsl:param name="type" select="'notset'"/>
850 <xsl:param name="wrt" select="'notset'"/>
851 <xsl:param name="nested" select="0"/>
853 <xsl:param name="btype">
854 <xsl:call-template name="ToBrackets">
855 <xsl:with-param name="s" select="$type" />
859 <xsl:variable name="array">
860 <xsl:call-template name="GetArraySuffix">
861 <xsl:with-param name="type" select="$type" />
868 <xsl:when test="starts-with($type, 'T:')">
869 <xsl:call-template name="maketypelink">
870 <xsl:with-param name="type" select="substring($type, 3)"/>
871 <xsl:with-param name="wrt" select="$wrt"/>
875 <xsl:when test="contains ($type, '&') and
876 '&' = substring ($type, string-length ($type), 1)">
877 <xsl:call-template name="maketypelink">
878 <xsl:with-param name="type" select="substring($type, 1, string-length($type)-1)"/>
879 <xsl:with-param name="wrt" select="$wrt"/>
883 <xsl:when test="$array">
884 <xsl:call-template name="maketypelink">
885 <xsl:with-param name="type" select="substring($type, 1, string-length($type) - string-length ($array))"/>
886 <xsl:with-param name="wrt" select="$wrt"/>
888 <xsl:value-of select="$array"/>
891 <xsl:when test="contains ($type, '*') and
892 '*' = substring ($type, string-length ($type), 1)">
893 <xsl:call-template name="maketypelink">
894 <xsl:with-param name="type" select="substring($type, 1, string-length($type)-1)"/>
895 <xsl:with-param name="wrt" select="$wrt"/>
897 <xsl:value-of select="'*'"/>
900 <!-- if this is a generic type parameter, don't make a link but italicize it and give it a tooltip instead -->
901 <xsl:when test="count($ThisType/TypeParameters/TypeParameter[@Name=$type] |
902 $ThisType/TypeParameters/TypeParameter[child::text()=$type] |
903 ancestor::Member/Docs/typeparam[@name=$type]) = 1">
904 <!-- 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 -->
905 <i title="{$ThisType/Docs/typeparam[@name=$type] | ancestor::Member/Docs/typeparam[@name=$type]}"><xsl:value-of select="$type"/></i>
908 <!-- if this is a generic type parameter of a base type, replace it with the type that it was instantiated with -->
909 <xsl:when test="count(ancestor::Members/BaseTypeArgument[@TypeParamName=$type]) = 1">
910 <!-- 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 -->
911 <xsl:call-template name="maketypelink">
912 <xsl:with-param name="type" select="ancestor::Members/BaseTypeArgument[@TypeParamName=$type]"/>
913 <xsl:with-param name="wrt" select="$wrt"/>
919 <xsl:variable name="escaped-type">
920 <xsl:call-template name="GetEscapedTypeName">
921 <xsl:with-param name="typename" select="$btype" />
925 <xsl:attribute name="href">
926 <xsl:call-template name="GetLinkTarget">
927 <xsl:with-param name="type" select="$escaped-type" />
928 <xsl:with-param name="cref" select="concat ('T:', $escaped-type)" />
932 <xsl:call-template name="GetTypeDisplayName">
933 <xsl:with-param name="T" select="$btype"/>
934 <xsl:with-param name="wrt" select="$wrt"/>
941 <xsl:template name="GetArraySuffix">
942 <xsl:param name="type" />
944 <xsl:if test="contains ($type, ']') and
945 ']' = substring ($type, string-length ($type), 1)">
946 <xsl:variable name="start">
947 <xsl:call-template name="GetArraySuffixStart">
948 <xsl:with-param name="type" select="$type" />
949 <xsl:with-param name="i" select="string-length ($type) - 1" />
952 <xsl:value-of select="substring ($type, $start)" />
956 <xsl:template name="GetArraySuffixStart">
957 <xsl:param name="type" />
958 <xsl:param name="i" />
961 <xsl:when test="substring ($type, $i, 1) = '['">
962 <xsl:value-of select="$i" />
965 <xsl:call-template name="GetArraySuffixStart">
966 <xsl:with-param name="type" select="$type" />
967 <xsl:with-param name="i" select="$i - 1" />
973 <xsl:template name="GetTypeDisplayName">
974 <xsl:param name="T"/>
975 <xsl:param name="wrt"/>
977 <!-- use C#-style names -->
979 <xsl:when test="$T='System.Object'">object</xsl:when>
980 <xsl:when test="$T='System.Boolean'">bool</xsl:when>
981 <xsl:when test="$T='System.Byte'">byte</xsl:when>
982 <xsl:when test="$T='System.Char'">char</xsl:when>
983 <xsl:when test="$T='System.Decimal'">decimal</xsl:when>
984 <xsl:when test="$T='System.Double'">double</xsl:when>
985 <xsl:when test="$T='System.Int16'">short</xsl:when>
986 <xsl:when test="$T='System.Int32'">int</xsl:when>
987 <xsl:when test="$T='System.Int64'">long</xsl:when>
988 <xsl:when test="$T='System.SByte'">sbyte</xsl:when>
989 <xsl:when test="$T='System.Single'">float</xsl:when>
990 <xsl:when test="$T='System.String'">string</xsl:when>
991 <xsl:when test="$T='System.UInt16'">ushort</xsl:when>
992 <xsl:when test="$T='System.UInt32'">uint</xsl:when>
993 <xsl:when test="$T='System.UInt64'">ulong</xsl:when>
994 <xsl:when test="$T='System.Void'">void</xsl:when>
996 <xsl:when test="contains($T, '<')">
997 <xsl:call-template name="GetTypeDisplayName">
998 <xsl:with-param name="T" select="substring-before ($T, '<')" />
999 <xsl:with-param name="wrt" select="$wrt" />
1000 </xsl:call-template>
1001 <xsl:text><</xsl:text>
1002 <xsl:call-template name="GetMemberArgList">
1003 <xsl:with-param name="arglist" select="substring-after ($T, '<')" />
1004 <xsl:with-param name="wrt" select="$wrt" />
1005 </xsl:call-template>
1006 <!-- don't need to append > as GetMemberArgList (eventually) appends it -->
1009 <!-- if the type is in the wrt namespace, omit the namespace name -->
1010 <xsl:when test="not($wrt='') and starts-with($T, concat($wrt,'.')) and not(contains(substring-after($T,concat($wrt,'.')), '.'))">
1011 <xsl:value-of select="translate (substring-after($T,concat($wrt,'.')), '+', '.')"/>
1014 <!-- if the type is in the System namespace, omit the namespace name -->
1015 <xsl:when test="starts-with($T, 'System.') and not(contains(substring-after($T, 'System.'), '.'))">
1016 <xsl:value-of select="translate (substring-after($T,'System.'), '+', '.')"/>
1019 <!-- if the type is in the System.Collections namespace, omit the namespace name -->
1020 <xsl:when test="starts-with($T, 'System.Collections.') and not(contains(substring-after($T, 'System.Collections.'), '.'))">
1021 <xsl:value-of select="translate (substring-after($T,'System.Collections.'), '+', '.')"/>
1024 <!-- if the type is in the System.Collections.Generic namespace, omit the namespace name -->
1025 <xsl:when test="starts-with($T, 'System.Collections.Generic.') and not(contains(substring-after($T, 'System.Collections.Generic.'), '.'))">
1026 <xsl:value-of select="translate (substring-after($T,'System.Collections.Generic.'), '+', '.')"/>
1030 <xsl:value-of select="translate ($T, '+', '.')" />
1035 <xsl:template name="GetMemberDisplayName">
1036 <xsl:param name="memberName" />
1037 <xsl:param name="isproperty" select="false()" />
1040 <xsl:when test="contains($memberName, '.')">
1041 <xsl:call-template name="GetTypeDisplayName">
1042 <xsl:with-param name="T">
1043 <xsl:call-template name="GetTypeName">
1044 <xsl:with-param name="type" select="$memberName"/>
1045 </xsl:call-template>
1047 <xsl:with-param name="wrt" select="''" />
1048 </xsl:call-template>
1049 <xsl:text>.</xsl:text>
1050 <xsl:call-template name="GetMemberName">
1051 <xsl:with-param name="type" select="$memberName" />
1052 <xsl:with-param name="isproperty" select="$isproperty"/>
1053 </xsl:call-template>
1056 <xsl:value-of select="$memberName" />
1061 <xsl:template name="ToBrackets">
1062 <xsl:param name="s" />
1063 <xsl:value-of select="translate (translate ($s, '{', '<'), '}', '>')" />
1066 <xsl:template name="ToBraces">
1067 <xsl:param name="s" />
1068 <xsl:value-of select="translate (translate ($s, '<', '{'), '>', '}')" />
1071 <xsl:template name="memberlinkprefix">
1072 <xsl:param name="member" />
1074 <xsl:when test="$member/MemberType='Constructor'">C</xsl:when>
1075 <xsl:when test="$member/MemberType='Method'">M</xsl:when>
1076 <xsl:when test="$member/MemberType='Property'">P</xsl:when>
1077 <xsl:when test="$member/MemberType='Field'">F</xsl:when>
1078 <xsl:when test="$member/MemberType='Event'">E</xsl:when>
1082 <xsl:template name="makememberlink">
1083 <xsl:param name="cref"/>
1085 <xsl:variable name="bcref">
1086 <xsl:call-template name="ToBrackets">
1087 <xsl:with-param name="s" select="$cref" />
1088 </xsl:call-template>
1091 <xsl:variable name="fullname">
1093 <xsl:when test="starts-with($bcref, 'C:') or starts-with($bcref, 'T:')">
1095 <xsl:when test="contains($bcref, '(')">
1096 <xsl:value-of select="substring (substring-before ($bcref, '('), 3)" />
1099 <xsl:value-of select="substring($bcref, 3)" />
1104 <xsl:call-template name="GetTypeName">
1105 <xsl:with-param name="type" select="substring($bcref, 3)"/>
1106 </xsl:call-template>
1111 <xsl:variable name="memberName">
1113 <xsl:when test="starts-with($bcref, 'T:')" />
1114 <xsl:when test="starts-with($bcref, 'C:') and not(contains($bcref, '('))" />
1115 <xsl:when test="starts-with($bcref, 'C:') and contains($bcref, '(')">
1116 <xsl:text>(</xsl:text>
1117 <xsl:call-template name="GetMemberArgList">
1118 <xsl:with-param name="arglist" select="substring-before(substring-after($bcref, '('), ')')" />
1119 <xsl:with-param name="wrt" select="$TypeNamespace" />
1120 </xsl:call-template>
1121 <xsl:text>)</xsl:text>
1124 <xsl:text>.</xsl:text>
1125 <xsl:call-template name="GetMemberName">
1126 <xsl:with-param name="type" select="substring($bcref, 3)" />
1127 <xsl:with-param name="wrt" select="$fullname"/>
1128 <xsl:with-param name="isproperty" select="starts-with($bcref, 'P:')"/>
1129 </xsl:call-template>
1134 <xsl:variable name="escaped-type">
1135 <xsl:call-template name="GetEscapedTypeName">
1136 <xsl:with-param name="typename">
1137 <xsl:call-template name="ToBrackets">
1138 <xsl:with-param name="s" select="$fullname" />
1139 </xsl:call-template>
1141 </xsl:call-template>
1143 <xsl:variable name="displayname">
1144 <xsl:call-template name="GetTypeDisplayName">
1145 <xsl:with-param name="T" select="$fullname" />
1146 <xsl:with-param name="wrt" select="$TypeNamespace"/>
1147 </xsl:call-template>
1150 <xsl:attribute name="href">
1151 <xsl:call-template name="GetLinkTarget">
1152 <xsl:with-param name="type" select="$escaped-type" />
1153 <xsl:with-param name="cref">
1154 <xsl:call-template name="ToBraces">
1155 <xsl:with-param name="s" select="$cref" />
1156 </xsl:call-template>
1158 </xsl:call-template>
1160 <xsl:value-of select="translate (concat($displayname, $memberName), '+', '.')" />
1164 <xsl:template name="GetTypeName">
1165 <xsl:param name="type" />
1166 <xsl:variable name="prefix" select="substring-before($type, '.')" />
1167 <xsl:variable name="suffix" select="substring-after($type, '.')" />
1169 <xsl:when test="contains($type, '(')">
1170 <xsl:call-template name="GetTypeName">
1171 <xsl:with-param name="type" select="substring-before($type, '(')" />
1172 </xsl:call-template>
1174 <xsl:when test="not(contains($suffix, '.'))">
1175 <xsl:value-of select="$prefix" />
1178 <xsl:value-of select="$prefix" />
1179 <xsl:text>.</xsl:text>
1180 <xsl:call-template name="GetTypeName">
1181 <xsl:with-param name="type" select="$suffix" />
1182 </xsl:call-template>
1187 <xsl:template name="GetMemberName">
1188 <xsl:param name="type" />
1189 <xsl:param name="isproperty" select="0"/>
1190 <xsl:variable name="prefix" select="substring-before($type, '.')" />
1191 <xsl:variable name="suffix" select="substring-after($type, '.')" />
1193 <xsl:when test="contains($type, '(')">
1194 <xsl:call-template name="GetMemberName">
1195 <xsl:with-param name="type" select="substring-before($type, '(')" />
1196 </xsl:call-template>
1197 <xsl:text>(</xsl:text>
1198 <xsl:call-template name="GetMemberArgList">
1199 <xsl:with-param name="arglist" select="substring-before(substring-after($type, '('), ')')" />
1200 <xsl:with-param name="wrt" select="$TypeNamespace" />
1201 </xsl:call-template>
1202 <xsl:text>)</xsl:text>
1204 <xsl:when test="not(contains($suffix, '.'))">
1205 <xsl:value-of select="$suffix" />
1208 <xsl:call-template name="GetMemberName">
1209 <xsl:with-param name="type" select="$suffix" />
1210 </xsl:call-template>
1215 <xsl:template name="GetMemberArgList">
1216 <xsl:param name="arglist" />
1217 <xsl:param name="wrt" select="''"/>
1219 <xsl:variable name="_arglist">
1221 <xsl:when test="starts-with ($arglist, ',')">
1222 <xsl:value-of select="substring-after ($arglist, ',')" />
1225 <xsl:value-of select="$arglist" />
1230 <xsl:if test="starts-with ($arglist, ',')">
1231 <xsl:text>, </xsl:text>
1234 <xsl:variable name="c" select="substring-before ($_arglist, ',')" />
1235 <xsl:variable name="lt" select="substring-before ($_arglist, '<')" />
1236 <xsl:variable name="gt" select="substring-before ($_arglist, '>')" />
1239 <!-- Need to insert ',' between type arguments -->
1241 ($c != '' and $lt != '' and $gt != '' and
1242 string-length ($c) < string-length ($lt) and
1243 string-length ($c) < string-length ($gt)) or
1244 ($c != '' and $lt != '' and $gt = '' and
1245 string-length ($c) < string-length ($lt)) or
1246 ($c != '' and $lt = '' and $gt != '' and
1247 string-length ($c) < string-length ($gt)) or
1248 ($c != '' and $lt = '' and $gt = '')">
1249 <xsl:call-template name="GetTypeDisplayName">
1250 <xsl:with-param name="T" select="$c"/>
1251 <xsl:with-param name="wrt" select="$wrt"/>
1252 </xsl:call-template>
1253 <xsl:text>, </xsl:text>
1254 <xsl:call-template name="GetMemberArgList">
1255 <xsl:with-param name="arglist" select="substring-after($_arglist, ',')" />
1256 <xsl:with-param name="wrt" select="$wrt" />
1257 </xsl:call-template>
1260 <!-- start of nested type argument list < -->
1262 ($c != '' and $lt != '' and $gt != '' and
1263 string-length ($lt) < string-length ($c) and
1264 string-length ($lt) < string-length ($gt)) or
1265 ($c != '' and $lt != '' and $gt = '' and
1266 string-length ($lt) < string-length ($c)) or
1267 ($c = '' and $lt != '' and $gt != '' and
1268 string-length ($lt) < string-length ($gt))">
1269 <xsl:call-template name="GetTypeDisplayName">
1270 <xsl:with-param name="T" select="$lt"/>
1271 <xsl:with-param name="wrt" select="$wrt"/>
1272 </xsl:call-template>
1273 <xsl:text><</xsl:text>
1274 <xsl:call-template name="GetMemberArgList">
1275 <xsl:with-param name="arglist" select="substring-after($_arglist, '<')" />
1276 <xsl:with-param name="wrt" select="$wrt" />
1277 </xsl:call-template>
1280 <!-- end of (nested?) type argument list > -->
1282 ($c != '' and $lt != '' and $gt != '' and
1283 string-length ($gt) < string-length ($c) and
1284 string-length ($gt) < string-length ($lt)) or
1285 ($c != '' and $lt = '' and $gt = '' and
1286 string-length ($gt) < string-length ($c)) or
1287 ($c = '' and $lt != '' and $gt != '' and
1288 string-length ($gt) < string-length ($lt)) or
1289 ($c = '' and $lt = '' and $gt != '')">
1290 <xsl:call-template name="GetTypeDisplayName">
1291 <xsl:with-param name="T" select="$gt"/>
1292 <xsl:with-param name="wrt" select="$wrt"/>
1293 </xsl:call-template>
1294 <xsl:text>></xsl:text>
1295 <xsl:call-template name="GetMemberArgList">
1296 <xsl:with-param name="arglist" select="substring-after($_arglist, '>')" />
1297 <xsl:with-param name="wrt" select="$wrt" />
1298 </xsl:call-template>
1301 <!-- nothing left to do -->
1303 <xsl:call-template name="GetTypeDisplayName">
1304 <xsl:with-param name="T" select="$_arglist"/>
1305 <xsl:with-param name="wrt" select="$wrt"/>
1306 </xsl:call-template>
1311 <!-- Transforms the contents of the selected node containing a cref into a hyperlink. -->
1312 <xsl:template match="*|@*" mode="cref">
1313 <xsl:call-template name="makememberlink">
1314 <xsl:with-param name="cref" select="."/>
1315 </xsl:call-template>
1318 <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
1319 <xsl:value-of select="substring-after(., ':')"/></a>
1323 <xsl:template name="membertypeplural">
1324 <xsl:param name="name"/>
1326 <xsl:when test="$name='ExtensionMethod'">Extension Methods</xsl:when>
1327 <xsl:when test="$name='Constructor'">Constructors</xsl:when>
1328 <xsl:when test="$name='Property'">Properties</xsl:when>
1329 <xsl:when test="$name='Method'">Methods</xsl:when>
1330 <xsl:when test="$name='Field'">Fields</xsl:when>
1331 <xsl:when test="$name='Event'">Events</xsl:when>
1332 <xsl:when test="$name='Operator'">Operators</xsl:when>
1333 <xsl:when test="$name='Explicit'">Explicitly Implemented Interface Members</xsl:when>
1336 <xsl:template name="membertypeplurallc">
1337 <xsl:param name="name"/>
1339 <xsl:when test="$name='ExtensionMethod'">extension methods</xsl:when>
1340 <xsl:when test="$name='Constructor'">constructors</xsl:when>
1341 <xsl:when test="$name='Property'">properties</xsl:when>
1342 <xsl:when test="$name='Method'">methods</xsl:when>
1343 <xsl:when test="$name='Field'">fields</xsl:when>
1344 <xsl:when test="$name='Event'">events</xsl:when>
1345 <xsl:when test="$name='Operator'">operators</xsl:when>
1346 <xsl:when test="$name='Explicit'">explicitly implemented interface members</xsl:when>
1349 <xsl:template name="gettypetype">
1350 <xsl:variable name="sig" select="concat(' ', TypeSignature[@Language='C#']/@Value, ' ')"/>
1352 <xsl:when test="contains($sig,'class')">Class</xsl:when>
1353 <xsl:when test="contains($sig,'enum')">Enumeration</xsl:when>
1354 <xsl:when test="contains($sig,'struct')">Structure</xsl:when>
1355 <xsl:when test="contains($sig,'delegate')">Delegate</xsl:when>
1359 <!-- Ensures that the resuting node is not surrounded by a para tag. -->
1360 <xsl:template match="*|@*" mode="editlink">
1361 <xsl:call-template name="CreateEditLink">
1362 <xsl:with-param name="e" select="." />
1363 </xsl:call-template>
1366 <xsl:template match="*" mode="notoppara">
1368 <xsl:when test="starts-with (string(.), 'To be added')">
1369 <span class="NotEntered">Documentation for this section has not yet been entered.</span>
1371 <xsl:when test="count(*) = 1 and count(para)=1">
1372 <xsl:apply-templates select="para/node()"/>
1375 <xsl:apply-templates select="."/>
1380 <xsl:template match="para">
1382 <xsl:apply-templates/>
1386 <xsl:template match="paramref">
1387 <i><xsl:value-of select="@name"/>
1388 <xsl:apply-templates/>
1392 <xsl:template match="typeparamref">
1393 <i><xsl:value-of select="@name"/>
1394 <xsl:apply-templates/>
1398 <xsl:template match="block[@type='note']">
1401 <xsl:apply-templates/>
1404 <xsl:template match="block[@type='behaviors']">
1405 <h5 class="Subsection">Operation</h5>
1406 <xsl:apply-templates/>
1408 <xsl:template match="block[@type='overrides']">
1409 <h5 class="Subsection">Note to Inheritors</h5>
1410 <xsl:apply-templates/>
1412 <xsl:template match="block[@type='usage']">
1413 <h5 class="Subsection">Usage</h5>
1414 <xsl:apply-templates/>
1417 <xsl:template match="c">
1419 <xsl:apply-templates/>
1422 <xsl:template match="c//para">
1423 <xsl:apply-templates/><br/>
1426 <xsl:template match="code">
1427 <xsl:call-template name="CreateCodeBlock">
1428 <xsl:with-param name="language" select="@lang" />
1429 <xsl:with-param name="content" select="string(descendant-or-self::text())" />
1430 </xsl:call-template>
1433 <xsl:template match="onequarter">
1436 <xsl:template match="pi">pi</xsl:template>
1437 <xsl:template match="theta">theta</xsl:template>
1438 <xsl:template match="subscript">
1439 <sub><xsl:value-of select="@term"/></sub>
1441 <xsl:template match="superscript">
1442 <sup><xsl:value-of select="@term"/></sup>
1450 <term>First Col Header</term>
1451 <description>Second Col Header</description>
1452 <description>Third Col Header</description>
1455 <term>First Row First Col</term>
1456 <description>First Row Second Col</description>
1457 <description>First Row Third Col</description>
1460 <term>Second Row First Col</term>
1461 <description>Second Row Second Col</description>
1462 <description>Second Row Third Col</description>
1467 <xsl:template match="list[@type='table']">
1468 <xsl:call-template name="CreateListTable">
1469 <xsl:with-param name="header">
1470 <th><xsl:apply-templates select="listheader/term" mode="notoppara"/></th>
1471 <xsl:for-each select="listheader/description">
1472 <th><xsl:apply-templates mode="notoppara"/></th>
1476 <xsl:with-param name="content">
1477 <xsl:for-each select="item">
1480 <xsl:apply-templates select="term" mode="notoppara"/>
1482 <xsl:for-each select="description">
1484 <xsl:apply-templates mode="notoppara"/>
1490 </xsl:call-template>
1493 <xsl:template match="list[@type='bullet']">
1495 <xsl:for-each select="item">
1497 <xsl:apply-templates select="term" mode="notoppara"/>
1502 <xsl:template match="list[@type='number']">
1504 <xsl:for-each select="item">
1506 <xsl:apply-templates select="term" mode="notoppara"/>
1512 <xsl:template match="list">
1513 [<i>The '<xsl:value-of select="@type"/>' type of list has not been implemented in the ECMA stylesheet.</i>]
1516 [<i>The '<xsl:value-of select="@type"/>' type of list has not been implemented in the ECMA stylesheet.</i>]
1520 <xsl:template match="see[@cref]">
1522 <xsl:when test="not(substring-after(@cref, 'T:')='')">
1523 <xsl:call-template name="maketypelink">
1524 <xsl:with-param name="type" select="normalize-space (@cref)"/>
1525 </xsl:call-template>
1528 <xsl:call-template name="makememberlink">
1529 <xsl:with-param name="cref" select="normalize-space (@cref)"/>
1530 </xsl:call-template>
1535 <xsl:template match="see[@langword]">
1536 <tt><xsl:value-of select="@langword"/></tt>
1539 <xsl:template name="GetInheritedMembers">
1540 <xsl:param name="declaringtype"/>
1541 <xsl:param name="generictypereplacements"/>
1542 <xsl:param name="listmembertype"/>
1543 <xsl:param name="showprotected"/>
1544 <xsl:param name="overloads-mode" select="false()" />
1545 <xsl:param name="showstatic" select='1'/>
1548 <xsl:when test="$listmembertype='ExtensionMethod' and $showprotected=false()">
1549 <xsl:for-each select="$declaringtype/Members/Member[MemberType=$listmembertype]">
1550 <Members Name="Link/@Type" FullName="Link/@Type">
1551 <Member MemberName="{@MemberName}">
1552 <xsl:attribute name="ExplicitMemberName">
1553 <xsl:call-template name="GetMemberNameWithoutGenericTypes">
1554 <xsl:with-param name="m" select="@MemberName" />
1555 </xsl:call-template>
1557 <xsl:attribute name="TypeParameters">
1558 <xsl:call-template name="GetTypeParameterNames">
1559 <xsl:with-param name="member" select="." />
1560 </xsl:call-template>
1562 <xsl:attribute name="Parameters">
1563 <xsl:call-template name="GetParameterTypes">
1564 <xsl:with-param name="member" select="." />
1565 </xsl:call-template>
1567 <xsl:copy-of select="./*" />
1573 <Members Name="{$declaringtype/@Name}" FullName="{$declaringtype/@FullName}">
1575 <xsl:copy-of select="$generictypereplacements"/>
1577 <!-- Get all members in this type that are of listmembertype and are either
1578 protected or not protected according to showprotected. -->
1580 <xsl:when test="$listmembertype = 'Explicit'">
1581 <xsl:for-each select="$declaringtype/Members/Member
1582 [MemberType != 'Constructor']
1583 [contains (@MemberName, '.')]">
1584 <Member MemberName="{@MemberName}">
1585 <xsl:attribute name="ExplicitMemberName">
1586 <xsl:call-template name="GetMemberName">
1587 <xsl:with-param name="type" select="@MemberName" />
1588 <xsl:with-param name="isproperty" select="$listmembertype = 'Property'"/>
1589 </xsl:call-template>
1591 <xsl:attribute name="TypeParameters">
1592 <xsl:call-template name="GetTypeParameterNames">
1593 <xsl:with-param name="member" select="." />
1594 </xsl:call-template>
1596 <xsl:attribute name="Parameters">
1597 <xsl:call-template name="GetParameterTypes">
1598 <xsl:with-param name="member" select="." />
1599 </xsl:call-template>
1601 <xsl:copy-of select="./*" />
1606 <xsl:for-each select="$declaringtype/Members/Member
1607 [(MemberType=$listmembertype or ($listmembertype='Operator' and MemberType='Method'))]
1608 [(not($overloads-mode) or @MemberName=$index or
1609 ($index='Conversion' and (@MemberName='op_Implicit' or @MemberName='op_Explicit'))) ]
1610 [$showprotected=starts-with(MemberSignature[@Language='C#']/@Value, 'protected ')]
1611 [($listmembertype='Method' and not(starts-with(@MemberName,'op_')))
1612 or ($listmembertype='Operator' and starts-with(@MemberName,'op_'))
1613 or (not($listmembertype='Method') and not($listmembertype='Operator'))]
1614 [$showstatic or not(contains(MemberSignature[@Language='C#']/@Value,' static '))]
1615 [$listmembertype = 'Constructor' or not(contains(@MemberName, '.'))]
1617 <Member MemberName="{@MemberName}">
1618 <xsl:attribute name="ExplicitMemberName">
1619 <xsl:call-template name="GetMemberNameWithoutGenericTypes">
1620 <xsl:with-param name="m" select="@MemberName" />
1621 </xsl:call-template>
1623 <xsl:attribute name="TypeParameters">
1624 <xsl:call-template name="GetTypeParameterNames">
1625 <xsl:with-param name="member" select="." />
1626 </xsl:call-template>
1628 <xsl:attribute name="Parameters">
1629 <xsl:call-template name="GetParameterTypes">
1630 <xsl:with-param name="member" select="." />
1631 </xsl:call-template>
1633 <xsl:copy-of select="./*" />
1640 <xsl:copy-of select="$declaringtype/Docs/typeparam" />
1647 <xsl:if test="not($listmembertype='Constructor') and count($declaringtype/Base/BaseTypeName)=1">
1648 <xsl:variable name="basedocsfile">
1649 <xsl:call-template name="GetLinkTarget">
1650 <xsl:with-param name="type">
1651 <xsl:call-template name="GetEscapedTypeName">
1652 <xsl:with-param name="typename" select="$declaringtype/Base/BaseTypeName" />
1653 </xsl:call-template>
1655 <xsl:with-param name="cref">
1657 <xsl:with-param name="local-suffix" />
1658 <xsl:with-param name="remote"/>
1659 <xsl:with-param name="xmltarget" select='1'/>
1660 </xsl:call-template>
1663 <xsl:if test="not($basedocsfile='--not-available--')">
1664 <xsl:call-template name="GetInheritedMembers">
1665 <xsl:with-param name="listmembertype" select="$listmembertype"/>
1666 <xsl:with-param name="showprotected" select="$showprotected"/>
1667 <xsl:with-param name="declaringtype" select="document($basedocsfile,.)/Type"/>
1668 <xsl:with-param name="generictypereplacements" select="$declaringtype/Base/BaseTypeArguments/*"/>
1669 <xsl:with-param name="showstatic" select='0'/>
1670 </xsl:call-template>
1675 <xsl:template name="GetMemberNameWithoutGenericTypes">
1676 <xsl:param name="m" />
1678 <xsl:when test="contains ($m, '<')">
1679 <xsl:value-of select="substring-before ($m, '<')" />
1682 <xsl:value-of select="$m" />
1687 <xsl:template name="GetTypeParameterNames">
1688 <xsl:param name="member" />
1690 <xsl:for-each select="$member/TypeParameters/TypeParameter">
1691 <xsl:if test="not(position()=1)">, </xsl:if>
1692 <xsl:value-of select="@Name" />
1696 <xsl:template name="GetParameterTypes">
1697 <xsl:param name="member" />
1699 <xsl:for-each select="$member/Parameters/Parameter">
1700 <xsl:if test="not(position()=1)">, </xsl:if>
1701 <xsl:value-of select="@Type" />
1705 <xsl:template name="ListAllMembers">
1706 <xsl:param name="html-anchor" select="false()" />
1708 <xsl:call-template name="ListMembers">
1709 <xsl:with-param name="listmembertype" select="'Constructor'"/>
1710 <xsl:with-param name="showprotected" select="false()"/>
1711 <xsl:with-param name="html-anchor" select="$html-anchor" />
1712 </xsl:call-template>
1714 <xsl:call-template name="ListMembers">
1715 <xsl:with-param name="listmembertype" select="'Constructor'"/>
1716 <xsl:with-param name="showprotected" select="true()"/>
1717 <xsl:with-param name="html-anchor" select="$html-anchor" />
1718 </xsl:call-template>
1720 <xsl:call-template name="ListMembers">
1721 <xsl:with-param name="listmembertype" select="'Field'"/>
1722 <xsl:with-param name="showprotected" select="false()"/>
1723 <xsl:with-param name="html-anchor" select="$html-anchor" />
1724 </xsl:call-template>
1726 <xsl:call-template name="ListMembers">
1727 <xsl:with-param name="listmembertype" select="'Field'"/>
1728 <xsl:with-param name="showprotected" select="true()"/>
1729 <xsl:with-param name="html-anchor" select="$html-anchor" />
1730 </xsl:call-template>
1732 <xsl:call-template name="ListMembers">
1733 <xsl:with-param name="listmembertype" select="'Property'"/>
1734 <xsl:with-param name="showprotected" select="false()"/>
1735 <xsl:with-param name="html-anchor" select="$html-anchor" />
1736 </xsl:call-template>
1738 <xsl:call-template name="ListMembers">
1739 <xsl:with-param name="listmembertype" select="'Property'"/>
1740 <xsl:with-param name="showprotected" select="true()"/>
1741 <xsl:with-param name="html-anchor" select="$html-anchor" />
1742 </xsl:call-template>
1744 <xsl:call-template name="ListMembers">
1745 <xsl:with-param name="listmembertype" select="'Method'"/>
1746 <xsl:with-param name="showprotected" select="false()"/>
1747 <xsl:with-param name="html-anchor" select="$html-anchor" />
1748 </xsl:call-template>
1750 <xsl:call-template name="ListMembers">
1751 <xsl:with-param name="listmembertype" select="'Method'"/>
1752 <xsl:with-param name="showprotected" select="true()"/>
1753 <xsl:with-param name="html-anchor" select="$html-anchor" />
1754 </xsl:call-template>
1756 <xsl:call-template name="ListMembers">
1757 <xsl:with-param name="listmembertype" select="'Event'"/>
1758 <xsl:with-param name="showprotected" select="false()"/>
1759 <xsl:with-param name="html-anchor" select="$html-anchor" />
1760 </xsl:call-template>
1762 <xsl:call-template name="ListMembers">
1763 <xsl:with-param name="listmembertype" select="'Event'"/>
1764 <xsl:with-param name="showprotected" select="true()"/>
1765 <xsl:with-param name="html-anchor" select="$html-anchor" />
1766 </xsl:call-template>
1768 <xsl:call-template name="ListMembers">
1769 <xsl:with-param name="listmembertype" select="'Operator'"/>
1770 <xsl:with-param name="showprotected" select="false()"/>
1771 <xsl:with-param name="html-anchor" select="$html-anchor" />
1772 </xsl:call-template>
1774 <xsl:call-template name="ListMembers">
1775 <xsl:with-param name="listmembertype" select="'Explicit'"/>
1776 <xsl:with-param name="showprotected" select="true()"/>
1777 <xsl:with-param name="html-anchor" select="$html-anchor" />
1778 </xsl:call-template>
1780 <xsl:call-template name="ListMembers">
1781 <xsl:with-param name="listmembertype" select="'ExtensionMethod'"/>
1782 <xsl:with-param name="showprotected" select="false()"/>
1783 <xsl:with-param name="html-anchor" select="$html-anchor" />
1784 </xsl:call-template>
1787 <!-- Lists the members in the current Type node.
1788 Only lists members of type listmembertype.
1789 Displays the signature in siglanguage.
1790 showprotected = true() or false()
1792 <xsl:template name="ListMembers">
1793 <xsl:param name="listmembertype"/>
1794 <xsl:param name="showprotected"/>
1795 <xsl:param name="overloads-mode" select="false()" />
1796 <xsl:param name="html-anchor" select="false()" />
1798 <!-- get name and namespace of current type -->
1799 <xsl:variable name="TypeFullName" select="@FullName"/>
1800 <xsl:variable name="TypeName" select="@Name"/>
1801 <xsl:variable name="TypeNamespace" select="substring-before(@FullName, concat('.',@Name))"/>
1803 <xsl:variable name="MEMBERS">
1804 <xsl:call-template name="GetInheritedMembers">
1805 <xsl:with-param name="listmembertype" select="$listmembertype"/>
1806 <xsl:with-param name="showprotected" select="$showprotected"/>
1807 <xsl:with-param name="declaringtype" select="."/>
1808 <xsl:with-param name="overloads-mode" select="$overloads-mode" />
1809 </xsl:call-template>
1813 <xsl:variable name="MEMBERS" select="
1815 [(MemberType=$listmembertype or ($listmembertype='Operator' and MemberType='Method'))]
1816 [$showprotected=contains(MemberSignature[@Language='C#']/@Value,'protected')]
1817 [($listmembertype='Method' and not(starts-with(@MemberName,'op_')))
1818 or ($listmembertype='Operator' and starts-with(@MemberName,'op_'))
1819 or (not($listmembertype='Method') and not($listmembertype='Operator'))]
1823 <!-- if there aren't any, skip this -->
1824 <xsl:if test="count($MEMBERS/Member)">
1826 <xsl:variable name="SectionName">
1827 <xsl:if test="$listmembertype != 'Explicit' and $listmembertype != 'ExtensionMethod'">
1828 <xsl:if test="$showprotected">Protected </xsl:if>
1829 <xsl:if test="not($showprotected)">Public </xsl:if>
1831 <xsl:call-template name="membertypeplural"><xsl:with-param name="name" select="$listmembertype"/></xsl:call-template>
1835 <xsl:call-template name="CreateH3Section">
1836 <xsl:with-param name="name" select="$SectionName" />
1837 <xsl:with-param name="child-id" select="$SectionName" />
1838 <xsl:with-param name="content">
1839 <div class="SubsectionBox">
1840 <xsl:call-template name="CreateMembersTable">
1841 <xsl:with-param name="content">
1843 <xsl:for-each select="$MEMBERS/Member">
1844 <!--<xsl:sort select="contains(MemberSignature[@Language='C#']/@Value,' static ')" data-type="text"/>-->
1845 <xsl:sort select="@MemberName = 'op_Implicit' or @MemberName = 'op_Explicit'"/>
1846 <xsl:sort select="@ExplicitMemberName" data-type="text"/>
1847 <xsl:sort select="count(TypeParameters/TypeParameter)"/>
1848 <xsl:sort select="@TypeParameters"/>
1849 <xsl:sort select="count(Parameters/Parameter)"/>
1850 <xsl:sort select="@Parameters"/>
1852 <xsl:variable name="local-id">
1854 <xsl:when test="count(Link) = 1">
1855 <xsl:value-of select="Link/@Member" />
1858 <xsl:call-template name="GetLinkId" >
1859 <xsl:with-param name="type" select="parent::Members" />
1860 <xsl:with-param name="member" select="." />
1861 </xsl:call-template>
1866 <xsl:variable name="linkid">
1867 <xsl:if test="not(parent::Members/@FullName = $TypeFullName)">
1868 <xsl:call-template name="GetLinkTarget">
1869 <xsl:with-param name="type">
1871 <xsl:when test="count(Link) = 1">
1872 <xsl:value-of select="Link/@Type"/>
1875 <xsl:call-template name="GetEscapedTypeName">
1876 <xsl:with-param name="typename" select="parent::Members/@FullName" />
1877 </xsl:call-template>
1881 <xsl:with-param name="cref" />
1882 </xsl:call-template>
1884 <xsl:if test="$html-anchor">
1885 <xsl:text>#</xsl:text>
1887 <xsl:value-of select="$local-id" />
1890 <xsl:variable name="isinherited">
1891 <xsl:if test="$listmembertype != 'ExtensionMethod' and not(parent::Members/@FullName = $TypeFullName)">
1892 <xsl:text> (</xsl:text>
1894 <xsl:text>Inherited from </xsl:text>
1895 <xsl:call-template name="maketypelink">
1896 <xsl:with-param name="type" select="parent::Members/@FullName"/>
1897 <xsl:with-param name="wrt" select="$TypeNamespace"/>
1898 </xsl:call-template>
1899 <xsl:text>.</xsl:text>
1901 <xsl:text>)</xsl:text>
1907 <!-- random info -->
1909 <!-- check if it has get and set accessors -->
1910 <xsl:if test="MemberType='Property' and not(contains(MemberSignature[@Language='C#']/@Value, 'set;'))">
1911 <xsl:text>[read-only]</xsl:text>
1913 <xsl:if test="MemberType='Property' and not(contains(MemberSignature[@Language='C#']/@Value, 'get;'))">
1914 <xsl:text>[write-only]</xsl:text>
1917 <xsl:if test="contains(MemberSignature[@Language='C#']/@Value,'this[')">
1918 <div><i>default property</i></div>
1922 <xsl:call-template name="getmodifiers">
1923 <xsl:with-param name="sig" select="MemberSignature[@Language='C#']/@Value"/>
1924 <xsl:with-param name="protection" select="false()"/>
1925 <xsl:with-param name="inheritance" select="true()"/>
1926 <xsl:with-param name="extra" select="false()"/>
1927 </xsl:call-template>
1932 <!-- constructor listing -->
1933 <xsl:when test="MemberType='Constructor'">
1934 <!-- link to constructor page -->
1938 <a href="{$linkid}">
1939 <xsl:call-template name="GetConstructorName">
1940 <xsl:with-param name="type" select="parent::Members" />
1941 <xsl:with-param name="ctor" select="." />
1942 </xsl:call-template>
1946 <!-- argument list -->
1947 <xsl:value-of select="'('"/>
1948 <xsl:for-each select="Parameters/Parameter">
1949 <xsl:if test="not(position()=1)">, </xsl:if>
1951 <xsl:call-template name="ShowParameter">
1952 <xsl:with-param name="Param" select="."/>
1953 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
1954 <xsl:with-param name="prototype" select="true()"/>
1955 </xsl:call-template>
1957 <xsl:value-of select="')'"/>
1960 <!-- TODO: $implemented? -->
1965 <xsl:when test="$listmembertype = 'Explicit'">
1967 <a href="{$linkid}">
1969 <xsl:call-template name="GetMemberDisplayName">
1970 <xsl:with-param name="memberName" select="@MemberName" />
1971 <xsl:with-param name="isproperty" select="MemberType='Property'" />
1972 </xsl:call-template>
1978 <!-- field, property and event listing -->
1979 <xsl:when test="MemberType='Field' or MemberType='Property' or MemberType='Event'">
1982 <!-- link to member page -->
1984 <a href="{$linkid}">
1985 <xsl:call-template name="GetMemberDisplayName">
1986 <xsl:with-param name="memberName" select="@MemberName" />
1987 <xsl:with-param name="isproperty" select="MemberType='Property'" />
1988 </xsl:call-template>
1992 <!-- argument list for accessors -->
1993 <xsl:if test="Parameters/Parameter">
1994 <xsl:value-of select="'('"/>
1995 <xsl:for-each select="Parameters/Parameter">
1996 <xsl:if test="not(position()=1)">, </xsl:if>
1998 <xsl:call-template name="ShowParameter">
1999 <xsl:with-param name="Param" select="."/>
2000 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
2001 <xsl:with-param name="prototype" select="true()"/>
2002 </xsl:call-template>
2005 <xsl:value-of select="')'"/>
2011 <!-- method listing -->
2012 <xsl:when test="$listmembertype='Method' or $listmembertype = 'ExtensionMethod'">
2015 <!-- link to method page -->
2017 <a href="{$linkid}">
2018 <xsl:call-template name="GetMemberDisplayName">
2019 <xsl:with-param name="memberName" select="@MemberName" />
2020 <xsl:with-param name="isproperty" select="MemberType='Property'" />
2021 </xsl:call-template>
2025 <!-- argument list -->
2026 <xsl:value-of select="'('"/>
2027 <xsl:for-each select="Parameters/Parameter">
2028 <xsl:if test="not(position()=1)">, </xsl:if>
2030 <xsl:call-template name="ShowParameter">
2031 <xsl:with-param name="Param" select="."/>
2032 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
2033 <xsl:with-param name="prototype" select="true()"/>
2034 </xsl:call-template>
2037 <xsl:value-of select="')'"/>
2039 <!-- return type -->
2040 <xsl:if test="not(ReturnValue/ReturnType='System.Void')">
2042 <xsl:text> : </xsl:text>
2043 <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
2048 <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
2049 <xsl:copy-of select="$isinherited"/>
2054 <xsl:when test="$listmembertype='Operator'">
2057 <!-- link to operator page -->
2059 <xsl:when test="@MemberName='op_Implicit' or @MemberName='op_Explicit'">
2061 <a href="{$linkid}">
2062 <xsl:text>Conversion</xsl:text>
2064 <xsl:when test="ReturnValue/ReturnType = //Type/@FullName">
2065 <xsl:text> From </xsl:text>
2066 <xsl:value-of select="Parameters/Parameter/@Type"/>
2069 <xsl:text> to </xsl:text>
2070 <xsl:value-of select="ReturnValue/ReturnType"/>
2077 <xsl:when test="@MemberName='op_Implicit'">
2078 <xsl:text>(Implicit)</xsl:text>
2081 <xsl:text>(Explicit)</xsl:text>
2085 <xsl:when test="count(Parameters/Parameter)=1">
2087 <a href="{$linkid}">
2088 <xsl:value-of select="substring-after(@MemberName, 'op_')"/>
2094 <a href="{$linkid}">
2095 <xsl:value-of select="substring-after(@MemberName, 'op_')"/>
2098 <xsl:value-of select="'('"/>
2099 <xsl:for-each select="Parameters/Parameter">
2100 <xsl:if test="not(position()=1)">, </xsl:if>
2102 <xsl:call-template name="ShowParameter">
2103 <xsl:with-param name="Param" select="."/>
2104 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
2105 <xsl:with-param name="prototype" select="true()"/>
2106 </xsl:call-template>
2109 <xsl:value-of select="')'"/>
2116 <!-- Other types: just provide a link -->
2118 <a href="{$linkid}">
2119 <xsl:call-template name="GetMemberDisplayName">
2120 <xsl:with-param name="memberName" select="@MemberName" />
2121 <xsl:with-param name="isproperty" select="MemberType='Property'" />
2122 </xsl:call-template>
2128 <xsl:if test="$listmembertype != 'Method' and $listmembertype != 'ExtensionMethod'">
2130 <!-- description -->
2131 <xsl:if test="MemberType='Field' or MemberType = 'Property'">
2132 <i><xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates></i>
2133 <xsl:if test="MemberValue"> (<xsl:value-of select="MemberValue"/>)</xsl:if>
2134 <xsl:text>. </xsl:text>
2137 <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
2138 <xsl:copy-of select="$isinherited"/>
2146 </xsl:call-template>
2149 </xsl:call-template>
2155 <xsl:template name="GetLinkName">
2156 <xsl:param name="type"/>
2157 <xsl:param name="member"/>
2158 <xsl:call-template name="memberlinkprefix">
2159 <xsl:with-param name="member" select="$member"/>
2160 </xsl:call-template>
2161 <xsl:text>:</xsl:text>
2162 <xsl:call-template name="GetEscapedTypeName">
2163 <xsl:with-param name="typename" select="$type/@FullName" />
2164 </xsl:call-template>
2165 <xsl:if test="$member/MemberType != 'Constructor'">
2166 <xsl:text>.</xsl:text>
2167 <xsl:variable name="memberName">
2168 <xsl:call-template name="GetGenericName">
2169 <xsl:with-param name="membername" select="$member/@MemberName" />
2170 <xsl:with-param name="member" select="$member" />
2171 </xsl:call-template>
2173 <xsl:call-template name="Replace">
2174 <xsl:with-param name="s">
2175 <xsl:call-template name="ToBraces">
2176 <xsl:with-param name="s" select="$memberName" />
2177 </xsl:call-template>
2179 <xsl:with-param name="from">.</xsl:with-param>
2180 <xsl:with-param name="to">#</xsl:with-param>
2181 </xsl:call-template>
2185 <xsl:template name="GetGenericName">
2186 <xsl:param name="membername" />
2187 <xsl:param name="member" />
2188 <xsl:variable name="numgenargs" select="count($member/Docs/typeparam)" />
2190 <xsl:when test="$numgenargs = 0">
2191 <xsl:value-of select="$membername" />
2194 <xsl:if test="contains($membername, '<')">
2195 <xsl:value-of select="substring-before ($membername, '<')" />
2197 <xsl:text>``</xsl:text>
2198 <xsl:value-of select="$numgenargs" />
2203 <xsl:template name="GetEscapedTypeName">
2204 <xsl:param name="typename" />
2205 <xsl:variable name="base" select="substring-before ($typename, '<')" />
2208 <xsl:when test="$base != ''">
2209 <xsl:value-of select="translate ($base, '+', '.')" />
2210 <xsl:text>`</xsl:text>
2211 <xsl:call-template name="GetGenericArgumentCount">
2212 <xsl:with-param name="arglist" select="substring-after ($typename, '<')" />
2213 <xsl:with-param name="count">1</xsl:with-param>
2214 </xsl:call-template>
2216 <xsl:otherwise><xsl:value-of select="translate ($typename, '+', '.')" /></xsl:otherwise>
2220 <xsl:template name="GetGenericArgumentCount">
2221 <xsl:param name="arglist" />
2222 <xsl:param name="count" />
2224 <xsl:variable name="rest">
2225 <xsl:call-template name="SkipTypeArgument">
2226 <xsl:with-param name="s" select="$arglist" />
2227 </xsl:call-template>
2231 <xsl:when test="$arglist != '' and $rest = ''">
2232 <xsl:value-of select="$count" />
2234 <xsl:when test="$arglist = '' and $rest = ''">
2235 <xsl:message terminate="yes">
2236 !WTF? arglist=<xsl:value-of select="$arglist" />; rest=<xsl:value-of select="$rest" />
2239 <xsl:when test="starts-with ($rest, '>')">
2240 <xsl:value-of select="$count" />
2241 <xsl:call-template name="GetEscapedTypeName">
2242 <xsl:with-param name="typename" select="substring-after ($rest, '>')" />
2243 </xsl:call-template>
2245 <xsl:when test="starts-with ($rest, ',')">
2246 <xsl:call-template name="GetGenericArgumentCount">
2247 <xsl:with-param name="arglist" select="substring-after ($rest, ',')" />
2248 <xsl:with-param name="count" select="$count+1" />
2249 </xsl:call-template>
2252 <xsl:message terminate="yes">
2253 !WTF 2? arglist=<xsl:value-of select="$arglist" />; rest=<xsl:value-of select="$rest" />
2259 <xsl:template name="SkipTypeArgument">
2260 <xsl:param name="s" />
2262 <xsl:variable name="p">
2263 <xsl:call-template name="GetCLtGtPositions">
2264 <xsl:with-param name="s" select="$s" />
2265 </xsl:call-template>
2270 Have to select between three `s' patterns:
2271 A,B>: need to return ",B>"
2272 Foo<A,B>>: Need to forward to SkipGenericArgument to eventually return ">"
2273 Foo<A,B>+C>: Need to forward to SkipGenericArgument to eventually return ">"
2275 <xsl:when test="starts-with ($s, '>')">
2276 <xsl:message terminate="yes">
2277 SkipTypeArgument: invalid type substring '<xsl:value-of select="$s" />'
2280 <xsl:when test="$p/Comma/@Length > 0 and
2281 ($p/Lt/@Length = 0 or $p/Comma/@Length < $p/Lt/@Length) and
2282 ($p/Gt/@Length > 0 and $p/Comma/@Length < $p/Gt/@Length)">
2283 <xsl:text>,</xsl:text>
2284 <xsl:value-of select="substring-after ($s, ',')" />
2286 <xsl:when test="$p/Lt/@Length > 0 and $p/Lt/@Length < $p/Gt/@Length">
2287 <xsl:variable name="r">
2288 <xsl:call-template name="SkipGenericArgument">
2289 <xsl:with-param name="s" select="substring-after ($s, '<')" />
2290 </xsl:call-template>
2292 <xsl:value-of select="substring-after ($r, '>')" />
2294 <xsl:when test="$p/Gt/@Length > 0">
2295 <xsl:text>></xsl:text>
2296 <xsl:value-of select="substring-after ($s, '>')" />
2298 <xsl:otherwise><xsl:value-of select="$s" /></xsl:otherwise>
2302 <xsl:template name="GetCLtGtPositions">
2303 <xsl:param name="s" />
2305 <xsl:variable name="c" select="substring-before ($s, ',')" />
2306 <xsl:variable name="lt" select="substring-before ($s, '<')" />
2307 <xsl:variable name="gt" select="substring-before ($s, '>')" />
2310 <Comma String="{$c}" Length="{string-length ($c)}" />
2311 <Lt String="{$lt}" Length="{string-length ($lt)}" />
2312 <Gt String="{$gt}" Length="{string-length ($gt)}" />
2317 when given 'Foo<A,Bar<Baz<C,D,E>>>>', returns '>'
2318 when given 'Bar<C>+Nested>', returns '>'
2319 when given 'Foo<A,Bar<Baz<C,D,E>>>,', returns ','
2320 (basically, it matches '<' to '>' and "skips" the intermediate type-name contents.
2322 <xsl:template name="SkipGenericArgument">
2323 <xsl:param name="s" />
2325 <xsl:variable name="p">
2326 <xsl:call-template name="GetCLtGtPositions">
2327 <xsl:with-param name="s" select="$s" />
2328 </xsl:call-template>
2332 <xsl:when test="starts-with ($s, '>')">
2333 <xsl:message terminate="yes">
2334 SkipGenericArgument: invalid type substring '<xsl:value-of select="$s" />'
2337 <xsl:when test="$p/Lt/@Length > 0 and $p/Lt/@Length < $p/Gt/@Length">
2338 <!-- within 'Foo<A...'; look for matching '>' -->
2339 <xsl:variable name="r">
2340 <xsl:call-template name="SkipGenericArgument">
2341 <xsl:with-param name="s" select="substring-after ($s, '<')" />
2342 </xsl:call-template>
2344 <xsl:value-of select="substring-after ($r, '>')" />
2346 <xsl:when test="$p/Gt/@Length > 0">
2347 <!--<xsl:value-of select="substring ($s, string-length ($gt)+1)" />-->
2348 <xsl:value-of select="substring-after ($s, '>')" />
2351 <xsl:value-of select="$s" />
2356 <xsl:template name="GetEscapedParameter">
2357 <xsl:param name="orig-parameter-type" />
2358 <xsl:param name="parameter-type" />
2359 <xsl:param name="parameter-types" />
2360 <xsl:param name="escape" />
2361 <xsl:param name="index" />
2364 <xsl:when test="$index > count($parameter-types)">
2365 <xsl:if test="$parameter-type != $orig-parameter-type">
2366 <xsl:value-of select="$parameter-type" />
2370 <xsl:when test="$parameter-types[position() = $index]/@name = $parameter-type">
2371 <xsl:value-of select="concat ($escape, $index - 1)" />
2374 <xsl:variable name="typeparam" select="$parameter-types[position() = $index]/@name" />
2375 <xsl:call-template name="GetEscapedParameter">
2376 <xsl:with-param name="orig-parameter-type" select="$orig-parameter-type" />
2377 <xsl:with-param name="parameter-type">
2378 <xsl:call-template name="Replace">
2379 <xsl:with-param name="s">
2380 <xsl:call-template name="Replace">
2381 <xsl:with-param name="s">
2382 <xsl:call-template name="Replace">
2383 <xsl:with-param name="s">
2384 <xsl:call-template name="Replace">
2385 <xsl:with-param name="s" select="$parameter-type"/>
2386 <xsl:with-param name="from" select="concat('<', $typeparam, '>')" />
2387 <xsl:with-param name="to" select="concat('<', $escape, $index - 1, '>')" />
2388 </xsl:call-template>
2390 <xsl:with-param name="from" select="concat('<', $typeparam, ',')" />
2391 <xsl:with-param name="to" select="concat('<', $escape, $index - 1, ',')" />
2392 </xsl:call-template>
2394 <xsl:with-param name="from" select="concat (',', $typeparam, '>')" />
2395 <xsl:with-param name="to" select="concat(',', $escape, $index - 1, '>')" />
2396 </xsl:call-template>
2398 <xsl:with-param name="from" select="concat (',', $typeparam, ',')" />
2399 <xsl:with-param name="to" select="concat(',', $escape, $index - 1, ',')" />
2400 </xsl:call-template>
2402 <xsl:with-param name="parameter-types" select="$parameter-types" />
2403 <xsl:with-param name="typeparam" select="$typeparam" />
2404 <xsl:with-param name="escape" select="$escape" />
2405 <xsl:with-param name="index" select="$index + 1" />
2406 </xsl:call-template>
2411 <xsl:template name="GetLinkId">
2412 <xsl:param name="type"/>
2413 <xsl:param name="member"/>
2414 <xsl:call-template name="GetLinkName">
2415 <xsl:with-param name="type" select="$type" />
2416 <xsl:with-param name="member" select="$member" />
2417 </xsl:call-template>
2418 <xsl:if test="count($member/Parameters/Parameter) > 0">
2419 <xsl:text>(</xsl:text>
2420 <xsl:for-each select="Parameters/Parameter">
2421 <xsl:if test="not(position()=1)">,</xsl:if>
2422 <xsl:call-template name="GetParameterType">
2423 <xsl:with-param name="type" select="$type" />
2424 <xsl:with-param name="member" select="$member" />
2425 <xsl:with-param name="parameter" select="." />
2426 </xsl:call-template>
2428 <xsl:text>)</xsl:text>
2430 <xsl:if test="$member/@MemberName='op_Implicit' or $member/@MemberName='op_Explicit'">
2431 <xsl:text>~</xsl:text>
2432 <xsl:call-template name="GetParameterType">
2433 <xsl:with-param name="type" select="$type" />
2434 <xsl:with-param name="member" select="$member" />
2435 <xsl:with-param name="parameter">
2436 <Parameter Type="{$member/ReturnValue/ReturnType}" />
2438 </xsl:call-template>
2443 - what should be <xsl:value-of select="@Type" /> becomes a nightmare once
2444 - generics enter the picture, since a parameter type could come from the
2445 - type itelf (becoming `N) or from the method (becoming ``N).
2447 <xsl:template name="GetParameterType">
2448 <xsl:param name="type" />
2449 <xsl:param name="member" />
2450 <xsl:param name="parameter" />
2452 <!-- the actual parameter type -->
2453 <xsl:variable name="ptype">
2455 <xsl:when test="contains($parameter/@Type, '[')">
2456 <xsl:value-of select="substring-before ($parameter/@Type, '[')" />
2458 <xsl:when test="contains($parameter/@Type, '&')">
2459 <xsl:value-of select="substring-before ($parameter/@Type, '&')" />
2461 <xsl:when test="contains($parameter/@Type, '*')">
2462 <xsl:value-of select="substring-before ($parameter/@Type, '*')" />
2465 <xsl:value-of select="$parameter/@Type" />
2470 <!-- parameter modifiers -->
2471 <xsl:variable name="pmodifier">
2472 <xsl:call-template name="Replace">
2473 <xsl:with-param name="s" select="substring-after ($parameter/@Type, $ptype)" />
2474 <xsl:with-param name="from">&</xsl:with-param>
2475 <xsl:with-param name="to">@</xsl:with-param>
2476 </xsl:call-template>
2479 <xsl:variable name="gen-type">
2480 <xsl:call-template name="GetEscapedParameter">
2481 <xsl:with-param name="orig-parameter-type" select="$ptype" />
2482 <xsl:with-param name="parameter-type">
2483 <xsl:variable name="nested">
2484 <xsl:call-template name="GetEscapedParameter">
2485 <xsl:with-param name="orig-parameter-type" select="$ptype" />
2486 <xsl:with-param name="parameter-type" select="$ptype" />
2487 <xsl:with-param name="parameter-types" select="$type/Docs/typeparam" />
2488 <xsl:with-param name="escape" select="'`'" />
2489 <xsl:with-param name="index" select="1" />
2490 </xsl:call-template>
2493 <xsl:when test="$nested != ''">
2494 <xsl:value-of select="$nested" />
2497 <xsl:value-of select="$ptype" />
2501 <xsl:with-param name="parameter-types" select="$member/Docs/typeparam" />
2502 <xsl:with-param name="escape" select="'``'" />
2503 <xsl:with-param name="index" select="1" />
2504 </xsl:call-template>
2507 <!-- the actual parameter type -->
2508 <xsl:variable name="parameter-type">
2510 <xsl:when test="$gen-type != ''">
2511 <xsl:value-of select="$gen-type" />
2512 <xsl:value-of select="$pmodifier" />
2515 <xsl:value-of select="concat($ptype, $pmodifier)" />
2520 <!-- s/</{/g; s/>/}/g; so that less escaping is needed. -->
2521 <xsl:call-template name="Replace">
2522 <xsl:with-param name="s">
2523 <xsl:call-template name="Replace">
2524 <xsl:with-param name="s" select="translate ($parameter-type, '+', '.')" />
2525 <xsl:with-param name="from">></xsl:with-param>
2526 <xsl:with-param name="to">}</xsl:with-param>
2527 </xsl:call-template>
2529 <xsl:with-param name="from"><</xsl:with-param>
2530 <xsl:with-param name="to">{</xsl:with-param>
2531 </xsl:call-template>
2534 <xsl:template name="Replace">
2535 <xsl:param name="s" />
2536 <xsl:param name="from" />
2537 <xsl:param name="to" />
2539 <xsl:when test="not(contains($s, $from))">
2540 <xsl:value-of select="$s" />
2543 <xsl:variable name="prefix" select="substring-before($s, $from)"/>
2544 <xsl:variable name="suffix" select="substring-after($s, $from)" />
2545 <xsl:value-of select="$prefix" />
2546 <xsl:value-of select="$to" />
2547 <xsl:call-template name="Replace">
2548 <xsl:with-param name="s" select="$suffix" />
2549 <xsl:with-param name="from" select="$from" />
2550 <xsl:with-param name="to" select="$to" />
2551 </xsl:call-template>
2556 <xsl:template name="getmodifiers">
2557 <xsl:param name="sig"/>
2558 <xsl:param name="protection" select="true()"/>
2559 <xsl:param name="inheritance" select="true()"/>
2560 <xsl:param name="extra" select="true()"/>
2561 <xsl:param name="typetype" select="false()"/>
2563 <xsl:variable name="Sig">
2564 <xsl:text> </xsl:text>
2566 <xsl:when test="contains($sig, '{')">
2567 <xsl:value-of select="substring-before ($sig, '{')" />
2570 <xsl:value-of select="$sig" />
2573 <xsl:text> </xsl:text>
2576 <xsl:if test="$protection">
2577 <xsl:if test="contains($Sig, ' public ')">public </xsl:if>
2578 <xsl:if test="contains($Sig, ' private ')">private </xsl:if>
2579 <xsl:if test="contains($Sig, ' protected ')">protected </xsl:if>
2580 <xsl:if test="contains($Sig, ' internal ')">internal </xsl:if>
2583 <xsl:if test="contains($Sig, ' static ')">static </xsl:if>
2584 <xsl:if test="contains($Sig, ' abstract ')">abstract </xsl:if>
2585 <xsl:if test="contains($Sig, ' operator ')">operator </xsl:if>
2587 <xsl:if test="contains($Sig, ' const ')">const </xsl:if>
2588 <xsl:if test="contains($Sig, ' readonly ')">readonly </xsl:if>
2590 <xsl:if test="$inheritance">
2591 <xsl:if test="contains($Sig, ' override ')">override </xsl:if>
2592 <xsl:if test="contains($Sig, ' new ')">new </xsl:if>
2595 <xsl:if test="$extra">
2596 <xsl:if test="contains($Sig, ' sealed ')">sealed </xsl:if>
2597 <xsl:if test="contains($Sig, ' virtual ')">virtual </xsl:if>
2599 <xsl:if test="contains($Sig, ' extern ')">extern </xsl:if>
2600 <xsl:if test="contains($Sig, ' checked ')">checked </xsl:if>
2601 <xsl:if test="contains($Sig, ' unsafe ')">unsafe </xsl:if>
2602 <xsl:if test="contains($Sig, ' volatile ')">volatile </xsl:if>
2603 <xsl:if test="contains($Sig, ' explicit ')">explicit </xsl:if>
2604 <xsl:if test="contains($Sig, ' implicit ')">implicit </xsl:if>
2607 <xsl:if test="$typetype">
2608 <xsl:if test="contains($Sig, ' class ')">class </xsl:if>
2609 <xsl:if test="contains($Sig, ' interface ')">interface </xsl:if>
2610 <xsl:if test="contains($Sig, ' struct ')">struct </xsl:if>
2611 <xsl:if test="contains($Sig, ' delegate ')">delegate </xsl:if>
2612 <xsl:if test="contains($Sig, ' enum ')">enum </xsl:if>
2616 <xsl:template name="GetTypeDescription">
2617 <xsl:variable name="sig" select="TypeSignature[@Language='C#']/@Value"/>
2619 <xsl:when test="contains($sig, ' class ')">Class</xsl:when>
2620 <xsl:when test="contains($sig, ' interface ')">Interface</xsl:when>
2621 <xsl:when test="contains($sig, ' struct ')">Struct</xsl:when>
2622 <xsl:when test="contains($sig, ' delegate ')">Delegate</xsl:when>
2623 <xsl:when test="contains($sig, ' enum ')">Enum</xsl:when>
2627 <xsl:template match="since">
2629 <i>Note: This namespace, class, or member is supported only in version <xsl:value-of select="@version" />