2002-02-20 Ravi Pratap <ravi@ximian.com>
[mono.git] / mcs / doctools / MonoDocToHtml.xsl
1 <?xml version="1.0"?>
2 <xsl:stylesheet version="1.0"
3   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4         <xsl:template match="/">
5                 <html>
6                 <body>
7                         <table width="600">
8                         <tr>
9                                 <td>
10                                 <xsl:apply-templates/>
11                                 </td>
12                         </tr>
13                         </table>
14                 </body>
15                 </html>
16         </xsl:template>
17         <xsl:template match="class">
18                 <h2>Class: <xsl:value-of select="name"/></h2>
19                 <h3>Inherits from: <xsl:value-of select="inheritfull"/></h3>
20                 <h3>Attributes:
21                 <xsl:for-each select="attribute">
22                         <xsl:value-of select="."/><xsl:if test="position()!=last()">, </xsl:if>
23                 </xsl:for-each>
24                 </h3>
25                 <hr></hr>
26                 <h3>Members:</h3>
27                 <h4>Constructors:</h4>
28                 <xsl:apply-templates select="member" mode="constructors">
29                         <xsl:sort select="name"/>
30                 </xsl:apply-templates>
31                 <h4>Methods:</h4>
32                 <xsl:apply-templates select="member" mode="methods">
33                         <xsl:sort select="name"/>
34                 </xsl:apply-templates>
35                 <h4>Properties:</h4>
36                 <xsl:apply-templates select="member" mode="properties">
37                         <xsl:sort select="name"/>
38                 </xsl:apply-templates>
39         </xsl:template>
40
41         <xsl:template match="member" mode="constructors">
42                         <xsl:if test="type='constructor'">
43                                 <xsl:value-of select="name"/>(<xsl:apply-templates select="param"/>)<br/>
44                                 <dl>
45                                         <xsl:apply-templates select="attribute"/>
46                                         <xsl:apply-templates select="inheritfull"/>
47                                 </dl>
48                         </xsl:if>
49         </xsl:template>
50
51         <xsl:template match="member" mode="methods">
52                         <xsl:if test="type='method'">
53                                 <xsl:value-of select="name"/>(<xsl:apply-templates select="param"/>)<br/>
54                                 <dl>
55                                         <xsl:apply-templates select="attribute"/>
56                                         <xsl:apply-templates select="inheritfull"/>
57                                         <xsl:apply-templates select="return"/>
58                                 </dl>
59                         </xsl:if>
60         </xsl:template>
61
62         <xsl:template match="member" mode="properties">
63                         <xsl:if test="type='property'">
64                                 <xsl:value-of select="name"/><br/>
65                                 <dl>
66                                         <xsl:apply-templates select="attribute"/>
67                                         <xsl:apply-templates select="inheritfull"/>
68                                         <xsl:apply-templates select="property"/>
69                                 </dl>
70                         </xsl:if>
71         </xsl:template>
72
73         <xsl:template match="param">
74                 <xsl:value-of select="type"/>&#160;&#160;<xsl:value-of select="name"/>
75                 <xsl:if test="position()!=last()">, </xsl:if>
76         </xsl:template>
77
78         <xsl:template match="attribute">
79                 <xsl:if test="position() = 1"><dd>Attributes:</dd></xsl:if>
80                 <dd><dl>
81                                 <dd><xsl:value-of select="."/></dd>
82                         </dl>
83                 </dd>
84         </xsl:template>
85
86         <xsl:template match="inheritfull">
87                 <xsl:if test="position() = 1"><dd>Inherits from:</dd></xsl:if>
88                 <dd><dl>
89                                 <dd><xsl:value-of select="."/></dd>
90                         </dl>
91                 </dd>
92         </xsl:template>
93
94         <xsl:template match="return">
95                 <xsl:if test="position() = 1"><dd>Return Type:</dd></xsl:if>
96                 <dd><dl>
97                                 <dd><xsl:value-of select="."/></dd>
98                         </dl>
99                 </dd>
100         </xsl:template>
101
102         <xsl:template match="property">
103                 <xsl:if test="position() = 1"><dd>Property:</dd></xsl:if>
104                 <dd><dl>
105                                 <dd><xsl:value-of select="."/></dd>
106                         </dl>
107                 </dd>
108         </xsl:template>
109 </xsl:stylesheet>