Add a more functional (i.e. fewer-stubs) implementation of System.Data.Linq.
[mono.git] / mcs / tools / mdoc / Resources / stylesheet.xsl
1 <?xml version="1.0"?>
2
3 <!--
4         Based on Mono's /monodoc/browser/mono-ecma.xsl file.
5 -->
6
7 <xsl:stylesheet
8         version="1.0"
9         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10         >
11         <xsl:include href="mdoc-html-utils.xsl" />
12         <xsl:include href="mdoc-sections-css.xsl" />
13         
14         <!-- TEMPLATE PARAMETERS -->
15
16         <xsl:param name="language" select="'C#'"/>
17         <xsl:param name="ext" select="'xml'"/>
18         <xsl:param name="basepath" select="'./'"/>
19         
20         <xsl:variable name="Index" select="document('index.xml', .)"/>
21
22         <!-- The namespace that the current type belongs to. -->
23         <xsl:variable name="mono-docs">http://www.go-mono.com/docs/monodoc.ashx?link=</xsl:variable>
24
25         <!-- THE MAIN RENDERING TEMPLATE -->
26
27         <xsl:template match="Type">
28                 <xsl:variable name="cref">
29                         <xsl:text>T:</xsl:text>
30                         <xsl:call-template name="GetEscapedTypeName">
31                                 <xsl:with-param name="typename" select="@FullName" />
32                         </xsl:call-template>
33                 </xsl:variable>
34
35                 <Page>
36                 
37                 <Title>
38                         <xsl:value-of select="translate (@FullName, '+', '.')" />
39                 </Title>
40                 
41                 <CollectionTitle>
42                         <a href="{$basepath}index.{$ext}"><xsl:value-of select="AssemblyInfo/AssemblyName"/></a>
43                         <xsl:text> : </xsl:text>
44                         <a href="index.{$ext}"><xsl:value-of select="$TypeNamespace"/> Namespace</a>
45                 </CollectionTitle>
46                 
47                 <PageTitle>
48                         <xsl:attribute name="id">
49                                 <xsl:value-of select="$cref" />
50                         </xsl:attribute>
51                         <xsl:value-of select="translate (@Name, '+', '.')"/>
52                         <xsl:text xml:space="preserve"> </xsl:text>
53                         <xsl:if test="count(Docs/typeparam) &gt; 0">Generic</xsl:if>
54                         <xsl:text xml:space="preserve"> </xsl:text>
55                         <xsl:call-template name="GetTypeDescription" />
56                 </PageTitle>
57                 
58                 <!--
59                 <SideBar>
60                         <p style="font-weight: bold; border-bottom: thin solid black"><a href="index.{$ext}"><xsl:value-of select="$TypeNamespace"/></a></p>
61
62                         <xsl:for-each select="document('index.xml',.)/Overview/Types/Namespace[@Name=$TypeNamespace]/Type">
63                                 <xsl:sort select="@Name"/>
64                                 <div>
65                                         <a href="../{parent::Namespace/@Name}/{@Name}.{$ext}">
66                                                 <xsl:value-of select="@Name"/>
67                                         </a>
68                                 </div>
69                         </xsl:for-each>
70                 </SideBar>
71                 -->
72
73                 <!-- TYPE OVERVIEW -->
74                 
75                 <Summary id="Summary">
76                         <xsl:attribute name="id">
77                                 <xsl:value-of select="concat ($cref, ':Summary')" />
78                         </xsl:attribute>
79                         <!-- summary -->
80                         <xsl:apply-templates select="Docs/summary" mode="notoppara"/>
81                 </Summary>
82
83                 <Signature>
84                         <xsl:call-template name="CreateTypeSignature" />
85                 </Signature>
86                         
87                 <Remarks>
88                         <xsl:attribute name="id">
89                                 <xsl:value-of select="concat ($cref, ':Docs')" />
90                         </xsl:attribute>
91                         <xsl:call-template name="DisplayDocsInformation">
92                                 <xsl:with-param name="linkid" select="concat ($cref, ':Docs')" />
93                         </xsl:call-template>
94
95                         <!-- MEMBER LISTING -->
96                         <xsl:if test="not(Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.MulticastDelegate' or Base/BaseTypeName='System.Enum')">
97                                 <xsl:call-template name="CreateH2Section">
98                                         <xsl:with-param name="name" select="'Members'"/>
99                                         <xsl:with-param name="id" select="'Members'"/>
100                                         <xsl:with-param name="child-id" select="'_Members'"/>
101                                         <xsl:with-param name="content">
102                                                 <xsl:if test="Base/BaseTypeName">
103                                                         <p>
104                                                                 See Also: Inherited members from
105                                                                 <xsl:apply-templates select="Base/BaseTypeName" mode="typelink"><xsl:with-param name="wrt" select="$TypeNamespace"/></xsl:apply-templates>.
106                                                         </p>
107                                                 </xsl:if>
108
109                                                 <!-- list each type of member (public, then protected) -->
110
111                                                 <xsl:call-template name="ListAllMembers">
112                                                         <xsl:with-param name="html-anchor" select="true()" />
113                                                 </xsl:call-template>
114                                         </xsl:with-param>
115                                 </xsl:call-template>
116                         </xsl:if>
117                         
118                 </Remarks>
119                         
120                 <Members>
121                 <!-- MEMBER DETAILS -->
122                         <xsl:attribute name="id">
123                                 <xsl:value-of select="concat ($cref, ':Members')" />
124                         </xsl:attribute>
125                         <xsl:if test="not(Base/BaseTypeName='System.Delegate' or Base/BaseTypeName='System.MulticastDelegate' or Base/BaseTypeName='System.Enum')">
126                         <xsl:variable name="Type" select="."/>
127                         
128                         <xsl:call-template name="CreateH2Section">
129                                 <xsl:with-param name="name" select="'Member Details'"/>
130                                 <xsl:with-param name="id" select="'MemberDetails'"/>
131                                 <xsl:with-param name="child-id" select="'_MemberDetails'"/>
132                                 <xsl:with-param name="content">
133                                         <xsl:for-each select="Members/Member[MemberType != 'ExtensionMethod']">
134                                         
135                                                 <xsl:variable name="linkid">
136                                                         <xsl:call-template name="GetLinkId">
137                                                                 <xsl:with-param name="type" select="../.." />
138                                                                 <xsl:with-param name="member" select="." />
139                                                         </xsl:call-template>
140                                                 </xsl:variable>
141
142                                                 <xsl:call-template name="CreateH3Section">
143                                                         <xsl:with-param name="id" select="$linkid" />
144                                                         <xsl:with-param name="child-id" select="concat($linkid, ':member')" />
145                                                         <xsl:with-param name="class" select="MemberName" />
146                                                         <xsl:with-param name="name">
147                                                                 <xsl:choose>
148                                                                         <xsl:when test="MemberType='Constructor'">
149                                                                                 <xsl:call-template name="GetConstructorName">
150                                                                                         <xsl:with-param name="type" select="../.." />
151                                                                                         <xsl:with-param name="ctor" select="." />
152                                                                                 </xsl:call-template>
153                                                                         </xsl:when>
154                                                                         <xsl:when test="@MemberName='op_Implicit' or @MemberName='op_Explicit'">
155                                                                                 <xsl:text>Conversion</xsl:text>
156                                                                         </xsl:when>
157                                                                         <xsl:otherwise>
158                                                                                 <xsl:value-of select="@MemberName"/>
159                                                                         </xsl:otherwise>
160                                                                 </xsl:choose>
161                                                                 <xsl:text xml:space="preserve"> </xsl:text>
162                                                                 <xsl:if test="count(Docs/typeparam) &gt; 0">
163                                                                         <xsl:text>Generic </xsl:text>
164                                                                 </xsl:if>
165                                                                 <xsl:value-of select="MemberType" />
166                                                         </xsl:with-param>
167                                                         <xsl:with-param name="ref" select="." />
168                                                         <xsl:with-param name="content">
169                                                                 <xsl:call-template name="CreateMemberOverview" />
170                                                                 <xsl:call-template name="CreateMemberSignature">
171                                                                         <xsl:with-param name="linkid" select="$linkid" />
172                                                                 </xsl:call-template>
173                                                                 <xsl:call-template name="DisplayDocsInformation">
174                                                                         <xsl:with-param name="linkid" select="$linkid" />
175                                                                 </xsl:call-template>
176                                                                 <hr size="1"/>
177                                                         </xsl:with-param>
178                                                 </xsl:call-template>
179                                         </xsl:for-each>
180                                 </xsl:with-param>
181                         </xsl:call-template>
182                         </xsl:if>
183                         
184                         </Members>
185                         
186                         <Copyright>
187                         </Copyright>
188                         
189                 </Page>
190         </xsl:template>
191
192         <xsl:template name="GetLinkTarget">
193                 <xsl:param name="type" />
194                 <xsl:param name="cref" />
195                 <!-- Search for type in the index.xml file. -->
196                 <xsl:variable name="typeentry" select="$Index/Overview/Types/Namespace/Type[concat(parent::Namespace/@Name,'.',translate(@Name, '+', '.')) = $type]"/>
197
198                 <xsl:choose>
199                         <xsl:when test="count($typeentry)">
200                                 <xsl:value-of select="concat($basepath,$typeentry/parent::Namespace/@Name, '/', $typeentry/@Name)"/>
201                                 <xsl:text>.</xsl:text>
202                                 <xsl:value-of select="$ext" />
203                                 <xsl:if test="string-length ($cref) > 0 and substring ($cref, 1, 2) != 'T:'">
204                                         <xsl:text>#</xsl:text>
205                                         <xsl:call-template name="GetActualCref">
206                                                 <xsl:with-param name="cref" select="$cref" />
207                                         </xsl:call-template>
208                                 </xsl:if>
209                         </xsl:when>
210
211                         <xsl:when test="starts-with($type, 'System.') or 
212                                 starts-with($type, 'Cairo.') or starts-with ($type, 'Commons.Xml.') or
213                                 starts-with($type, 'Mono.GetOptions.') or starts-with($type,'Mono.Math.') or
214                                 starts-with($type, 'Mono.Posix.') or starts-with($type, 'Mono.Remoting.') or
215                                 starts-with($type, 'Mono.Security.') or starts-with($type, 'Mono.Unix.') or
216                                 starts-with($type, 'Mono.Xml.')">
217                                 <xsl:value-of select="$mono-docs" />
218                                 <xsl:value-of select="$cref" />
219                         </xsl:when>
220                         <xsl:otherwise>javascript:alert("Documentation not found.")</xsl:otherwise>
221                         <!--<xsl:otherwise>javascript:alert("Documentation not found for <xsl:value-of select="$type"/>.")</xsl:otherwise>-->
222                 </xsl:choose>
223         </xsl:template>
224
225         <xsl:template name="GetActualCref">
226                 <xsl:param name="cref" />
227
228                 <xsl:variable name="fullname">
229                         <xsl:choose>
230                                 <xsl:when test="starts-with($cref, 'C:') or starts-with($cref, 'T:')">
231                                         <xsl:choose>
232                                                 <xsl:when test="contains($cref, '(')">
233                                                         <xsl:value-of select="substring (substring-before ($cref, '('), 3)" />
234                                                 </xsl:when>
235                                                 <xsl:otherwise>
236                                                         <xsl:value-of select="substring($cref, 3)" />
237                                                 </xsl:otherwise>
238                                         </xsl:choose>
239                                 </xsl:when>
240                                 <xsl:otherwise>
241                                         <xsl:call-template name="GetTypeName">
242                                                 <xsl:with-param name="type" select="substring($cref, 3)"/>
243                                         </xsl:call-template>
244                                 </xsl:otherwise>
245                         </xsl:choose>
246                 </xsl:variable>
247
248                 <xsl:variable name="escaped-type">
249                         <xsl:call-template name="GetEscapedTypeName">
250                                 <xsl:with-param name="typename">
251                                         <xsl:call-template name="ToBrackets">
252                                                 <xsl:with-param name="s" select="$fullname" />
253                                         </xsl:call-template>
254                                 </xsl:with-param>
255                         </xsl:call-template>
256                 </xsl:variable>
257
258                 <xsl:value-of select="substring ($cref, 1, 2)" />
259                 <xsl:value-of select="$escaped-type" />
260                 <xsl:value-of select="substring-after ($cref, $fullname)" />
261         </xsl:template>
262         
263         <xsl:template name="CreateCodeBlock">
264                 <xsl:param name="language" />
265                 <xsl:param name="content" />
266                 <table class="CodeExampleTable">
267                 <tr><td><b><font size="-1"><xsl:value-of select="$language"/> Example</font></b></td></tr>
268                 <tr><td>
269                         <pre>
270                                 <xsl:attribute name="class">
271                                         <xsl:call-template name="GetCodeClass">
272                                                 <xsl:with-param name="lang" select="$language" />
273                                         </xsl:call-template>
274                                 </xsl:attribute>
275                                 <xsl:value-of select="$content" />
276                         </pre>
277                 </td></tr>
278                 </table>
279         </xsl:template>
280
281         <xsl:template name="CreateEditLink">
282                 <!-- ignore -->
283         </xsl:template>
284
285         <xsl:template name="CreateExpandedToggle">
286                 <xsl:text>⊟</xsl:text>
287         </xsl:template>
288
289         <xsl:template name="GetCodeClass">
290                 <xsl:param name="lang" />
291
292                 <xsl:choose>
293                         <xsl:when test="$lang = 'C#' or $lang = 'csharp'">
294                                 <xsl:text>code-csharp</xsl:text>
295                         </xsl:when>
296                 </xsl:choose>
297         </xsl:template>
298
299 </xsl:stylesheet>