|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | +<!-- ================================================================================ --> |
| 3 | +<!-- Amend, distribute, spindle and mutilate as desired, but don't remove this header --> |
| 4 | +<!-- A simple XML Documentation to basic HTML transformation stylesheet --> |
| 5 | +<!-- (c)2005 by Emma Burrows --> |
| 6 | +<!-- ================================================================================ --> |
| 7 | +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
| 8 | + |
| 9 | +<!-- DOCUMENT TEMPLATE --> |
| 10 | +<!-- Format the whole document as a valid HTML document --> |
| 11 | +<xsl:template match="/"> |
| 12 | +<HTML> |
| 13 | + <BODY> |
| 14 | + <xsl:apply-templates select="//assembly"/> |
| 15 | + </BODY> |
| 16 | +</HTML> |
| 17 | +</xsl:template> |
| 18 | + |
| 19 | +<!-- ASSEMBLY TEMPLATE --> |
| 20 | +<!-- For each Assembly, display its name and then its member types --> |
| 21 | +<xsl:template match="assembly"> |
| 22 | +<H1><xsl:value-of select="name"/></H1> |
| 23 | + <xsl:apply-templates select="//member[contains(@name,'T:')]"/> |
| 24 | +</xsl:template> |
| 25 | + |
| 26 | +<!-- TYPE TEMPLATE --> |
| 27 | +<!-- Loop through member types and display their properties and methods --> |
| 28 | +<xsl:template match="//member[contains(@name,'T:')]"> |
| 29 | + |
| 30 | + <!-- Two variables to make code easier to read --> |
| 31 | + <!-- A variable for the name of this type --> |
| 32 | + <xsl:variable name="MemberName" |
| 33 | + select="substring-after(@name, '.')"/> |
| 34 | + |
| 35 | + <!-- Get the type's fully qualified name without the T: prefix --> |
| 36 | + <xsl:variable name="FullMemberName" |
| 37 | + select="substring-after(@name, ':')"/> |
| 38 | + |
| 39 | + <!-- Display the type's name and information --> |
| 40 | + <H2><xsl:value-of select="$MemberName"/></H2> |
| 41 | + <xsl:apply-templates/> |
| 42 | + |
| 43 | + <!-- If this type has public fields, display them --> |
| 44 | + <xsl:if test="//member[contains(@name,concat('F:',$FullMemberName))]"> |
| 45 | + <H3>Fields</H3> |
| 46 | + |
| 47 | + <xsl:for-each select="//member[contains(@name,concat('F:',$FullMemberName))]"> |
| 48 | + <H4><xsl:value-of select="substring-after(@name, concat('F:',$FullMemberName,'.'))"/></H4> |
| 49 | + <xsl:apply-templates/> |
| 50 | + </xsl:for-each> |
| 51 | + </xsl:if> |
| 52 | + |
| 53 | + <!-- If this type has properties, display them --> |
| 54 | + <xsl:if test="//member[contains(@name,concat('P:',$FullMemberName))]"> |
| 55 | + <H3>Properties</H3> |
| 56 | + |
| 57 | + <xsl:for-each select="//member[contains(@name,concat('P:',$FullMemberName))]"> |
| 58 | + <H4><xsl:value-of select="substring-after(@name, concat('P:',$FullMemberName,'.'))"/></H4> |
| 59 | + <xsl:apply-templates/> |
| 60 | + </xsl:for-each> |
| 61 | + </xsl:if> |
| 62 | + |
| 63 | + <!-- If this type has methods, display them --> |
| 64 | + <xsl:if test="//member[contains(@name,concat('M:',$FullMemberName))]"> |
| 65 | + <H3>Methods</H3> |
| 66 | + |
| 67 | + <xsl:for-each select="//member[contains(@name,concat('M:',$FullMemberName))]"> |
| 68 | + |
| 69 | + <!-- If this is a constructor, display the type name |
| 70 | + (instead of "#ctor"), or display the method name --> |
| 71 | + <H4> |
| 72 | + <xsl:choose> |
| 73 | + <xsl:when test="contains(@name, '#ctor')"> |
| 74 | + Constructor: |
| 75 | + <xsl:value-of select="$MemberName"/> |
| 76 | + <xsl:value-of select="substring-after(@name, '#ctor')"/> |
| 77 | + </xsl:when> |
| 78 | + <xsl:otherwise> |
| 79 | + <xsl:value-of select="substring-after(@name, concat('M:',$FullMemberName,'.'))"/> |
| 80 | + </xsl:otherwise> |
| 81 | + </xsl:choose> |
| 82 | + </H4> |
| 83 | + |
| 84 | + <xsl:apply-templates select="summary"/> |
| 85 | + |
| 86 | + <!-- Display parameters if there are any --> |
| 87 | + <xsl:if test="count(param)!=0"> |
| 88 | + <H5>Parameters</H5> |
| 89 | + <xsl:apply-templates select="param"/> |
| 90 | + </xsl:if> |
| 91 | + |
| 92 | + <!-- Display return value if there are any --> |
| 93 | + <xsl:if test="count(returns)!=0"> |
| 94 | + <H5>Return Value</H5> |
| 95 | + <xsl:apply-templates select="returns"/> |
| 96 | + </xsl:if> |
| 97 | + |
| 98 | + <!-- Display exceptions if there are any --> |
| 99 | + <xsl:if test="count(exception)!=0"> |
| 100 | + <H5>Exceptions</H5> |
| 101 | + <xsl:apply-templates select="exception"/> |
| 102 | + </xsl:if> |
| 103 | + |
| 104 | + <!-- Display examples if there are any --> |
| 105 | + <xsl:if test="count(example)!=0"> |
| 106 | + <H5>Example</H5> |
| 107 | + <xsl:apply-templates select="example"/> |
| 108 | + </xsl:if> |
| 109 | + |
| 110 | + </xsl:for-each> |
| 111 | + |
| 112 | + </xsl:if> |
| 113 | +</xsl:template> |
| 114 | + |
| 115 | +<!-- OTHER TEMPLATES --> |
| 116 | +<!-- Templates for other tags --> |
| 117 | +<xsl:template match="c"> |
| 118 | + <CODE><xsl:apply-templates /></CODE> |
| 119 | +</xsl:template> |
| 120 | + |
| 121 | +<xsl:template match="code"> |
| 122 | + <PRE><xsl:apply-templates /></PRE> |
| 123 | +</xsl:template> |
| 124 | + |
| 125 | +<xsl:template match="example"> |
| 126 | + <P><STRONG>Example: </STRONG><xsl:apply-templates /></P> |
| 127 | +</xsl:template> |
| 128 | + |
| 129 | +<xsl:template match="exception"> |
| 130 | + <P><STRONG><xsl:value-of select="substring-after(@cref,'T:')"/>: </STRONG><xsl:apply-templates /></P> |
| 131 | +</xsl:template> |
| 132 | + |
| 133 | +<xsl:template match="include"> |
| 134 | + <A HREF="{@file}">External file</A> |
| 135 | +</xsl:template> |
| 136 | + |
| 137 | +<xsl:template match="para"> |
| 138 | + <P><xsl:apply-templates /></P> |
| 139 | +</xsl:template> |
| 140 | + |
| 141 | +<xsl:template match="param"> |
| 142 | + <P><STRONG><xsl:value-of select="@name"/>: </STRONG><xsl:apply-templates /></P> |
| 143 | +</xsl:template> |
| 144 | + |
| 145 | +<xsl:template match="paramref"> |
| 146 | + <EM><xsl:value-of select="@name" /></EM> |
| 147 | +</xsl:template> |
| 148 | + |
| 149 | +<xsl:template match="permission"> |
| 150 | + <P><STRONG>Permission: </STRONG><EM><xsl:value-of select="@cref" /> </EM><xsl:apply-templates /></P> |
| 151 | +</xsl:template> |
| 152 | + |
| 153 | +<xsl:template match="remarks"> |
| 154 | + <P><xsl:apply-templates /></P> |
| 155 | +</xsl:template> |
| 156 | + |
| 157 | +<xsl:template match="returns"> |
| 158 | + <P><STRONG>Return Value: </STRONG><xsl:apply-templates /></P> |
| 159 | +</xsl:template> |
| 160 | + |
| 161 | +<xsl:template match="see"> |
| 162 | + <EM>See: <xsl:value-of select="@cref" /></EM> |
| 163 | +</xsl:template> |
| 164 | + |
| 165 | +<xsl:template match="seealso"> |
| 166 | + <EM>See also: <xsl:value-of select="@cref" /></EM> |
| 167 | +</xsl:template> |
| 168 | + |
| 169 | +<xsl:template match="summary"> |
| 170 | + <P><xsl:apply-templates /></P> |
| 171 | +</xsl:template> |
| 172 | + |
| 173 | +<xsl:template match="list"> |
| 174 | + <xsl:choose> |
| 175 | + <xsl:when test="@type='bullet'"> |
| 176 | + <UL> |
| 177 | + <xsl:for-each select="listheader"> |
| 178 | + <LI><strong><xsl:value-of select="term"/>: </strong><xsl:value-of select="definition"/></LI> |
| 179 | + </xsl:for-each> |
| 180 | + <xsl:for-each select="list"> |
| 181 | + <LI><strong><xsl:value-of select="term"/>: </strong><xsl:value-of select="definition"/></LI> |
| 182 | + </xsl:for-each> |
| 183 | + </UL> |
| 184 | + </xsl:when> |
| 185 | + <xsl:when test="@type='number'"> |
| 186 | + <OL> |
| 187 | + <xsl:for-each select="listheader"> |
| 188 | + <LI><strong><xsl:value-of select="term"/>: </strong><xsl:value-of select="definition"/></LI> |
| 189 | + </xsl:for-each> |
| 190 | + <xsl:for-each select="list"> |
| 191 | + <LI><strong><xsl:value-of select="term"/>: </strong><xsl:value-of select="definition"/></LI> |
| 192 | + </xsl:for-each> |
| 193 | + </OL> |
| 194 | + </xsl:when> |
| 195 | + <xsl:when test="@type='table'"> |
| 196 | + <TABLE> |
| 197 | + <xsl:for-each select="listheader"> |
| 198 | + <TH> |
| 199 | + <TD><xsl:value-of select="term"/></TD> |
| 200 | + <TD><xsl:value-of select="definition"/></TD> |
| 201 | + </TH> |
| 202 | + </xsl:for-each> |
| 203 | + <xsl:for-each select="list"> |
| 204 | + <TR> |
| 205 | + <TD><strong><xsl:value-of select="term"/>: </strong></TD> |
| 206 | + <TD><xsl:value-of select="definition"/></TD> |
| 207 | + </TR> |
| 208 | + </xsl:for-each> |
| 209 | + </TABLE> |
| 210 | + </xsl:when> |
| 211 | + </xsl:choose> |
| 212 | +</xsl:template> |
| 213 | + |
| 214 | +</xsl:stylesheet> |
0 commit comments