43983af55cf6eb58a3ceb2f9e59031d6e2338498
[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="'Platform Docs'" />
844                                   <xsl:with-param name="type" select="'PlatformDocAPI'" />
845                                 </xsl:call-template>
846                                 <xsl:call-template name="CreateRelatedSection">
847                                   <xsl:with-param name="section" select="'Articles'" />
848                                   <xsl:with-param name="type" select="'article'" />
849                                 </xsl:call-template>
850                                 <xsl:call-template name="CreateRelatedSection">
851                                   <xsl:with-param name="section" select="'Recipes'" />
852                                   <xsl:with-param name="type" select="'recipe'" />
853                                 </xsl:call-template>
854                                 <xsl:call-template name="CreateRelatedSection">
855                                   <xsl:with-param name="section" select="'Samples'" />
856                                   <xsl:with-param name="type" select="'sample'" />
857                                 </xsl:call-template>
858                                 <xsl:call-template name="CreateRelatedSection">
859                                   <xsl:with-param name="section" select="'Related specifications'" />
860                                   <xsl:with-param name="type" select="'specification'" />
861                                 </xsl:call-template>
862                                 <xsl:call-template name="CreateRelatedSection">
863                                   <xsl:with-param name="section" select="'External Documentation'" />
864                                   <xsl:with-param name="type" select="'externalDocumentation'" />
865                                 </xsl:call-template>
866                           </div>
867                         </xsl:with-param>
868                   </xsl:call-template>
869                 </xsl:if>
870
871                 <xsl:call-template name="CreateH2Section">
872                         <xsl:with-param name="name" select="'Requirements'"/>
873                         <xsl:with-param name="child-id" select="concat ($linkid, ':Version Information')" />
874                         <xsl:with-param name="content">
875                                 <xsl:call-template name="CreatePlatformRequirements" />
876                                 <b>Namespace: </b><xsl:value-of select="substring(/Type/@FullName, 1, string-length(/Type/@FullName) - string-length(/Type/@Name) - 1)" />
877                                 <xsl:if test="count(/Type/AssemblyInfo/AssemblyName) &gt; 0">
878                                         <br />
879                                         <b>Assembly: </b>
880                                         <xsl:value-of select="/Type/AssemblyInfo/AssemblyName" />
881                                         <xsl:text> (in </xsl:text>
882                                         <xsl:value-of select="/Type/AssemblyInfo/AssemblyName" />
883                                         <xsl:text>.dll)</xsl:text>
884                                 </xsl:if>
885                                 <xsl:if test="count(AssemblyInfo/AssemblyVersion) &gt; 0">
886                                         <br />
887                                         <b>Assembly Versions: </b>
888                                         <xsl:for-each select="AssemblyInfo/AssemblyVersion">
889                                                 <xsl:if test="not(position()=1)">, </xsl:if>
890                                                         <xsl:value-of select="."/>
891                                         </xsl:for-each>
892                                 </xsl:if>
893                                 <xsl:if test="count(Docs/since) &gt; 0">
894                                         <br />
895                                         <b>Since: </b>
896                                         <xsl:for-each select="Docs/since">
897                                                 <xsl:if test="not(position()=1)">; </xsl:if>
898                                                         <xsl:value-of select="@version"/>
899                                         </xsl:for-each>
900                                 </xsl:if>
901                                 <xsl:if test="count(Docs/since)=0 and count(/Type/Docs/since) &gt; 0">
902                                         <br />
903                                         <b>Since: </b>
904                                         <xsl:for-each select="/Type/Docs/since">
905                                                 <xsl:if test="not(position()=1)">; </xsl:if>
906                                                         <xsl:value-of select="@version"/>
907                                         </xsl:for-each>
908                                 </xsl:if>
909                         </xsl:with-param>
910                 </xsl:call-template>
911         </xsl:template>
912
913         
914         <!-- 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. -->
915
916         <xsl:template match="*|@*" mode="typelink">
917                 <xsl:param name="wrt" select="'notset'"/>
918                 
919                 <xsl:call-template name="maketypelink">
920                                 <xsl:with-param name="type" select="."/>
921                                 <xsl:with-param name="wrt" select="$wrt"/>
922                 </xsl:call-template>
923         </xsl:template>
924
925         <xsl:template name="makenamespacelink">
926                 <xsl:param name="cref" select="''"/>
927
928                 <a>
929                         <xsl:attribute name="href">
930                                 <xsl:call-template name="GetLinkTargetHtml">
931                                         <xsl:with-param name="cref" select="$cref" />
932                                 </xsl:call-template>
933                         </xsl:attribute>
934         
935                         <xsl:value-of select="substring-after ($cref, 'N:')" />
936                 </a>
937         </xsl:template>
938
939         <xsl:template name="maketypelink">
940                 <xsl:param name="type" select="'notset'"/>
941                 <xsl:param name="wrt" select="'notset'"/>
942                 <xsl:param name="nested" select="0"/>
943
944                 <xsl:variable name="btype">
945                         <xsl:call-template name="ToBrackets">
946                                 <xsl:with-param name="s" select="$type" />
947                         </xsl:call-template>
948                 </xsl:variable>
949
950                 <xsl:variable name="array">
951                         <xsl:call-template name="GetArraySuffix">
952                                 <xsl:with-param name="type" select="$type" />
953                         </xsl:call-template>
954                 </xsl:variable>
955                 
956                 <xsl:choose>
957
958                 <!-- chop off T: -->
959                 <xsl:when test="starts-with($type, 'T:')">
960                         <xsl:call-template name="maketypelink">
961                                 <xsl:with-param name="type" select="substring($type, 3)"/>
962                                 <xsl:with-param name="wrt" select="$wrt"/>
963                         </xsl:call-template>
964                 </xsl:when>
965
966                 <xsl:when test="contains ($type, '&amp;') and 
967                                 '&amp;' = substring ($type, string-length ($type), 1)">
968                         <xsl:call-template name="maketypelink">
969                                 <xsl:with-param name="type" select="substring($type, 1, string-length($type)-1)"/>
970                                 <xsl:with-param name="wrt" select="$wrt"/>
971                         </xsl:call-template>
972                 </xsl:when>
973
974                 <xsl:when test="string($array)">
975                         <xsl:call-template name="maketypelink">
976                                 <xsl:with-param name="type" select="substring($type, 1, string-length($type) - string-length ($array))"/>
977                                 <xsl:with-param name="wrt" select="$wrt"/>
978                         </xsl:call-template>
979                         <xsl:value-of select="$array"/>
980                 </xsl:when>
981
982                 <xsl:when test="contains ($type, '*') and
983                                 '*' = substring ($type, string-length ($type), 1)">
984                         <xsl:call-template name="maketypelink">
985                                 <xsl:with-param name="type" select="substring($type, 1, string-length($type)-1)"/>
986                                 <xsl:with-param name="wrt" select="$wrt"/>
987                         </xsl:call-template>
988                         <xsl:value-of select="'*'"/>
989                 </xsl:when>
990                 
991                 <!-- if this is a generic type parameter, don't make a link but italicize it and give it a tooltip instead -->
992                 <xsl:when test="count($ThisType/TypeParameters/TypeParameter[@Name=$type] | 
993                                 $ThisType/TypeParameters/TypeParameter[child::text()=$type] |
994                                 ancestor::Member/Docs/typeparam[@name=$type]) = 1">
995                         <!-- 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 -->
996                         <i title="{$ThisType/Docs/typeparam[@name=$type] | ancestor::Member/Docs/typeparam[@name=$type]}"><xsl:value-of select="$type"/></i>
997                 </xsl:when>
998                 
999                 <!-- if this is a generic type parameter of a base type, replace it with the type that it was instantiated with -->
1000                 <xsl:when test="count(ancestor::Members/BaseTypeArgument[@TypeParamName=$type]) = 1">
1001                         <!-- 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 -->
1002                         <xsl:call-template name="maketypelink">
1003                                 <xsl:with-param name="type" select="ancestor::Members/BaseTypeArgument[@TypeParamName=$type]"/>
1004                                 <xsl:with-param name="wrt" select="$wrt"/>
1005                         </xsl:call-template>
1006                 </xsl:when>
1007                 
1008
1009                 <xsl:otherwise>
1010                         <xsl:variable name="escaped-type">
1011                                 <xsl:call-template name="GetEscapedTypeName">
1012                                         <xsl:with-param name="typename" select="$btype" />
1013                                 </xsl:call-template>
1014                         </xsl:variable>
1015                         <a>
1016                                 <xsl:attribute name="href">
1017                                         <xsl:call-template name="GetLinkTargetHtml">
1018                                                 <xsl:with-param name="type" select="$escaped-type" />
1019                                                 <xsl:with-param name="cref" select="concat ('T:', $escaped-type)" />
1020                                         </xsl:call-template>
1021                                 </xsl:attribute>
1022         
1023                                 <xsl:call-template name="GetTypeDisplayName">
1024                                         <xsl:with-param name="T" select="$btype"/>
1025                                         <xsl:with-param name="wrt" select="$wrt"/>
1026                                 </xsl:call-template>
1027                         </a>
1028                 </xsl:otherwise>
1029                 </xsl:choose>
1030         </xsl:template>
1031
1032         <xsl:template name="GetArraySuffix">
1033                 <xsl:param name="type" />
1034
1035                 <xsl:if test="contains ($type, ']') and 
1036                                 ']' = substring ($type, string-length ($type), 1)">
1037                         <xsl:variable name="start">
1038                                 <xsl:call-template name="GetArraySuffixStart">
1039                                         <xsl:with-param name="type" select="$type" />
1040                                         <xsl:with-param name="i" select="string-length ($type) - 1" />
1041                                 </xsl:call-template>
1042                         </xsl:variable>
1043                         <xsl:value-of select="substring ($type, $start)" />
1044                 </xsl:if>
1045         </xsl:template>
1046
1047         <xsl:template name="GetArraySuffixStart">
1048                 <xsl:param name="type" />
1049                 <xsl:param name="i" />
1050
1051                 <xsl:choose>
1052                         <xsl:when test="substring ($type, $i, 1) = '['">
1053                                 <xsl:value-of select="$i" />
1054                         </xsl:when>
1055                         <xsl:otherwise>
1056                                 <xsl:call-template name="GetArraySuffixStart">
1057                                         <xsl:with-param name="type" select="$type" />
1058                                         <xsl:with-param name="i" select="$i - 1" />
1059                                 </xsl:call-template>
1060                         </xsl:otherwise>
1061                 </xsl:choose>
1062         </xsl:template>
1063
1064         <xsl:template name="GetTypeDisplayName">
1065                 <xsl:param name="T"/>
1066                 <xsl:param name="wrt"/>
1067
1068                                 <!-- use C#-style names -->
1069                                 <xsl:choose>
1070                                         <xsl:when test="$T='System.Object'">object</xsl:when>
1071                                         <xsl:when test="$T='System.Boolean'">bool</xsl:when>
1072                                         <xsl:when test="$T='System.Byte'">byte</xsl:when>
1073                                         <xsl:when test="$T='System.Char'">char</xsl:when>
1074                                         <xsl:when test="$T='System.Decimal'">decimal</xsl:when>
1075                                         <xsl:when test="$T='System.Double'">double</xsl:when>
1076                                         <xsl:when test="$T='System.Int16'">short</xsl:when>
1077                                         <xsl:when test="$T='System.Int32'">int</xsl:when>
1078                                         <xsl:when test="$T='System.Int64'">long</xsl:when>
1079                                         <xsl:when test="$T='System.SByte'">sbyte</xsl:when>
1080                                         <xsl:when test="$T='System.Single'">float</xsl:when>
1081                                         <xsl:when test="$T='System.String'">string</xsl:when>
1082                                         <xsl:when test="$T='System.UInt16'">ushort</xsl:when>
1083                                         <xsl:when test="$T='System.UInt32'">uint</xsl:when>
1084                                         <xsl:when test="$T='System.UInt64'">ulong</xsl:when>
1085                                         <xsl:when test="$T='System.Void'">void</xsl:when>
1086
1087                                         <xsl:when test="contains($T, '&lt;')">
1088                                                 <xsl:call-template name="GetTypeDisplayName">
1089                                                         <xsl:with-param name="T" select="substring-before ($T, '&lt;')" />
1090                                                         <xsl:with-param name="wrt" select="$wrt" />
1091                                                 </xsl:call-template>
1092                                                 <xsl:text>&lt;</xsl:text>
1093                                                 <xsl:call-template name="GetMemberArgList">
1094                                                         <xsl:with-param name="arglist" select="substring-after ($T, '&lt;')" />
1095                                                         <xsl:with-param name="wrt" select="$wrt" />
1096                                                 </xsl:call-template>
1097                                                 <!-- don't need to append &gt; as GetMemberArgList (eventually) appends it -->
1098                                         </xsl:when>
1099         
1100                                         <!-- if the type is in the wrt namespace, omit the namespace name -->
1101                                         <xsl:when test="not($wrt='') and starts-with($T, concat($wrt,'.')) and not(contains(substring-after($T,concat($wrt,'.')), '.'))">
1102                                                 <xsl:value-of select="translate (substring-after($T,concat($wrt,'.')), '+', '.')"/>
1103                                         </xsl:when>
1104         
1105                                         <!-- if the type is in the System namespace, omit the namespace name -->
1106                                         <xsl:when test="starts-with($T, 'System.') and not(contains(substring-after($T, 'System.'), '.'))">
1107                                                 <xsl:value-of select="translate (substring-after($T,'System.'), '+', '.')"/>
1108                                         </xsl:when>
1109         
1110                                         <!-- if the type is in the System.Collections namespace, omit the namespace name -->
1111                                         <xsl:when test="starts-with($T, 'System.Collections.') and not(contains(substring-after($T, 'System.Collections.'), '.'))">
1112                                                 <xsl:value-of select="translate (substring-after($T,'System.Collections.'), '+', '.')"/>
1113                                         </xsl:when>
1114
1115                                         <!-- if the type is in the System.Collections.Generic namespace, omit the namespace name -->
1116                                         <xsl:when test="starts-with($T, 'System.Collections.Generic.') and not(contains(substring-after($T, 'System.Collections.Generic.'), '.'))">
1117                                                 <xsl:value-of select="translate (substring-after($T,'System.Collections.Generic.'), '+', '.')"/>
1118                                         </xsl:when>
1119
1120                                         <xsl:otherwise>
1121                                                 <xsl:value-of select="translate ($T, '+', '.')" />
1122                                         </xsl:otherwise>
1123                                 </xsl:choose>
1124         </xsl:template>
1125
1126         <xsl:template name="GetMemberDisplayName">
1127                 <xsl:param name="memberName" />
1128                 <xsl:param name="isproperty" select="false()" />
1129
1130                 <xsl:choose>
1131                         <xsl:when test="contains($memberName, '.')">
1132                                 <xsl:call-template name="GetTypeDisplayName">
1133                                         <xsl:with-param name="T">
1134                                                 <xsl:call-template name="GetTypeName">
1135                                                         <xsl:with-param name="type" select="$memberName"/>
1136                                                 </xsl:call-template>
1137                                         </xsl:with-param>
1138                                         <xsl:with-param name="wrt" select="''" />
1139                                 </xsl:call-template>
1140                                 <xsl:text>.</xsl:text>
1141                                 <xsl:call-template name="GetMemberName">
1142                                         <xsl:with-param name="type" select="$memberName" />
1143                                         <xsl:with-param name="isproperty" select="$isproperty"/>
1144                                 </xsl:call-template>
1145                         </xsl:when>
1146                         <xsl:otherwise>
1147                                 <xsl:value-of select="$memberName" />
1148                         </xsl:otherwise>
1149                 </xsl:choose>
1150         </xsl:template>
1151
1152         <xsl:template name="ToBrackets">
1153                 <xsl:param name="s" />
1154                 <xsl:value-of select="translate (translate ($s, '{', '&lt;'), '}', '&gt;')" />
1155         </xsl:template>
1156
1157         <xsl:template name="ToBraces">
1158                 <xsl:param name="s" />
1159                 <xsl:value-of select="translate (translate ($s, '&lt;', '{'), '&gt;', '}')" />
1160         </xsl:template>
1161         
1162         <xsl:template name="memberlinkprefix">
1163                 <xsl:param name="member" />
1164                 <xsl:choose>
1165                         <xsl:when test="$member/MemberType='Constructor'">C</xsl:when>
1166                         <xsl:when test="$member/MemberType='Method'">M</xsl:when>
1167                         <xsl:when test="$member/MemberType='Property'">P</xsl:when>
1168                         <xsl:when test="$member/MemberType='Field'">F</xsl:when>
1169                         <xsl:when test="$member/MemberType='Event'">E</xsl:when>
1170                 </xsl:choose>
1171         </xsl:template>
1172
1173         <xsl:template name="makememberlink">
1174                 <xsl:param name="cref"/>
1175
1176                 <xsl:variable name="bcref">
1177                         <xsl:call-template name="ToBrackets">
1178                                 <xsl:with-param name="s" select="$cref" />
1179                         </xsl:call-template>
1180                 </xsl:variable>
1181
1182                 <xsl:variable name="fullname">
1183                         <xsl:choose>
1184                                 <xsl:when test="starts-with($bcref, 'C:') or starts-with($bcref, 'T:')">
1185                                         <xsl:choose>
1186                                                 <xsl:when test="contains($bcref, '(')">
1187                                                         <xsl:value-of select="substring (substring-before ($bcref, '('), 3)" />
1188                                                 </xsl:when>
1189                                                 <xsl:otherwise>
1190                                                         <xsl:value-of select="substring($bcref, 3)" />
1191                                                 </xsl:otherwise>
1192                                         </xsl:choose>
1193                                 </xsl:when>
1194                                 <xsl:otherwise>
1195                                         <xsl:call-template name="GetTypeName">
1196                                                 <xsl:with-param name="type" select="substring($bcref, 3)"/>
1197                                         </xsl:call-template>
1198                                 </xsl:otherwise>
1199                         </xsl:choose>
1200                 </xsl:variable>
1201
1202                 <xsl:variable name="memberName">
1203                         <xsl:choose>
1204                                 <xsl:when test="starts-with($bcref, 'T:')" />
1205                                 <xsl:when test="starts-with($bcref, 'C:') and not(contains($bcref, '('))" />
1206                                 <xsl:when test="starts-with($bcref, 'C:') and contains($bcref, '(')">
1207                                         <xsl:text>(</xsl:text>
1208                                         <xsl:call-template name="GetMemberArgList">
1209                                                 <xsl:with-param name="arglist" select="substring-before(substring-after($bcref, '('), ')')" />
1210                                                 <xsl:with-param name="wrt" select="$TypeNamespace" />
1211                                         </xsl:call-template>
1212                                         <xsl:text>)</xsl:text>
1213                                 </xsl:when>
1214                                 <xsl:otherwise>
1215                                         <xsl:text>.</xsl:text>
1216                                         <xsl:call-template name="GetMemberName">
1217                                                 <xsl:with-param name="type" select="substring($bcref, 3)" />
1218                                                 <xsl:with-param name="wrt" select="$fullname"/>
1219                                                 <xsl:with-param name="isproperty" select="starts-with($bcref, 'P:')"/>
1220                                         </xsl:call-template>
1221                                 </xsl:otherwise>
1222                         </xsl:choose>
1223                 </xsl:variable>
1224
1225                 <xsl:variable name="escaped-type">
1226                         <xsl:call-template name="GetEscapedTypeName">
1227                                 <xsl:with-param name="typename">
1228                                         <xsl:call-template name="ToBrackets">
1229                                                 <xsl:with-param name="s" select="$fullname" />
1230                                         </xsl:call-template>
1231                                 </xsl:with-param>
1232                         </xsl:call-template>
1233                 </xsl:variable>
1234                 <xsl:variable name="displayname">
1235                         <xsl:call-template name="GetTypeDisplayName">
1236                                 <xsl:with-param name="T" select="$fullname" />
1237                                 <xsl:with-param name="wrt" select="$TypeNamespace"/>
1238                         </xsl:call-template>
1239                 </xsl:variable>
1240                 <a>
1241                         <xsl:attribute name="href">
1242                                 <xsl:call-template name="GetLinkTargetHtml">
1243                                         <xsl:with-param name="type" select="$escaped-type" />
1244                                         <xsl:with-param name="cref">
1245                                                 <xsl:call-template name="ToBraces">
1246                                                         <xsl:with-param name="s" select="$cref" />
1247                                                 </xsl:call-template>
1248                                         </xsl:with-param>
1249                                 </xsl:call-template>
1250                         </xsl:attribute>
1251                         <xsl:value-of select="translate (concat($displayname, $memberName), '+', '.')" />
1252                 </a>
1253         </xsl:template>
1254
1255         <xsl:template name="GetTypeName">
1256                 <xsl:param name="type" />
1257                 <xsl:variable name="prefix" select="substring-before($type, '.')" />
1258                 <xsl:variable name="suffix" select="substring-after($type, '.')" />
1259                 <xsl:choose>
1260                         <xsl:when test="contains($type, '(')">
1261                                 <xsl:call-template name="GetTypeName">
1262                                         <xsl:with-param name="type" select="substring-before($type, '(')" />
1263                                 </xsl:call-template>
1264                         </xsl:when>
1265                         <xsl:when test="not(contains($suffix, '.'))">
1266                                 <xsl:value-of select="$prefix" />
1267                         </xsl:when>
1268                         <xsl:otherwise>
1269                                 <xsl:value-of select="$prefix" />
1270                                 <xsl:text>.</xsl:text>
1271                                 <xsl:call-template name="GetTypeName">
1272                                         <xsl:with-param name="type" select="$suffix" />
1273                                 </xsl:call-template>
1274                         </xsl:otherwise>
1275                 </xsl:choose>
1276         </xsl:template>
1277
1278         <xsl:template name="GetMemberName">
1279                 <xsl:param name="type" />
1280                 <xsl:param name="isproperty" select="0"/>
1281                 <xsl:variable name="prefix" select="substring-before($type, '.')" />
1282                 <xsl:variable name="suffix" select="substring-after($type, '.')" />
1283                 <xsl:choose>
1284                         <xsl:when test="contains($type, '(')">
1285                                 <xsl:call-template name="GetMemberName">
1286                                         <xsl:with-param name="type" select="substring-before($type, '(')" />
1287                                 </xsl:call-template>
1288                                 <xsl:text>(</xsl:text>
1289                                 <xsl:call-template name="GetMemberArgList">
1290                                         <xsl:with-param name="arglist" select="substring-before(substring-after($type, '('), ')')" />
1291                                         <xsl:with-param name="wrt" select="$TypeNamespace" />
1292                                 </xsl:call-template>
1293                                 <xsl:text>)</xsl:text>
1294                         </xsl:when>
1295                         <xsl:when test="not(contains($suffix, '.'))">
1296                                 <xsl:value-of select="$suffix" />
1297                         </xsl:when>
1298                         <xsl:otherwise>
1299                                 <xsl:call-template name="GetMemberName">
1300                                         <xsl:with-param name="type" select="$suffix" />
1301                                 </xsl:call-template>
1302                         </xsl:otherwise>
1303                 </xsl:choose>
1304         </xsl:template>
1305
1306         <xsl:template name="GetMemberArgList">
1307                 <xsl:param name="arglist" />
1308                 <xsl:param name="wrt" select="''"/>
1309
1310                 <xsl:variable name="_arglist">
1311                         <xsl:choose>
1312                                 <xsl:when test="starts-with ($arglist, ',')">
1313                                         <xsl:value-of select="substring-after ($arglist, ',')" />
1314                                 </xsl:when>
1315                                 <xsl:otherwise>
1316                                         <xsl:value-of select="$arglist" />
1317                                 </xsl:otherwise>
1318                         </xsl:choose>
1319                 </xsl:variable>
1320
1321                 <xsl:if test="starts-with ($arglist, ',')">
1322                         <xsl:text>, </xsl:text>
1323                 </xsl:if>
1324
1325                 <xsl:variable name="c"  select="substring-before ($_arglist, ',')" />
1326                 <xsl:variable name="lt" select="substring-before ($_arglist, '&lt;')" />
1327                 <xsl:variable name="gt" select="substring-before ($_arglist, '&gt;')" />
1328
1329                 <xsl:choose>
1330                         <!-- Need to insert ',' between type arguments -->
1331                         <xsl:when test="
1332                                         ($c != '' and $lt != '' and $gt != '' and 
1333                                          string-length ($c) &lt; string-length ($lt) and 
1334                                          string-length ($c) &lt; string-length ($gt)) or
1335                                         ($c != '' and $lt != '' and $gt = '' and
1336                                          string-length ($c) &lt; string-length ($lt)) or
1337                                         ($c != '' and $lt = '' and $gt != '' and
1338                                          string-length ($c) &lt; string-length ($gt)) or
1339                                         ($c != '' and $lt = '' and $gt = '')">
1340                                 <xsl:call-template name="GetTypeDisplayName">
1341                                         <xsl:with-param name="T" select="$c"/>
1342                                         <xsl:with-param name="wrt" select="$wrt"/>
1343                                 </xsl:call-template>
1344                                 <xsl:text>, </xsl:text>
1345                                 <xsl:call-template name="GetMemberArgList">
1346                                         <xsl:with-param name="arglist" select="substring-after($_arglist, ',')" />
1347                                         <xsl:with-param name="wrt" select="$wrt" />
1348                                 </xsl:call-template>
1349                         </xsl:when>
1350
1351                         <!-- start of nested type argument list < -->
1352                         <xsl:when test="
1353                                         ($c != '' and $lt != '' and $gt != '' and 
1354                                          string-length ($lt) &lt; string-length ($c) and 
1355                                          string-length ($lt) &lt; string-length ($gt)) or
1356                                         ($c != '' and $lt != '' and $gt = '' and
1357                                          string-length ($lt) &lt; string-length ($c)) or
1358                                         ($c = '' and $lt != '' and $gt != '' and
1359                                          string-length ($lt) &lt; string-length ($gt))">
1360                                 <xsl:call-template name="GetTypeDisplayName">
1361                                         <xsl:with-param name="T" select="$lt"/>
1362                                         <xsl:with-param name="wrt" select="$wrt"/>
1363                                 </xsl:call-template>
1364                                 <xsl:text>&lt;</xsl:text>
1365                                 <xsl:call-template name="GetMemberArgList">
1366                                         <xsl:with-param name="arglist" select="substring-after($_arglist, '&lt;')" />
1367                                         <xsl:with-param name="wrt" select="$wrt" />
1368                                 </xsl:call-template>
1369                         </xsl:when>
1370
1371                         <!-- end of (nested?) type argument list > -->
1372                         <xsl:when test="
1373                                         ($c != '' and $lt != '' and $gt != '' and 
1374                                          string-length ($gt) &lt; string-length ($c) and 
1375                                          string-length ($gt) &lt; string-length ($lt)) or
1376                                         ($c != '' and $lt = '' and $gt = '' and
1377                                          string-length ($gt) &lt; string-length ($c)) or
1378                                         ($c = '' and $lt != '' and $gt != '' and
1379                                          string-length ($gt) &lt; string-length ($lt)) or
1380                                         ($c = '' and $lt = '' and $gt != '')">
1381                                 <xsl:call-template name="GetTypeDisplayName">
1382                                         <xsl:with-param name="T" select="$gt"/>
1383                                         <xsl:with-param name="wrt" select="$wrt"/>
1384                                 </xsl:call-template>
1385                                 <xsl:text>&gt;</xsl:text>
1386                                 <xsl:call-template name="GetMemberArgList">
1387                                         <xsl:with-param name="arglist" select="substring-after($_arglist, '&gt;')" />
1388                                         <xsl:with-param name="wrt" select="$wrt" />
1389                                 </xsl:call-template>
1390                         </xsl:when>
1391
1392                         <!-- nothing left to do -->
1393                         <xsl:otherwise>
1394                                 <xsl:call-template name="GetTypeDisplayName">
1395                                         <xsl:with-param name="T" select="$_arglist"/>
1396                                         <xsl:with-param name="wrt" select="$wrt"/>
1397                                 </xsl:call-template>
1398                         </xsl:otherwise>
1399                 </xsl:choose>
1400         </xsl:template>
1401         
1402         <!-- Transforms the contents of the selected node containing a cref into a hyperlink. -->
1403         <xsl:template match="*|@*" mode="cref">
1404                 <xsl:call-template name="makememberlink">
1405                         <xsl:with-param name="cref" select="."/>
1406                 </xsl:call-template>
1407                 <!--
1408                 <a>
1409                         <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
1410                         <xsl:value-of select="substring-after(., ':')"/></a>
1411                         -->
1412         </xsl:template>
1413
1414         <xsl:template name="membertypeplural">
1415                 <xsl:param name="name"/>
1416                 <xsl:choose>
1417                 <xsl:when test="$name='ExtensionMethod'">Extension Methods</xsl:when>
1418                 <xsl:when test="$name='Constructor'">Constructors</xsl:when>
1419                 <xsl:when test="$name='Property'">Properties</xsl:when>
1420                 <xsl:when test="$name='Method'">Methods</xsl:when>
1421                 <xsl:when test="$name='Field'">Fields</xsl:when>
1422                 <xsl:when test="$name='Event'">Events</xsl:when>
1423                 <xsl:when test="$name='Operator'">Operators</xsl:when>
1424                 <xsl:when test="$name='Explicit'">Explicitly Implemented Interface Members</xsl:when>
1425                 </xsl:choose>
1426         </xsl:template>
1427         <xsl:template name="membertypeplurallc">
1428                 <xsl:param name="name"/>
1429                 <xsl:choose>
1430                 <xsl:when test="$name='ExtensionMethod'">extension methods</xsl:when>
1431                 <xsl:when test="$name='Constructor'">constructors</xsl:when>
1432                 <xsl:when test="$name='Property'">properties</xsl:when>
1433                 <xsl:when test="$name='Method'">methods</xsl:when>
1434                 <xsl:when test="$name='Field'">fields</xsl:when>
1435                 <xsl:when test="$name='Event'">events</xsl:when>
1436                 <xsl:when test="$name='Operator'">operators</xsl:when>
1437                 <xsl:when test="$name='Explicit'">explicitly implemented interface members</xsl:when>
1438                 </xsl:choose>
1439         </xsl:template>
1440         <xsl:template name="gettypetype">
1441                 <xsl:variable name="sig" select="concat(' ', TypeSignature[@Language='C#']/@Value, ' ')"/>
1442                 <xsl:choose>
1443                 <xsl:when test="contains($sig,'class')">Class</xsl:when>
1444                 <xsl:when test="contains($sig,'enum')">Enumeration</xsl:when>
1445                 <xsl:when test="contains($sig,'struct')">Structure</xsl:when>
1446                 <xsl:when test="contains($sig,'delegate')">Delegate</xsl:when>
1447                 </xsl:choose>
1448         </xsl:template>
1449
1450         <!-- Ensures that the resuting node is not surrounded by a para tag. -->
1451         <xsl:template match="*|@*" mode="editlink">
1452                 <xsl:call-template name="CreateEditLink">
1453                         <xsl:with-param name="e" select="." />
1454                 </xsl:call-template>
1455         </xsl:template>
1456
1457         <xsl:template match="*" mode="notoppara">
1458                 <xsl:choose>
1459                 <xsl:when test="starts-with (string(.), 'To be added')">
1460                         <span class="NotEntered">Documentation for this section has not yet been entered.</span>
1461                 </xsl:when>
1462                 <xsl:when test="count(*) = 1 and count(para)=1">
1463                         <xsl:apply-templates select="para/node()"/>
1464                 </xsl:when>
1465                 <xsl:otherwise>
1466                         <xsl:apply-templates select="."/>
1467                 </xsl:otherwise>
1468                 </xsl:choose>
1469         </xsl:template>
1470
1471         <xsl:template match="para">
1472                 <p>
1473                         <xsl:apply-templates/>
1474                 </p>
1475         </xsl:template>
1476
1477         <xsl:template match="attribution">
1478                 <a href="http://creativecommons.org/licenses/by/4.0/" class="attributionlogo">
1479                         <xsl:attribute name="title">
1480                                 <xsl:choose>
1481                                         <xsl:when test="@modified='false'"><xsl:value-of select="concat('This content is licensed Creative Commons By ', @from)" /></xsl:when>
1482                                         <xsl:otherwise><xsl:value-of select="concat('This content has been modified under a Creative Commons license from ', @from)" /></xsl:otherwise>
1483                                 </xsl:choose>
1484                         </xsl:attribute>
1485                 <img src="mdocimages/creativecommons.png" /> 
1486                 </a>
1487         </xsl:template>
1488
1489         <xsl:template match="paramref">
1490                 <i><xsl:value-of select="@name"/>
1491                                 <xsl:apply-templates/>
1492                 </i>
1493         </xsl:template>
1494
1495         <xsl:template match="typeparamref">
1496                 <i><xsl:value-of select="@name"/>
1497                                 <xsl:apply-templates/>
1498                 </i>
1499         </xsl:template>
1500
1501         <xsl:template match="block[@type='note']">
1502                 <div>
1503                 <i>Note: </i>
1504                                 <xsl:apply-templates/>
1505                 </div>
1506         </xsl:template>
1507         <xsl:template match="block[@type='behaviors']">
1508                 <h5 class="Subsection">Operation</h5>
1509                 <xsl:apply-templates/>
1510         </xsl:template>
1511         <xsl:template match="block[@type='overrides']">
1512                 <h5 class="Subsection">Note to Inheritors</h5>
1513                 <xsl:apply-templates/>
1514         </xsl:template>
1515         <xsl:template match="block[@type='usage']">
1516                 <h5 class="Subsection">Usage</h5>
1517                 <xsl:apply-templates/>
1518         </xsl:template>
1519
1520         <xsl:template match="c">
1521                 <tt>
1522                         <xsl:apply-templates/>  
1523                 </tt>
1524         </xsl:template>
1525         <xsl:template match="c//para">
1526                 <xsl:apply-templates/><br/>     
1527         </xsl:template>
1528         
1529         <xsl:template match="code">
1530                 <xsl:call-template name="CreateCodeBlock">
1531                         <xsl:with-param name="language" select="@lang" />
1532                         <xsl:with-param name="content" select="string(descendant-or-self::text())" />
1533                 </xsl:call-template>
1534         </xsl:template>
1535         <xsl:template match="img">
1536           <p>
1537                 <img>
1538                   <xsl:attribute name="src">
1539                         <!-- we recognize two types of images:
1540                                    - those with src attribute that reference directly an external image
1541                                    - those with a href attributes which are internally available as part of the doc bundle
1542                         -->
1543                         <xsl:choose>
1544                           <xsl:when test="count(@src)&gt;0">
1545                                 <xsl:value-of select="@src" />
1546                           </xsl:when>
1547                           <xsl:when test="count(@href)&gt;0">
1548                                 <xsl:value-of select="concat('source-id:', $source-id, ':', @href)" />
1549                           </xsl:when>
1550                         </xsl:choose>
1551                   </xsl:attribute>
1552                   <xsl:attribute name="class">
1553                         <xsl:choose>
1554                           <xsl:when test="count(@class)&gt;0">
1555                                 <xsl:value-of select="@class" />
1556                           </xsl:when>
1557                           <xsl:otherwise>picture</xsl:otherwise>
1558                         </xsl:choose>
1559                   </xsl:attribute>
1560                 </img>
1561           </p>
1562         </xsl:template>
1563
1564         <xsl:template match="onequarter">¼</xsl:template>
1565         <xsl:template match="pi">Ï€</xsl:template>
1566         <xsl:template match="theta">θ</xsl:template>
1567         <xsl:template match="leq">≤</xsl:template>
1568         <xsl:template match="geq">≥</xsl:template>
1569         <xsl:template match="subscript">
1570                 <sub><xsl:value-of select="@term"/></sub>
1571         </xsl:template>
1572         <xsl:template match="superscript">
1573                 <sup><xsl:value-of select="@term"/></sup>
1574         </xsl:template>
1575
1576         <!-- tabular data
1577                 example:
1578
1579                         <list type="table">
1580                                 <listheader>
1581                                         <term>First Col Header</term>
1582                                         <description>Second Col Header</description>
1583                                         <description>Third Col Header</description>
1584                                 </listheader>
1585                                 <item>
1586                                         <term>First Row First Col</term>
1587                                         <description>First Row Second Col</description>
1588                                         <description>First Row Third Col</description>
1589                                 </item>
1590                                 <item>
1591                                         <term>Second Row First Col</term>
1592                                         <description>Second Row Second Col</description>
1593                                         <description>Second Row Third Col</description>
1594                                 </item>
1595                         </list>
1596         -->
1597
1598         <xsl:template match="list[@type='table']">
1599                 <xsl:call-template name="CreateListTable">
1600                 <xsl:with-param name="header">
1601                         <th><xsl:apply-templates select="listheader/term" mode="notoppara"/></th>
1602                         <xsl:for-each select="listheader/description">
1603                                 <th><xsl:apply-templates mode="notoppara"/></th>
1604                         </xsl:for-each>
1605                 </xsl:with-param>
1606
1607                 <xsl:with-param name="content">
1608                 <xsl:for-each select="item">
1609                         <tr valign="top">
1610                         <td>
1611                                 <xsl:apply-templates select="term" mode="notoppara"/>
1612                         </td>
1613                         <xsl:for-each select="description">
1614                                 <td>
1615                                         <xsl:apply-templates mode="notoppara"/>
1616                                 </td>
1617                         </xsl:for-each>
1618                         </tr>
1619                 </xsl:for-each>
1620                 </xsl:with-param>
1621                 </xsl:call-template>
1622         </xsl:template>
1623
1624         <xsl:template match="list[@type='bullet']">
1625                 <ul>
1626                         <xsl:for-each select="item">
1627                                 <li>
1628                                         <xsl:apply-templates select="term" mode="notoppara"/>
1629                                         <xsl:apply-templates select="para" mode="notoppara"/>
1630                                 </li>
1631                         </xsl:for-each>
1632                 </ul>
1633         </xsl:template>
1634         <xsl:template match="list[@type='number']">
1635                 <ol>
1636                         <xsl:for-each select="item">
1637                                 <li>
1638                                         <xsl:apply-templates select="term" mode="notoppara"/>
1639                                 </li>
1640                         </xsl:for-each>
1641                 </ol>
1642         </xsl:template>
1643
1644         <xsl:template match="list">
1645                 [<i>The '<xsl:value-of select="@type"/>' type of list has not been implemented in the ECMA stylesheet.</i>]
1646                 
1647                 <xsl:message>
1648                 [<i>The '<xsl:value-of select="@type"/>' type of list has not been implemented in the ECMA stylesheet.</i>]
1649                 </xsl:message>
1650         </xsl:template>
1651
1652         <xsl:template match="see[@cref]">
1653                 <xsl:choose>
1654                 <xsl:when test="not(substring-after(@cref, 'T:')='')">
1655                         <xsl:call-template name="maketypelink">
1656                                 <xsl:with-param name="type" select="normalize-space (@cref)"/>
1657                         </xsl:call-template>
1658                 </xsl:when>
1659                 <xsl:when test="not(substring-after(@cref, 'N:')='')">
1660                         <xsl:call-template name="makenamespacelink">
1661                                 <xsl:with-param name="cref" select="normalize-space (@cref)"/>
1662                         </xsl:call-template>
1663                 </xsl:when>
1664                 <xsl:otherwise>
1665                         <xsl:call-template name="makememberlink">
1666                                 <xsl:with-param name="cref" select="normalize-space (@cref)"/>
1667                         </xsl:call-template>
1668                 </xsl:otherwise>
1669                 </xsl:choose>
1670         </xsl:template>
1671
1672         <xsl:template match="see[@langword]">
1673                 <tt><xsl:value-of select="@langword"/></tt>
1674         </xsl:template>
1675         
1676         <xsl:template name="GetInheritedMembers">
1677                 <xsl:param name="declaringtype"/>
1678                 <xsl:param name="generictypereplacements"/>
1679                 <xsl:param name="listmembertype"/>
1680                 <xsl:param name="showprotected"/>
1681                 <xsl:param name="overloads-mode" select="false()" />
1682                 <xsl:param name="showstatic" select='1'/>
1683
1684                 <xsl:choose>
1685                 <xsl:when test="$listmembertype='ExtensionMethod' and $showprotected=false()">
1686                         <xsl:for-each select="$declaringtype/Members/Member[MemberType=$listmembertype]">
1687                                 <Members Name="Link/@Type" FullName="Link/@Type">
1688                                         <Member MemberName="{@MemberName}">
1689                                                 <xsl:attribute name="ExplicitMemberName">
1690                                                         <xsl:call-template name="GetMemberNameWithoutGenericTypes">
1691                                                                 <xsl:with-param name="m" select="@MemberName" />
1692                                                         </xsl:call-template>
1693                                                 </xsl:attribute>
1694                                                 <xsl:attribute name="TypeParameters">
1695                                                         <xsl:call-template name="GetTypeParameterNames">
1696                                                                 <xsl:with-param name="member" select="." />
1697                                                         </xsl:call-template>
1698                                                 </xsl:attribute>
1699                                                 <xsl:attribute name="Parameters">
1700                                                         <xsl:call-template name="GetParameterTypes">
1701                                                                 <xsl:with-param name="member" select="." />
1702                                                         </xsl:call-template>
1703                                                 </xsl:attribute>
1704                                                 <xsl:copy-of select="./*" />
1705                                         </Member>
1706                                 </Members>
1707                         </xsl:for-each>
1708                 </xsl:when>
1709                 <xsl:otherwise>
1710                 <Members Name="{$declaringtype/@Name}" FullName="{$declaringtype/@FullName}">
1711                 
1712                 <xsl:copy-of select="$generictypereplacements"/>
1713
1714                 <!-- Get all members in this type that are of listmembertype and are either
1715                         protected or not protected according to showprotected. -->
1716                 <xsl:choose>
1717                         <xsl:when test="$listmembertype = 'Explicit'">
1718                                 <xsl:for-each select="$declaringtype/Members/Member
1719                                                 [MemberType != 'Constructor']
1720                                                 [contains (@MemberName, '.')]">
1721                                         <Member MemberName="{@MemberName}">
1722                                                 <xsl:attribute name="ExplicitMemberName">
1723                                                         <xsl:call-template name="GetMemberName">
1724                                                                 <xsl:with-param name="type" select="@MemberName" />
1725                                                                 <xsl:with-param name="isproperty" select="$listmembertype = 'Property'"/>
1726                                                         </xsl:call-template>
1727                                                 </xsl:attribute>
1728                                                 <xsl:attribute name="TypeParameters">
1729                                                         <xsl:call-template name="GetTypeParameterNames">
1730                                                                 <xsl:with-param name="member" select="." />
1731                                                         </xsl:call-template>
1732                                                 </xsl:attribute>
1733                                                 <xsl:attribute name="Parameters">
1734                                                         <xsl:call-template name="GetParameterTypes">
1735                                                                 <xsl:with-param name="member" select="." />
1736                                                         </xsl:call-template>
1737                                                 </xsl:attribute>
1738                                                 <xsl:copy-of select="./*" />
1739                                         </Member>
1740                                 </xsl:for-each>
1741                         </xsl:when>
1742                         <xsl:otherwise>
1743                                 <xsl:for-each select="$declaringtype/Members/Member
1744                                         [(MemberType=$listmembertype or ($listmembertype='Operator' and MemberType='Method'))]
1745                                         [(not($overloads-mode) or @MemberName=$index or 
1746                                                 ($index='Conversion' and (@MemberName='op_Implicit' or @MemberName='op_Explicit'))) ]
1747                                         [$showprotected=starts-with(MemberSignature[@Language='C#']/@Value, 'protected ')]
1748                                         [($listmembertype='Method' and not(starts-with(@MemberName,'op_')))
1749                                                 or ($listmembertype='Operator' and starts-with(@MemberName,'op_'))
1750                                                 or (not($listmembertype='Method') and not($listmembertype='Operator'))]
1751                                         [$showstatic or not(contains(MemberSignature[@Language='C#']/@Value,' static '))]
1752                                         [$listmembertype = 'Constructor' or not(contains(@MemberName, '.'))]
1753                                         ">
1754                                         <Member MemberName="{@MemberName}">
1755                                                 <xsl:attribute name="ExplicitMemberName">
1756                                                         <xsl:call-template name="GetMemberNameWithoutGenericTypes">
1757                                                                 <xsl:with-param name="m" select="@MemberName" />
1758                                                         </xsl:call-template>
1759                                                 </xsl:attribute>
1760                                                 <xsl:attribute name="TypeParameters">
1761                                                         <xsl:call-template name="GetTypeParameterNames">
1762                                                                 <xsl:with-param name="member" select="." />
1763                                                         </xsl:call-template>
1764                                                 </xsl:attribute>
1765                                                 <xsl:attribute name="Parameters">
1766                                                         <xsl:call-template name="GetParameterTypes">
1767                                                                 <xsl:with-param name="member" select="." />
1768                                                         </xsl:call-template>
1769                                                 </xsl:attribute>
1770                                                 <xsl:copy-of select="./*" />
1771                                         </Member>
1772                                 </xsl:for-each>
1773                         </xsl:otherwise>
1774                 </xsl:choose>
1775
1776                 <Docs>
1777                         <xsl:copy-of select="$declaringtype/Docs/typeparam" />
1778                 </Docs>
1779                         
1780                 </Members>
1781                 </xsl:otherwise>
1782                 </xsl:choose>
1783
1784                 <xsl:if test="not($listmembertype='Constructor') and count($declaringtype/Base/BaseTypeName)=1">
1785                         <xsl:variable name="basedocsfile">
1786                                 <xsl:call-template name="GetLinkTarget">
1787                                         <xsl:with-param name="type">
1788                                                 <xsl:call-template name="GetEscapedTypeName">
1789                                                         <xsl:with-param name="typename" select="$declaringtype/Base/BaseTypeName" />
1790                                                 </xsl:call-template>
1791                                         </xsl:with-param>
1792                                         <xsl:with-param name="cref">
1793                                         </xsl:with-param>
1794                                         <xsl:with-param name="local-suffix" />
1795                                         <xsl:with-param name="remote"/>
1796                                         <xsl:with-param name="xmltarget" select='1'/>
1797                                 </xsl:call-template>
1798                         </xsl:variable>
1799
1800                         <xsl:if test="not(string($basedocsfile) = '')">
1801                                 <xsl:call-template name="GetInheritedMembers">
1802                                         <xsl:with-param name="listmembertype" select="$listmembertype"/>
1803                                         <xsl:with-param name="showprotected" select="$showprotected"/>
1804                                         <xsl:with-param name="declaringtype" select="document(string($basedocsfile),.)/Type"/>
1805                                         <xsl:with-param name="generictypereplacements" select="$declaringtype/Base/BaseTypeArguments/*"/>
1806                                         <xsl:with-param name="showstatic" select='0'/>
1807                                 </xsl:call-template>
1808                         </xsl:if>
1809                 </xsl:if>
1810         </xsl:template>
1811
1812         <xsl:template name="GetMemberNameWithoutGenericTypes">
1813                 <xsl:param name="m" />
1814                 <xsl:choose>
1815                         <xsl:when test="contains ($m, '&lt;')">
1816                                 <xsl:value-of select="substring-before ($m, '&lt;')" />
1817                         </xsl:when>
1818                         <xsl:otherwise>
1819                                 <xsl:value-of select="$m" />
1820                         </xsl:otherwise>
1821                 </xsl:choose>
1822         </xsl:template>
1823         
1824         <xsl:template name="GetTypeParameterNames">
1825                 <xsl:param name="member" />
1826
1827                 <xsl:for-each select="$member/TypeParameters/TypeParameter">
1828                         <xsl:if test="not(position()=1)">, </xsl:if>
1829                         <xsl:value-of select="@Name" />
1830                 </xsl:for-each>
1831         </xsl:template>
1832         
1833         <xsl:template name="GetParameterTypes">
1834                 <xsl:param name="member" />
1835
1836                 <xsl:for-each select="$member/Parameters/Parameter">
1837                         <xsl:if test="not(position()=1)">, </xsl:if>
1838                         <xsl:value-of select="@Type" />
1839                 </xsl:for-each>
1840         </xsl:template>
1841         
1842         <xsl:template name="ListAllMembers">
1843                 <xsl:param name="html-anchor" select="false()" />
1844
1845                 <xsl:call-template name="ListMembers">
1846                         <xsl:with-param name="listmembertype" select="'Constructor'"/>
1847                         <xsl:with-param name="showprotected" select="false()"/>
1848                         <xsl:with-param name="html-anchor" select="$html-anchor" />
1849                 </xsl:call-template>
1850
1851                 <xsl:call-template name="ListMembers">
1852                         <xsl:with-param name="listmembertype" select="'Constructor'"/>
1853                         <xsl:with-param name="showprotected" select="true()"/>
1854                         <xsl:with-param name="html-anchor" select="$html-anchor" />
1855                 </xsl:call-template>
1856
1857                 <xsl:call-template name="ListMembers">
1858                         <xsl:with-param name="listmembertype" select="'Field'"/>
1859                         <xsl:with-param name="showprotected" select="false()"/>
1860                         <xsl:with-param name="html-anchor" select="$html-anchor" />
1861                 </xsl:call-template>
1862
1863                 <xsl:call-template name="ListMembers">
1864                         <xsl:with-param name="listmembertype" select="'Field'"/>
1865                         <xsl:with-param name="showprotected" select="true()"/>
1866                         <xsl:with-param name="html-anchor" select="$html-anchor" />
1867                 </xsl:call-template>
1868
1869                 <xsl:call-template name="ListMembers">
1870                         <xsl:with-param name="listmembertype" select="'Property'"/>
1871                         <xsl:with-param name="showprotected" select="false()"/>
1872                         <xsl:with-param name="html-anchor" select="$html-anchor" />
1873                 </xsl:call-template>
1874
1875                 <xsl:call-template name="ListMembers">
1876                         <xsl:with-param name="listmembertype" select="'Property'"/>
1877                         <xsl:with-param name="showprotected" select="true()"/>
1878                         <xsl:with-param name="html-anchor" select="$html-anchor" />
1879                 </xsl:call-template>
1880
1881                 <xsl:call-template name="ListMembers">
1882                         <xsl:with-param name="listmembertype" select="'Method'"/>
1883                         <xsl:with-param name="showprotected" select="false()"/>
1884                         <xsl:with-param name="html-anchor" select="$html-anchor" />
1885                 </xsl:call-template>
1886
1887                 <xsl:call-template name="ListMembers">
1888                         <xsl:with-param name="listmembertype" select="'Method'"/>
1889                         <xsl:with-param name="showprotected" select="true()"/>
1890                         <xsl:with-param name="html-anchor" select="$html-anchor" />
1891                 </xsl:call-template>
1892
1893                 <xsl:call-template name="ListMembers">
1894                         <xsl:with-param name="listmembertype" select="'Event'"/>
1895                         <xsl:with-param name="showprotected" select="false()"/>
1896                         <xsl:with-param name="html-anchor" select="$html-anchor" />
1897                 </xsl:call-template>
1898
1899                 <xsl:call-template name="ListMembers">
1900                         <xsl:with-param name="listmembertype" select="'Event'"/>
1901                         <xsl:with-param name="showprotected" select="true()"/>
1902                         <xsl:with-param name="html-anchor" select="$html-anchor" />
1903                 </xsl:call-template>
1904
1905                 <xsl:call-template name="ListMembers">
1906                         <xsl:with-param name="listmembertype" select="'Operator'"/>
1907                         <xsl:with-param name="showprotected" select="false()"/>
1908                         <xsl:with-param name="html-anchor" select="$html-anchor" />
1909                 </xsl:call-template>
1910
1911                 <xsl:call-template name="ListMembers">
1912                         <xsl:with-param name="listmembertype" select="'Explicit'"/>
1913                         <xsl:with-param name="showprotected" select="true()"/>
1914                         <xsl:with-param name="html-anchor" select="$html-anchor" />
1915                 </xsl:call-template>
1916
1917                 <xsl:call-template name="ListMembers">
1918                         <xsl:with-param name="listmembertype" select="'ExtensionMethod'"/>
1919                         <xsl:with-param name="showprotected" select="false()"/>
1920                         <xsl:with-param name="html-anchor" select="$html-anchor" />
1921                 </xsl:call-template>
1922         </xsl:template>
1923
1924         <!-- Lists the members in the current Type node.
1925                  Only lists members of type listmembertype.
1926                  Displays the signature in siglanguage.
1927                  showprotected = true() or false()
1928         -->
1929         <xsl:template name="ListMembers">
1930                 <xsl:param name="listmembertype"/>
1931                 <xsl:param name="showprotected"/>
1932                 <xsl:param name="overloads-mode" select="false()" />
1933                 <xsl:param name="html-anchor" select="false()" />
1934
1935                 <!-- get name and namespace of current type -->
1936                 <xsl:variable name="TypeFullName" select="@FullName"/>
1937                 <xsl:variable name="TypeName" select="@Name"/>          
1938                 <xsl:variable name="TypeNamespace" select="substring-before(@FullName, concat('.',@Name))"/>
1939                 
1940                 <xsl:variable name="MEMBERS-rtf">
1941                         <xsl:call-template name="GetInheritedMembers">
1942                                 <xsl:with-param name="listmembertype" select="$listmembertype"/>
1943                                 <xsl:with-param name="showprotected" select="$showprotected"/>
1944                                 <xsl:with-param name="declaringtype" select="."/>
1945                                 <xsl:with-param name="overloads-mode" select="$overloads-mode" />
1946                         </xsl:call-template>
1947                 </xsl:variable>
1948                 <xsl:variable name="MEMBERS" select="msxsl:node-set($MEMBERS-rtf)" />
1949                 
1950                 <!--
1951                 <xsl:variable name="MEMBERS" select="
1952                         $ALLMEMBERS/Member
1953                         [(MemberType=$listmembertype or ($listmembertype='Operator' and MemberType='Method'))]
1954                         [$showprotected=contains(MemberSignature[@Language='C#']/@Value,'protected')]
1955                         [($listmembertype='Method' and not(starts-with(@MemberName,'op_')))
1956                                 or ($listmembertype='Operator' and starts-with(@MemberName,'op_'))
1957                                 or (not($listmembertype='Method') and not($listmembertype='Operator'))]
1958                         "/>
1959                 -->
1960                 
1961                 <!-- if there aren't any, skip this -->
1962                 <xsl:if test="count($MEMBERS//Member)">
1963
1964                 <xsl:variable name="SectionName">
1965                         <xsl:if test="$listmembertype != 'Explicit' and $listmembertype != 'ExtensionMethod'">
1966                                 <xsl:if test="$showprotected">Protected </xsl:if>
1967                                 <xsl:if test="not($showprotected)">Public </xsl:if>
1968                         </xsl:if>
1969                         <xsl:call-template name="membertypeplural"><xsl:with-param name="name" select="$listmembertype"/></xsl:call-template>
1970                 </xsl:variable>
1971
1972                 <!-- header -->
1973                 <xsl:call-template name="CreateH2Section">
1974                         <xsl:with-param name="name" select="$SectionName" />
1975                         <xsl:with-param name="child-id" select="$SectionName" />
1976                         <xsl:with-param name="content">
1977                                 <div class="SubsectionBox">
1978                                 <xsl:call-template name="CreateMembersTable">
1979                                 <xsl:with-param name="content">
1980
1981                                 <xsl:for-each select="$MEMBERS/Members/Member">
1982                                         <!--<xsl:sort select="contains(MemberSignature[@Language='C#']/@Value,' static ')" data-type="text"/>-->
1983                                         <xsl:sort select="@MemberName = 'op_Implicit' or @MemberName = 'op_Explicit'"/>
1984                                         <xsl:sort select="@ExplicitMemberName" data-type="text"/>
1985                                         <xsl:sort select="count(TypeParameters/TypeParameter)"/>
1986                                         <xsl:sort select="@TypeParameters"/>
1987                                         <xsl:sort select="count(Parameters/Parameter)"/>
1988                                         <xsl:sort select="@Parameters"/>
1989                                         
1990                                         <xsl:variable name="local-id">
1991                                                 <xsl:choose>
1992                                                         <xsl:when test="count(Link) = 1">
1993                                                                 <xsl:value-of select="Link/@Member" />
1994                                                         </xsl:when>
1995                                                         <xsl:otherwise>
1996                                                                 <xsl:call-template name="GetLinkId" >
1997                                                                         <xsl:with-param name="type" select="parent::Members" />
1998                                                                         <xsl:with-param name="member" select="." />
1999                                                                 </xsl:call-template>
2000                                                         </xsl:otherwise>
2001                                                 </xsl:choose>
2002                                         </xsl:variable>
2003
2004                                         <xsl:variable name="linkfile">
2005                                                 <xsl:if test="not(parent::Members/@FullName = $TypeFullName)">
2006                                                         <xsl:call-template name="GetLinkTargetHtml">
2007                                                                 <xsl:with-param name="type">
2008                                                                         <xsl:choose>
2009                                                                                 <xsl:when test="count(Link) = 1">
2010                                                                                         <xsl:value-of select="Link/@Type"/>
2011                                                                                 </xsl:when>
2012                                                                                 <xsl:otherwise>
2013                                                                                         <xsl:call-template name="GetEscapedTypeName">
2014                                                                                                 <xsl:with-param name="typename" select="parent::Members/@FullName" />
2015                                                                                         </xsl:call-template>
2016                                                                                 </xsl:otherwise>
2017                                                                         </xsl:choose>
2018                                                                 </xsl:with-param>
2019                                                                 <xsl:with-param name="cref" />
2020                                                         </xsl:call-template>
2021                                                 </xsl:if>
2022                                         </xsl:variable>
2023
2024                                         <xsl:variable name="linkid">
2025                                                 <xsl:if test="$html-anchor">
2026                                                         <xsl:value-of select="$linkfile" />
2027                                                         <xsl:text>#</xsl:text>
2028                                                 </xsl:if>
2029                                                 <xsl:value-of select="$local-id" />
2030                                         </xsl:variable>
2031                                         
2032                                         <xsl:variable name="isinherited">
2033                                                 <xsl:if test="$listmembertype != 'ExtensionMethod' and not(parent::Members/@FullName = $TypeFullName)">
2034                                                         <xsl:text> (</xsl:text>
2035                                                         <i>
2036                                                         <xsl:text>Inherited from </xsl:text>
2037                                                         <xsl:call-template name="maketypelink">
2038                                                                 <xsl:with-param name="type" select="parent::Members/@FullName"/>
2039                                                                 <xsl:with-param name="wrt" select="$TypeNamespace"/>
2040                                                         </xsl:call-template>
2041                                                         <xsl:text>.</xsl:text>
2042                                                         </i>
2043                                                         <xsl:text>)</xsl:text>
2044                                                 </xsl:if>
2045                                         </xsl:variable>
2046
2047                                         <tr valign="top">
2048                                                 <td>
2049                                                         <!-- random info -->
2050
2051                                                         <!-- check if it has get and set accessors -->
2052                                                         <xsl:if test="MemberType='Property' and not(contains(MemberSignature[@Language='C#']/@Value, 'set;'))">
2053                                                                 <xsl:text>[read-only]</xsl:text>
2054                                                         </xsl:if>
2055                                                         <xsl:if test="MemberType='Property' and not(contains(MemberSignature[@Language='C#']/@Value, 'get;'))">
2056                                                                 <xsl:text>[write-only]</xsl:text>
2057                                                         </xsl:if>
2058
2059                                                         <xsl:if test="contains(MemberSignature[@Language='C#']/@Value,'this[')">
2060                                                                 <div><i>default property</i></div>
2061                                                         </xsl:if>
2062
2063                                                         <div>
2064                                                         <xsl:call-template name="getmodifiers">
2065                                                                 <xsl:with-param name="sig" select="MemberSignature[@Language='C#']/@Value"/>
2066                                                                 <xsl:with-param name="protection" select="false()"/>
2067                                                                 <xsl:with-param name="inheritance" select="true()"/>
2068                                                                 <xsl:with-param name="extra" select="false()"/>
2069                                                         </xsl:call-template>
2070                                                         </div>
2071                                                 </td>
2072
2073                                         <xsl:choose>
2074                                                 <!-- constructor listing -->
2075                                                 <xsl:when test="MemberType='Constructor'">
2076                                                         <!-- link to constructor page -->
2077                                                         <td>
2078                                                         <div>
2079                                                         <b>
2080                                                         <a href="{$linkid}">
2081                                                                 <xsl:call-template name="GetConstructorName">
2082                                                                         <xsl:with-param name="type" select="parent::Members" />
2083                                                                         <xsl:with-param name="ctor" select="." />
2084                                                                 </xsl:call-template>
2085                                                         </a>
2086                                                         </b>
2087
2088                                                         <!-- argument list -->
2089                                                         <xsl:value-of select="'('"/>
2090                                                                 <xsl:for-each select="Parameters/Parameter">
2091                                                                         <xsl:if test="not(position()=1)">, </xsl:if>
2092                                                                         
2093                                                                         <xsl:call-template name="ShowParameter">
2094                                                                                 <xsl:with-param name="Param" select="."/>
2095                                                                                 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
2096                                                                                 <xsl:with-param name="prototype" select="true()"/>
2097                                                                         </xsl:call-template>
2098                                                                 </xsl:for-each>
2099                                                         <xsl:value-of select="')'"/>
2100                                                         </div>
2101
2102                                                         <!-- TODO: $implemented? -->
2103
2104                                                         </td>
2105                                                 </xsl:when>
2106
2107                                                 <xsl:when test="$listmembertype = 'Explicit'">
2108                                                         <td>
2109                                                                 <a href="{$linkid}">
2110                                                                         <b>
2111                                                                                 <xsl:call-template name="GetMemberDisplayName">
2112                                                                                         <xsl:with-param name="memberName" select="@MemberName" />
2113                                                                                         <xsl:with-param name="isproperty" select="MemberType='Property'" />
2114                                                                                 </xsl:call-template>
2115                                                                         </b>
2116                                                                 </a>
2117                                                         </td>
2118                                                 </xsl:when>
2119
2120                                                 <!-- field, property and event listing -->
2121                                                 <xsl:when test="MemberType='Field' or MemberType='Property' or MemberType='Event'">
2122                                                         <td>
2123
2124                                                         <!-- link to member page -->
2125                                                         <b>
2126                                                         <a href="{$linkid}">
2127                                                                 <xsl:call-template name="GetMemberDisplayName">
2128                                                                         <xsl:with-param name="memberName" select="@MemberName" />
2129                                                                         <xsl:with-param name="isproperty" select="MemberType='Property'" />
2130                                                                 </xsl:call-template>
2131                                                         </a>
2132                                                         </b>
2133
2134                                                         <!-- argument list for accessors -->
2135                                                         <xsl:if test="Parameters/Parameter">
2136                                                         <xsl:value-of select="'('"/>
2137                                                                 <xsl:for-each select="Parameters/Parameter">
2138                                                                         <xsl:if test="not(position()=1)">, </xsl:if>
2139                                                                         
2140                                                                         <xsl:call-template name="ShowParameter">
2141                                                                                 <xsl:with-param name="Param" select="."/>
2142                                                                                 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
2143                                                                                 <xsl:with-param name="prototype" select="true()"/>
2144                                                                         </xsl:call-template>
2145
2146                                                                 </xsl:for-each>
2147                                                         <xsl:value-of select="')'"/>
2148                                                         </xsl:if>
2149
2150                                                         </td>
2151                                                 </xsl:when>
2152
2153                                                 <!-- method listing -->
2154                                                 <xsl:when test="$listmembertype='Method' or $listmembertype = 'ExtensionMethod'">
2155                                                         <td colspan="2">
2156
2157                                                         <!-- link to method page -->
2158                                                         <b>
2159                                                         <a href="{$linkid}">
2160                                                                 <xsl:call-template name="GetMemberDisplayName">
2161                                                                         <xsl:with-param name="memberName" select="@MemberName" />
2162                                                                         <xsl:with-param name="isproperty" select="MemberType='Property'" />
2163                                                                 </xsl:call-template>
2164                                                         </a>
2165                                                         </b>
2166
2167                                                         <!-- argument list -->
2168                                                         <xsl:value-of select="'('"/>
2169                                                                 <xsl:for-each select="Parameters/Parameter">
2170                                                                         <xsl:if test="not(position()=1)">, </xsl:if>
2171                                                                         
2172                                                                         <xsl:call-template name="ShowParameter">
2173                                                                                 <xsl:with-param name="Param" select="."/>
2174                                                                                 <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
2175                                                                                 <xsl:with-param name="prototype" select="true()"/>
2176                                                                         </xsl:call-template>
2177
2178                                                                 </xsl:for-each>
2179                                                         <xsl:value-of select="')'"/>
2180
2181                                                         <!-- return type -->
2182                                                         <xsl:if test="not(ReturnValue/ReturnType='System.Void')">
2183                                                                 <nobr>
2184                                                                 <xsl:text> : </xsl:text>
2185                                                                 <xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>
2186                                                                 </nobr>
2187                                                         </xsl:if>
2188
2189                                                         <blockquote>
2190                                                                 <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
2191                                                                 <xsl:copy-of select="$isinherited"/>
2192                                                         </blockquote>
2193                                                         </td>
2194                                                 </xsl:when>
2195
2196                                                 <xsl:when test="$listmembertype='Operator'">
2197                                                         <td>
2198
2199                                                         <!-- link to operator page -->
2200                                                         <xsl:choose>
2201                                                         <xsl:when test="@MemberName='op_Implicit' or @MemberName='op_Explicit'">
2202                                                                 <b>
2203                                                                 <a href="{$linkid}">
2204                                                                         <xsl:text>Conversion</xsl:text>
2205                                                                         <xsl:choose>
2206                                                                         <xsl:when test="ReturnValue/ReturnType = //Type/@FullName">
2207                                                                                 <xsl:text> From </xsl:text>
2208                                                                                 <xsl:value-of select="Parameters/Parameter/@Type"/>
2209                                                                         </xsl:when>
2210                                                                         <xsl:otherwise>
2211                                                                                 <xsl:text> to </xsl:text>
2212                                                                                 <xsl:value-of select="ReturnValue/ReturnType"/>
2213                                                                         </xsl:otherwise>
2214                                                                         </xsl:choose>
2215                                                                 </a>
2216                                                                 </b>                                            
2217
2218                                                                 <xsl:choose>
2219                                                                 <xsl:when test="@MemberName='op_Implicit'">
2220                                                                         <xsl:text>(Implicit)</xsl:text>
2221                                                                 </xsl:when>
2222                                                                 <xsl:otherwise>
2223                                                                         <xsl:text>(Explicit)</xsl:text>
2224                                                                 </xsl:otherwise>
2225                                                                 </xsl:choose>
2226                                                         </xsl:when>
2227                                                         <xsl:when test="count(Parameters/Parameter)=1">
2228                                                                 <b>
2229                                                                 <a href="{$linkid}">
2230                                                                         <xsl:value-of select="substring-after(@MemberName, 'op_')"/>
2231                                                                 </a>
2232                                                                 </b>
2233                                                         </xsl:when>
2234                                                         <xsl:otherwise>
2235                                                                 <b>
2236                                                                 <a href="{$linkid}">
2237                                                                         <xsl:value-of select="substring-after(@MemberName, 'op_')"/>
2238                                                                 </a>
2239                                                                 </b>
2240                                                                 <xsl:value-of select="'('"/>
2241                                                                         <xsl:for-each select="Parameters/Parameter">
2242                                                                                 <xsl:if test="not(position()=1)">, </xsl:if>
2243                                                                                 
2244                                                                                 <xsl:call-template name="ShowParameter">
2245                                                                                         <xsl:with-param name="Param" select="."/>
2246                                                                                         <xsl:with-param name="TypeNamespace" select="$TypeNamespace"/>
2247                                                                                         <xsl:with-param name="prototype" select="true()"/>
2248                                                                                 </xsl:call-template>
2249                         
2250                                                                         </xsl:for-each>
2251                                                                 <xsl:value-of select="')'"/>
2252                                                         </xsl:otherwise>
2253                                                         </xsl:choose>
2254                                                         </td>
2255                                                 </xsl:when>
2256                                                 
2257                                                 <xsl:otherwise>
2258                                                         <!-- Other types: just provide a link -->
2259                                                         <td>
2260                                                         <a href="{$linkid}">
2261                                                                 <xsl:call-template name="GetMemberDisplayName">
2262                                                                         <xsl:with-param name="memberName" select="@MemberName" />
2263                                                                         <xsl:with-param name="isproperty" select="MemberType='Property'" />
2264                                                                 </xsl:call-template>
2265                                                         </a>
2266                                                         </td>
2267                                                 </xsl:otherwise>
2268                                         </xsl:choose>
2269
2270                                         <xsl:if test="$listmembertype != 'Method' and $listmembertype != 'ExtensionMethod'">
2271                                                 <td>
2272                                                         <!-- description -->
2273                                                         <xsl:if test="MemberType='Field' or MemberType = 'Property'">
2274                                                                 <i><xsl:apply-templates select="ReturnValue/ReturnType" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates></i>
2275                                                                 <xsl:if test="MemberValue"> (<xsl:value-of select="MemberValue"/>)</xsl:if>
2276                                                                 <xsl:text>. </xsl:text>
2277                                                         </xsl:if>
2278
2279                                                         <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
2280                                                         <xsl:copy-of select="$isinherited"/>
2281                                                 </td>
2282                                         </xsl:if>
2283                                         
2284                                         </tr>
2285                                 </xsl:for-each>
2286
2287                                 </xsl:with-param>
2288                                 </xsl:call-template>
2289                                 </div>
2290                         </xsl:with-param>
2291                 </xsl:call-template>
2292
2293                 </xsl:if>
2294
2295         </xsl:template>
2296
2297         <xsl:template name="GetLinkName">
2298                 <xsl:param name="type"/>
2299                 <xsl:param name="member"/>
2300                 <xsl:call-template name="memberlinkprefix">
2301                         <xsl:with-param name="member" select="$member"/>
2302                 </xsl:call-template>
2303                 <xsl:text>:</xsl:text>
2304                 <xsl:call-template name="GetEscapedTypeName">
2305                         <xsl:with-param name="typename" select="$type/@FullName" />
2306                 </xsl:call-template>
2307                 <xsl:if test="$member/MemberType != 'Constructor'">
2308                         <xsl:text>.</xsl:text>
2309                         <xsl:variable name="memberName">
2310                                 <xsl:call-template name="GetGenericName">
2311                                         <xsl:with-param name="membername" select="$member/@MemberName" />
2312                                         <xsl:with-param name="member" select="$member" />
2313                                 </xsl:call-template>
2314                         </xsl:variable>
2315                         <xsl:call-template name="Replace">
2316                                 <xsl:with-param name="s">
2317                                         <xsl:call-template name="ToBraces">
2318                                                 <xsl:with-param name="s" select="$memberName" />
2319                                         </xsl:call-template>
2320                                 </xsl:with-param>
2321                                 <xsl:with-param name="from">.</xsl:with-param>
2322                                 <xsl:with-param name="to">#</xsl:with-param>
2323                         </xsl:call-template>
2324                 </xsl:if>
2325         </xsl:template>
2326
2327         <xsl:template name="GetGenericName">
2328                 <xsl:param name="membername" />
2329                 <xsl:param name="member" />
2330                 <xsl:variable name="numgenargs" select="count($member/Docs/typeparam)" />
2331                 <xsl:choose>
2332                         <xsl:when test="$numgenargs = 0">
2333                                 <xsl:value-of select="$membername" />
2334                         </xsl:when>
2335                         <xsl:otherwise>
2336                                 <xsl:if test="contains($membername, '&lt;')">
2337                                         <xsl:value-of select="substring-before ($membername, '&lt;')" />
2338                                 </xsl:if>
2339                                 <xsl:text>``</xsl:text>
2340                                 <xsl:value-of select="$numgenargs" />
2341                         </xsl:otherwise>
2342                 </xsl:choose>
2343         </xsl:template>
2344
2345         <xsl:template name="GetEscapedTypeName">
2346                 <xsl:param name="typename" />
2347                 <xsl:variable name="base" select="substring-before ($typename, '&lt;')" />
2348
2349                 <xsl:choose>
2350                         <xsl:when test="$base != ''">
2351                                 <xsl:value-of select="translate ($base, '+', '.')" />
2352                                 <xsl:text>`</xsl:text>
2353                                 <xsl:call-template name="GetGenericArgumentCount">
2354                                         <xsl:with-param name="arglist" select="substring-after ($typename, '&lt;')" />
2355                                         <xsl:with-param name="count">1</xsl:with-param>
2356                                 </xsl:call-template>
2357                         </xsl:when>
2358                         <xsl:otherwise><xsl:value-of select="translate ($typename, '+', '.')" /></xsl:otherwise>
2359                 </xsl:choose>
2360         </xsl:template>
2361
2362         <xsl:template name="GetGenericArgumentCount">
2363                 <xsl:param name="arglist" />
2364                 <xsl:param name="count" />
2365
2366                 <xsl:variable name="rest-rtf">
2367                         <xsl:call-template name="SkipTypeArgument">
2368                                 <xsl:with-param name="s" select="$arglist" />
2369                         </xsl:call-template>
2370                 </xsl:variable>
2371                 <xsl:variable name="rest" select="string($rest-rtf)" />
2372
2373                 <xsl:choose>
2374                         <xsl:when test="$arglist != '' and $rest = ''">
2375                                 <xsl:value-of select="$count" />
2376                         </xsl:when>
2377                         <xsl:when test="$arglist = '' and $rest = ''">
2378                                 <xsl:message terminate="yes">
2379 !WTF? arglist=<xsl:value-of select="$arglist" />; rest=<xsl:value-of select="$rest" />
2380                                 </xsl:message>
2381                         </xsl:when>
2382                         <xsl:when test="starts-with ($rest, '>')">
2383                                 <xsl:value-of select="$count" />
2384                                 <xsl:call-template name="GetEscapedTypeName">
2385                                         <xsl:with-param name="typename" select="substring-after ($rest, '>')" />
2386                                 </xsl:call-template>
2387                         </xsl:when>
2388                         <xsl:when test="starts-with ($rest, ',')">
2389                                 <xsl:call-template name="GetGenericArgumentCount">
2390                                         <xsl:with-param name="arglist" select="substring-after ($rest, ',')" />
2391                                         <xsl:with-param name="count" select="$count+1" />
2392                                 </xsl:call-template>
2393                         </xsl:when>
2394                         <xsl:otherwise>
2395                                 <xsl:message terminate="yes">
2396 !WTF 2? arglist=<xsl:value-of select="$arglist" />; rest=<xsl:value-of select="$rest" />
2397                                 </xsl:message>
2398                         </xsl:otherwise>
2399                 </xsl:choose>
2400         </xsl:template>
2401
2402         <xsl:template name="SkipTypeArgument">
2403                 <xsl:param name="s" />
2404
2405                 <xsl:variable name="p-rtf">
2406                         <xsl:call-template name="GetCLtGtPositions">
2407                                 <xsl:with-param name="s" select="$s" />
2408                         </xsl:call-template>
2409                 </xsl:variable>
2410                 <xsl:variable name="p" select="msxsl:node-set($p-rtf)"/>
2411
2412                 <xsl:choose>
2413                         <!--
2414                         Have to select between three `s' patterns:
2415                         A,B>: need to return ",B>"
2416                         Foo<A,B>>: Need to forward to SkipGenericArgument to eventually return ">"
2417                         Foo<A,B>+C>: Need to forward to SkipGenericArgument to eventually return ">"
2418                         -->
2419                         <xsl:when test="starts-with ($s, '>')">
2420                                 <xsl:message terminate="yes">
2421 SkipTypeArgument: invalid type substring '<xsl:value-of select="$s" />'
2422                                 </xsl:message>
2423                         </xsl:when>
2424                         <xsl:when test="$p/Comma/@Length > 0 and 
2425                                         ($p/Lt/@Length = 0 or $p/Comma/@Length &lt; $p/Lt/@Length) and 
2426                                         ($p/Gt/@Length > 0 and $p/Comma/@Length &lt; $p/Gt/@Length)">
2427                                 <xsl:text>,</xsl:text>
2428                                 <xsl:value-of select="substring-after ($s, ',')" />
2429                         </xsl:when>
2430                         <xsl:when test="$p/Lt/@Length > 0 and $p/Lt/@Length &lt; $p/Gt/@Length">
2431                                 <xsl:variable name="r">
2432                                         <xsl:call-template name="SkipGenericArgument">
2433                                                 <xsl:with-param name="s" select="substring-after ($s, '&lt;')" />
2434                                         </xsl:call-template>
2435                                 </xsl:variable>
2436                                 <xsl:choose>
2437                                         <xsl:when test="starts-with ($r, '>') or starts-with ($r, '+')">
2438                                                 <xsl:value-of select="substring-after ($r, '&gt;')" />
2439                                         </xsl:when>
2440                                         <xsl:when test="starts-with ($r, ',')">
2441                                                 <xsl:value-of select="$r" />
2442                                         </xsl:when>
2443                                         <xsl:otherwise>
2444                                                 <xsl:message>
2445 ! WTF3: s=<xsl:value-of select="$s" />; r=<xsl:value-of select="$r" />
2446                                                 </xsl:message>
2447                                         </xsl:otherwise>
2448                                 </xsl:choose>
2449                         </xsl:when>
2450                         <xsl:when test="$p/Gt/@Length > 0">
2451                                 <xsl:text>&gt;</xsl:text>
2452                                 <xsl:value-of select="substring-after ($s, '&gt;')" />
2453                         </xsl:when>
2454                         <xsl:otherwise><xsl:value-of select="$s" /></xsl:otherwise>
2455                 </xsl:choose>
2456         </xsl:template>
2457
2458         <xsl:template name="GetCLtGtPositions">
2459                 <xsl:param name="s" />
2460
2461                 <xsl:variable name="c"  select="substring-before ($s, ',')" />
2462                 <xsl:variable name="lt" select="substring-before ($s, '&lt;')" />
2463                 <xsl:variable name="gt" select="substring-before ($s, '&gt;')" />
2464
2465                         <Comma String="{$c}" Length="{string-length ($c)}" />
2466                         <Lt String="{$lt}" Length="{string-length ($lt)}" />
2467                         <Gt String="{$gt}" Length="{string-length ($gt)}" />
2468         </xsl:template>
2469
2470         <!--
2471         when given 'Foo<A,Bar<Baz<C,D,E>>>>', returns '>'
2472         when given 'Bar<C>+Nested>', returns '>'
2473         when given 'Foo<A,Bar<Baz<C,D,E>>>,', returns ','
2474         (basically, it matches '<' to '>' and "skips" the intermediate type-name contents.
2475           -->
2476         <xsl:template name="SkipGenericArgument">
2477                 <xsl:param name="s" />
2478
2479                 <xsl:variable name="p-rtf">
2480                         <xsl:call-template name="GetCLtGtPositions">
2481                                 <xsl:with-param name="s" select="$s" />
2482                         </xsl:call-template>
2483                 </xsl:variable>
2484                 <xsl:variable name="p" select="msxsl:node-set($p-rtf)" />
2485
2486                 <xsl:choose>
2487                         <xsl:when test="starts-with ($s, '>')">
2488                                 <xsl:message terminate="yes">
2489 SkipGenericArgument: invalid type substring '<xsl:value-of select="$s" />'
2490                                 </xsl:message>
2491                         </xsl:when>
2492                         <xsl:when test="$p/Lt/@Length > 0 and $p/Lt/@Length &lt; $p/Gt/@Length">
2493                                 <!-- within 'Foo<A...'; look for matching '>' -->
2494                                 <xsl:variable name="r">
2495                                         <xsl:call-template name="SkipGenericArgument">
2496                                                 <xsl:with-param name="s" select="substring-after ($s, '&lt;')" />
2497                                         </xsl:call-template>
2498                                 </xsl:variable>
2499                                 <xsl:value-of select="substring-after ($r, '&gt;')" />
2500                         </xsl:when>
2501                         <xsl:when test="$p/Gt/@Length > 0">
2502                                 <!--<xsl:value-of select="substring ($s, string-length ($gt)+1)" />-->
2503                                 <xsl:value-of select="substring-after ($s, '&gt;')" />
2504                         </xsl:when>
2505                         <xsl:otherwise>
2506                                 <xsl:value-of select="$s" />
2507                         </xsl:otherwise>
2508                 </xsl:choose>
2509         </xsl:template>
2510
2511         <xsl:template name="GetEscapedParameter">
2512                 <xsl:param name="orig-parameter-type" />
2513                 <xsl:param name="parameter-type" />
2514                 <xsl:param name="parameter-types" />
2515                 <xsl:param name="escape" />
2516                 <xsl:param name="index" />
2517
2518                 <xsl:choose>
2519                         <xsl:when test="$index &gt; count($parameter-types)">
2520                                 <xsl:if test="$parameter-type != $orig-parameter-type">
2521                                         <xsl:value-of select="$parameter-type" />
2522                                 </xsl:if>
2523                                 <!-- ignore -->
2524                         </xsl:when>
2525                         <xsl:when test="$parameter-types[position() = $index]/@name = $parameter-type">
2526                                 <xsl:value-of select="concat ($escape, $index - 1)" />
2527                         </xsl:when>
2528                         <xsl:otherwise>
2529                                 <xsl:variable name="typeparam" select="$parameter-types[position() = $index]/@name" />
2530                                 <xsl:call-template name="GetEscapedParameter">
2531                                         <xsl:with-param name="orig-parameter-type" select="$orig-parameter-type" />
2532                                         <xsl:with-param name="parameter-type">
2533                                                 <xsl:call-template name="Replace">
2534                                                         <xsl:with-param name="s">
2535                                                                 <xsl:call-template name="Replace">
2536                                                                         <xsl:with-param name="s">
2537                                                                                 <xsl:call-template name="Replace">
2538                                                                                         <xsl:with-param name="s">
2539                                                                                                 <xsl:call-template name="Replace">
2540                                                                                                         <xsl:with-param name="s" select="$parameter-type"/>
2541                                                                                                         <xsl:with-param name="from" select="concat('&lt;', $typeparam, '&gt;')" />
2542                                                                                                         <xsl:with-param name="to" select="concat('&lt;', $escape, $index - 1, '&gt;')" />
2543                                                                                                 </xsl:call-template>
2544                                                                                         </xsl:with-param>
2545                                                                                         <xsl:with-param name="from" select="concat('&lt;', $typeparam, ',')" />
2546                                                                                         <xsl:with-param name="to" select="concat('&lt;', $escape, $index - 1, ',')" />
2547                                                                                 </xsl:call-template>
2548                                                                         </xsl:with-param>
2549                                                                         <xsl:with-param name="from" select="concat (',', $typeparam, '&gt;')" />
2550                                                                         <xsl:with-param name="to" select="concat(',', $escape, $index - 1, '&gt;')" />
2551                                                                 </xsl:call-template>
2552                                                         </xsl:with-param>
2553                                                         <xsl:with-param name="from" select="concat (',', $typeparam, ',')" />
2554                                                         <xsl:with-param name="to" select="concat(',', $escape, $index - 1, ',')" />
2555                                                 </xsl:call-template>
2556                                         </xsl:with-param>
2557                                         <xsl:with-param name="parameter-types" select="$parameter-types" />
2558                                         <xsl:with-param name="typeparam" select="$typeparam" />
2559                                         <xsl:with-param name="escape" select="$escape" />
2560                                         <xsl:with-param name="index" select="$index + 1" />
2561                                 </xsl:call-template>
2562                         </xsl:otherwise>
2563                 </xsl:choose>
2564         </xsl:template>
2565
2566         <xsl:template name="GetLinkId">
2567                 <xsl:param name="type"/>
2568                 <xsl:param name="member"/>
2569                 <xsl:call-template name="GetLinkName">
2570                         <xsl:with-param name="type" select="$type" />
2571                         <xsl:with-param name="member" select="$member" />
2572                 </xsl:call-template>
2573                 <xsl:if test="count($member/Parameters/Parameter) &gt; 0 or $member/MemberType='Method' or $member/MemberType='Constructor'">
2574                         <xsl:text>(</xsl:text>
2575                         <xsl:for-each select="Parameters/Parameter">
2576                                 <xsl:if test="not(position()=1)">,</xsl:if>
2577                                 <xsl:call-template name="GetParameterType">
2578                                         <xsl:with-param name="type" select="$type" />
2579                                         <xsl:with-param name="member" select="$member" />
2580                                         <xsl:with-param name="parameter" select="." />
2581                                 </xsl:call-template>
2582                         </xsl:for-each>
2583                         <xsl:text>)</xsl:text>
2584                 </xsl:if>
2585                 <xsl:if test="$member/@MemberName='op_Implicit' or $member/@MemberName='op_Explicit'">
2586                         <xsl:text>~</xsl:text>
2587                         <xsl:variable name="parameter-rtf">
2588                                 <Parameter Type="{$member/ReturnValue/ReturnType}" />
2589                         </xsl:variable>
2590                         <xsl:call-template name="GetParameterType">
2591                                 <xsl:with-param name="type" select="$type" />
2592                                 <xsl:with-param name="member" select="$member" />
2593                                 <xsl:with-param name="parameter" select="msxsl:node-set($parameter-rtf)/Parameter" />
2594                         </xsl:call-template>
2595                 </xsl:if>
2596         </xsl:template>
2597
2598         <!-- 
2599           - what should be <xsl:value-of select="@Type" /> becomes a nightmare once
2600                 - generics enter the picture, since a parameter type could come from the
2601                 - type itelf (becoming `N) or from the method (becoming ``N).
2602           -->
2603         <xsl:template name="GetParameterType">
2604                 <xsl:param name="type" />
2605                 <xsl:param name="member" />
2606                 <xsl:param name="parameter" />
2607
2608                 <!-- the actual parameter type -->
2609                 <xsl:variable name="ptype">
2610                         <xsl:choose>
2611                                 <xsl:when test="contains($parameter/@Type, '[')">
2612                                         <xsl:value-of select="substring-before ($parameter/@Type, '[')" />
2613                                 </xsl:when>
2614                                 <xsl:when test="contains($parameter/@Type, '&amp;')">
2615                                         <xsl:value-of select="substring-before ($parameter/@Type, '&amp;')" />
2616                                 </xsl:when>
2617                                 <xsl:when test="contains($parameter/@Type, '*')">
2618                                         <xsl:value-of select="substring-before ($parameter/@Type, '*')" />
2619                                 </xsl:when>
2620                                 <xsl:otherwise>
2621                                         <xsl:value-of select="$parameter/@Type" />
2622                                 </xsl:otherwise>
2623                         </xsl:choose>
2624                 </xsl:variable>
2625
2626                 <!-- parameter modifiers -->
2627                 <xsl:variable name="pmodifier">
2628                         <xsl:call-template name="Replace">
2629                                 <xsl:with-param name="s" select="substring-after ($parameter/@Type, $ptype)" />
2630                                 <xsl:with-param name="from">&amp;</xsl:with-param>
2631                                 <xsl:with-param name="to">@</xsl:with-param>
2632                         </xsl:call-template>
2633                 </xsl:variable>
2634
2635                 <xsl:variable name="gen-type">
2636                         <xsl:call-template name="GetEscapedParameter">
2637                                 <xsl:with-param name="orig-parameter-type" select="$ptype" />
2638                                 <xsl:with-param name="parameter-type">
2639                                         <xsl:variable name="nested">
2640                                                 <xsl:call-template name="GetEscapedParameter">
2641                                                         <xsl:with-param name="orig-parameter-type" select="$ptype" />
2642                                                         <xsl:with-param name="parameter-type" select="$ptype" />
2643                                                         <xsl:with-param name="parameter-types" select="$type/Docs/typeparam" />
2644                                                         <xsl:with-param name="escape" select="'`'" />
2645                                                         <xsl:with-param name="index" select="1" />
2646                                                 </xsl:call-template>
2647                                         </xsl:variable>
2648                                         <xsl:choose>
2649                                                 <xsl:when test="$nested != ''">
2650                                                         <xsl:value-of select="$nested" />
2651                                                 </xsl:when>
2652                                                 <xsl:otherwise>
2653                                                         <xsl:value-of select="$ptype" />
2654                                                 </xsl:otherwise>
2655                                         </xsl:choose>
2656                                 </xsl:with-param>
2657                                 <xsl:with-param name="parameter-types" select="$member/Docs/typeparam" />
2658                                 <xsl:with-param name="escape" select="'``'" />
2659                                 <xsl:with-param name="index" select="1" />
2660                         </xsl:call-template>
2661                 </xsl:variable>
2662
2663                 <!-- the actual parameter type -->
2664                 <xsl:variable name="parameter-type">
2665                         <xsl:choose>
2666                                 <xsl:when test="$gen-type != ''">
2667                                         <xsl:value-of select="$gen-type" />
2668                                         <xsl:value-of select="$pmodifier" />
2669                                 </xsl:when>
2670                                 <xsl:otherwise>
2671                                         <xsl:value-of select="concat($ptype, $pmodifier)" />
2672                                 </xsl:otherwise>
2673                         </xsl:choose>
2674                 </xsl:variable>
2675
2676                 <!-- s/</{/g; s/>/}/g; so that less escaping is needed. -->
2677                 <xsl:call-template name="Replace">
2678                         <xsl:with-param name="s">
2679                                 <xsl:call-template name="Replace">
2680                                         <xsl:with-param name="s" select="translate ($parameter-type, '+', '.')" />
2681                                         <xsl:with-param name="from">&gt;</xsl:with-param>
2682                                         <xsl:with-param name="to">}</xsl:with-param>
2683                                 </xsl:call-template>
2684                         </xsl:with-param>
2685                         <xsl:with-param name="from">&lt;</xsl:with-param>
2686                         <xsl:with-param name="to">{</xsl:with-param>
2687                 </xsl:call-template>
2688         </xsl:template>
2689
2690         <xsl:template name="Replace">
2691                 <xsl:param name="s" />
2692                 <xsl:param name="from" />
2693                 <xsl:param name="to" />
2694                 <xsl:choose>
2695                         <xsl:when test="not(contains($s, $from))">
2696                                 <xsl:value-of select="$s" />
2697                         </xsl:when>
2698                         <xsl:otherwise>
2699                                 <xsl:variable name="prefix" select="substring-before($s, $from)"/>
2700                                 <xsl:variable name="suffix" select="substring-after($s, $from)" />
2701                                 <xsl:value-of select="$prefix" />
2702                                 <xsl:value-of select="$to" />
2703                                 <xsl:call-template name="Replace">
2704                                         <xsl:with-param name="s" select="$suffix" />
2705                                         <xsl:with-param name="from" select="$from" />
2706                                         <xsl:with-param name="to" select="$to" />
2707                                 </xsl:call-template>
2708                         </xsl:otherwise>
2709                 </xsl:choose>
2710         </xsl:template>
2711
2712         <xsl:template name="getmodifiers">
2713                 <xsl:param name="sig"/>
2714                 <xsl:param name="protection" select="true()"/>
2715                 <xsl:param name="inheritance" select="true()"/>
2716                 <xsl:param name="extra" select="true()"/>
2717                 <xsl:param name="typetype" select="false()"/>
2718
2719                 <xsl:variable name="Sig">
2720                         <xsl:text> </xsl:text>
2721                         <xsl:choose>
2722                                 <xsl:when test="contains($sig, '{')">
2723                                         <xsl:value-of select="substring-before ($sig, '{')" />
2724                                 </xsl:when>
2725                                 <xsl:otherwise>
2726                                         <xsl:value-of select="$sig" />
2727                                 </xsl:otherwise>
2728                         </xsl:choose>
2729                         <xsl:text> </xsl:text>
2730                 </xsl:variable>
2731
2732                 <xsl:if test="$protection">
2733                         <xsl:if test="contains($Sig, ' public ')">public </xsl:if>
2734                         <xsl:if test="contains($Sig, ' private ')">private </xsl:if>
2735                         <xsl:if test="contains($Sig, ' protected ')">protected </xsl:if>
2736                         <xsl:if test="contains($Sig, ' internal ')">internal </xsl:if>
2737                 </xsl:if>
2738
2739                 <xsl:if test="contains($Sig, ' static ')">static </xsl:if>
2740                 <xsl:if test="contains($Sig, ' abstract ')">abstract </xsl:if>
2741                 <xsl:if test="contains($Sig, ' operator ')">operator </xsl:if>
2742
2743                 <xsl:if test="contains($Sig, ' const ')">const </xsl:if>
2744                 <xsl:if test="contains($Sig, ' readonly ')">readonly </xsl:if>
2745
2746                 <xsl:if test="$inheritance">
2747                         <xsl:if test="contains($Sig, ' override ')">override </xsl:if>
2748                         <xsl:if test="contains($Sig, ' new ')">new </xsl:if>
2749                 </xsl:if>
2750
2751                 <xsl:if test="$extra">
2752                         <xsl:if test="contains($Sig, ' sealed ')">sealed </xsl:if>
2753                         <xsl:if test="contains($Sig, ' virtual ')">virtual </xsl:if>
2754
2755                         <xsl:if test="contains($Sig, ' extern ')">extern </xsl:if>
2756                         <xsl:if test="contains($Sig, ' checked ')">checked </xsl:if>
2757                         <xsl:if test="contains($Sig, ' unsafe ')">unsafe </xsl:if>
2758                         <xsl:if test="contains($Sig, ' volatile ')">volatile </xsl:if>
2759                         <xsl:if test="contains($Sig, ' explicit ')">explicit </xsl:if>
2760                         <xsl:if test="contains($Sig, ' implicit ')">implicit </xsl:if>
2761                 </xsl:if>
2762
2763                 <xsl:if test="$typetype">
2764                         <xsl:if test="contains($Sig, ' class ')">class </xsl:if>
2765                         <xsl:if test="contains($Sig, ' interface ')">interface </xsl:if>
2766                         <xsl:if test="contains($Sig, ' struct ')">struct </xsl:if>
2767                         <xsl:if test="contains($Sig, ' delegate ')">delegate </xsl:if>
2768                         <xsl:if test="contains($Sig, ' enum ')">enum </xsl:if>
2769                 </xsl:if>
2770         </xsl:template>
2771
2772         <xsl:template name="GetTypeDescription">
2773                 <xsl:variable name="sig" select="TypeSignature[@Language='C#']/@Value"/>
2774                 <xsl:choose>
2775                         <xsl:when test="contains($sig, ' class ')">Class</xsl:when>
2776                         <xsl:when test="contains($sig, ' interface ')">Interface</xsl:when>
2777                         <xsl:when test="contains($sig, ' struct ')">Struct</xsl:when>
2778                         <xsl:when test="contains($sig, ' delegate ')">Delegate</xsl:when>
2779                         <xsl:when test="contains($sig, ' enum ')">Enum</xsl:when>
2780                 </xsl:choose>
2781         </xsl:template>
2782         
2783         <xsl:template match="since">
2784                 <p>
2785                         <i>Note: This namespace, class, or member is supported only in version <xsl:value-of select="@version" />
2786                         and later.</i>
2787                 </p>
2788         </xsl:template>
2789
2790         <xsl:template name="GetLinkTargetHtml">
2791                 <xsl:param name="type" />
2792                 <xsl:param name="cref" />
2793
2794                 <xsl:variable name="href">
2795                         <xsl:call-template name="GetLinkTarget">
2796                                 <xsl:with-param name="type" select="$type" />
2797                                 <xsl:with-param name="cref" select="$cref" />
2798                         </xsl:call-template>
2799                 </xsl:variable>
2800                 <xsl:choose>
2801                         <xsl:when test="string($href) = ''">
2802                                 <xsl:text>javascript:alert("Documentation not found.")</xsl:text>
2803                         </xsl:when>
2804                         <xsl:otherwise><xsl:value-of select="$href" /></xsl:otherwise>
2805                 </xsl:choose>
2806         </xsl:template>
2807
2808 </xsl:stylesheet>