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