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