Fix the build.
[castle.git] / Samples / MonoRail / MRCCnetDashboard / Dashboard.Web / xsl / FxCopReport.xsl
blob7a502568a2ab449b1135983ec5da5a61a2753f23
1 <?xml version="1.0"?>
2 <xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns="http://www.w3.org/TR/xhtml1/strict">
5 <xsl:output method="html"/>
7 <xsl:variable name="fxcop.root" select="//FxCopReport"/>
9 <xsl:template match="/">
10 <html>
11 <head><title>Analysis Report</title></head>
12 <style>
13 #Title {font-family: Verdana; font-size: 14pt; color: black; font-weight: bold}
14 .ColumnHeader {font-family: Verdana; font-size: 8pt; background-color:white; color: black}
15 .CriticalError {font-family: Verdana; font-size: 8pt; color: darkred; font-weight: bold; text-align: center}
16 .Error {font-family: Verdana; font-size: 8pt; color: royalblue; font-weight: bold; text-align: center}
17 .CriticalWarning {font-family: Verdana; font-size: 8pt; color: green; font-weight: bold; text-align: center}
18 .Warning {font-family: Verdana; font-size: 8pt; color: darkgray; font-weight: bold; text-align: center}
19 .Information {font-family: Verdana; font-size: 8pt; color: black; font-weight: bold; text-align: center}
21 .PropertyName {font-family: Verdana; font-size: 8pt; color: black; font-weight: bold}
22 .PropertyContent {font-family: Verdana; font-size: 8pt; color: black}
23 .NodeIcon { font-family: WebDings; font-size: 12pt; color: navy; padding-right: 5;}
24 .MessagesIcon { font-family: WebDings; font-size: 12pt; color: red;}
25 .RuleDetails { padding-top: 10;}
26 .SourceCode { background-color:#DDDDFF; }
27 .RuleBlock { background-color:#EEEEFF; }
28 .MessageNumber { font-family: Verdana; font-size: 10pt; color: darkred; }
29 .MessageBlock { font-family: Verdana; font-size: 10pt; color: darkred; }
30 .Resolution {font-family: Verdana; font-size: 8pt; color: black; }
31 .NodeLine { font-family: Verdana; font-size: 9pt;}
32 .Note { font-family: Verdana; font-size: 9pt; color:black; background-color: #DDDDFF; }
33 .NoteUser { font-family: Verdana; font-size: 9pt; font-weight: bold; }
34 .NoteTime { font-family: Verdana; font-size: 8pt; font-style: italic; }
35 .Button { font-family: Verdana; font-size: 9pt; color: blue; background-color: #EEEEEE; }
36 </style>
37 <script>
38 function ViewState(blockId)
40 var block = document.getElementById(blockId);
41 if (block.style.display=='none')
43 block.style.display='block';
45 else
47 block.style.display='none';
51 function SwitchAll(how)
53 var nodes = document.getElementsByTagName("div");
54 for (i = 0; i != nodes.length;i++)
56 var block = nodes[i];
57 if (block != null)
59 if (block.className == 'NodeDiv'
60 || block.className == 'MessageBlockDiv'
61 || block.className == 'MessageDiv')
63 block.style.display=how;
69 function ExpandAll()
71 SwitchAll('block');
74 function CollapseAll()
76 SwitchAll('none');
78 </script>
79 <body bgcolor="white" alink="Black" vlink="Black" link="Black">
80 <xsl:apply-templates select="$fxcop.root"/>
82 </body>
83 </html>
84 </xsl:template>
86 <xsl:template match="FxCopReport">
87 <!-- Report Title -->
88 <div id="Title">
89 FxCop <xsl:value-of select="@Version"/> Analysis Report
90 </div>
91 <br/>
92 <table>
93 <tr>
94 <td class="Button">
95 <a onClick="ExpandAll();">Expand All</a>
96 </td>
97 <td class="Button">
98 <a onClick="CollapseAll();">Collapse All</a>
99 </td>
100 </tr>
101 </table>
102 <br/>
103 <xsl:apply-templates select="Namespaces"/>
104 <xsl:choose>
105 <xsl:when test="Namespaces">
106 <hr/>
107 </xsl:when>
108 </xsl:choose>
109 <xsl:apply-templates select="Targets"/>
110 </xsl:template>
112 <xsl:template match="*">
113 <xsl:choose>
114 <xsl:when test="@Name or name()='Resources'">
115 <xsl:variable name="MessageCount" select="count(.//Message[@Status='Active'])"/>
116 <xsl:choose>
117 <xsl:when test="$MessageCount > 0">
118 <xsl:variable name="nodeId" select="generate-id()"/>
119 <div class="NodeLine">
121 <xsl:attribute name="onClick">
122 javascript:ViewState('<xsl:value-of select="$nodeId"/>');
123 </xsl:attribute>
125 <!-- Display Icon -->
126 <xsl:choose>
127 <xsl:when test="name()='Member' and @Kind='Method'">
128 <nobr class="NodeIcon">&#x0061;</nobr>
129 </xsl:when>
130 <xsl:when test="name()='Member' and @Kind='Constructor'">
131 <nobr class="NodeIcon">&#x003D;</nobr>
132 </xsl:when>
133 <xsl:when test="name()='Member' and @Kind='Property'">
134 <nobr class="NodeIcon">&#x0098;</nobr>
135 </xsl:when>
136 <xsl:when test="name()='Member' and @Kind='Event'">
137 <nobr class="NodeIcon">&#x007E;</nobr>
138 </xsl:when>
139 <xsl:when test="name()='Member' and @Kind='Field'">
140 <nobr class="NodeIcon">&#x00EB;</nobr>
141 </xsl:when>
142 <xsl:when test="name()='Type' and @Kind='Class'">
143 <nobr class="NodeIcon">&#x003C;</nobr>
144 </xsl:when>
145 <xsl:when test="name()='Type' and @Kind='Interface'">
146 <nobr class="NodeIcon">&#x003C;</nobr>
147 </xsl:when>
148 <xsl:when test="name()='Type' and @Kind='Delegate'">
149 <nobr class="NodeIcon">&#x003C;</nobr>
150 </xsl:when>
151 <xsl:when test="name()='Type' and @Kind='Enum'">
152 <nobr class="NodeIcon">&#x003C;</nobr>
153 </xsl:when>
154 <xsl:when test="name()='Type' and @Kind='Struct'">
155 <nobr class="NodeIcon">&#x003C;</nobr>
156 </xsl:when>
157 <xsl:when test="name()='Namespace'">
158 <nobr style="color: navy;">{} </nobr>
159 </xsl:when>
160 <xsl:when test="name()='Target'">
161 <nobr class="NodeIcon">&#x0032;</nobr>
162 </xsl:when>
163 <xsl:when test="name()='Module'">
164 <nobr class="NodeIcon">&#x0031;</nobr>
165 </xsl:when>
166 <xsl:when test="name()='Resource'">
167 <nobr class="NodeIcon">&#x009D;</nobr>
168 </xsl:when>
169 <xsl:when test="name()='Resources'">
170 <nobr class="NodeIcon">&#x00CC;</nobr>
171 </xsl:when>
172 <xsl:otherwise>
173 [<xsl:value-of select="name()"/>]
174 </xsl:otherwise>
175 </xsl:choose>
177 <xsl:choose>
178 <xsl:when test="name()='Resources'">
179 <xsl:value-of select="name()"/>
180 </xsl:when>
181 <xsl:otherwise>
182 <xsl:value-of select="@Name"/>
183 </xsl:otherwise>
184 </xsl:choose>
185 <nobr class="MessageNumber">
186 (<xsl:value-of select="$MessageCount"/>)
187 </nobr>
188 </div>
190 <div class="NodeDiv" style="display: none; position: relative; padding-left: 11;">
191 <xsl:attribute name="id">
192 <xsl:value-of select="$nodeId"/>
193 </xsl:attribute>
195 <xsl:apply-templates />
196 </div>
198 </xsl:when>
199 </xsl:choose>
200 </xsl:when>
201 <xsl:otherwise>
202 <xsl:apply-templates />
203 </xsl:otherwise>
204 </xsl:choose>
205 </xsl:template>
207 <xsl:template match="Messages">
208 <xsl:variable name="MessageBlockId" select="generate-id()"/>
209 <div class="MessageBlock">
210 <xsl:attribute name="onClick">
211 javascript:ViewState('<xsl:value-of select="$MessageBlockId"/>');
212 </xsl:attribute>
213 <nobr class="MessagesIcon">&#x0040;</nobr>
214 <xsl:variable name="MessageCount" select="count(Message[@Status='Active'])"/>
215 <xsl:value-of select="$MessageCount"/>
216 Message<xsl:choose><xsl:when test="$MessageCount > 1">s</xsl:when></xsl:choose>
217 for
218 <xsl:value-of select="../@Name"/>
219 </div>
220 <div class="MessageBlockDiv" style="display: none; position: relative; padding-left: 5;">
221 <xsl:attribute name="id">
222 <xsl:value-of select="$MessageBlockId"/>
223 </xsl:attribute>
225 <table width="100%">
226 <tr>
227 <td class="ColumnHeader">Message Level</td>
228 <td class="ColumnHeader">Certainty</td>
229 <td class="ColumnHeader" width="100%">Resolution</td>
230 </tr>
231 <xsl:apply-templates select="Message[@Status='Active']"/>
232 </table>
233 </div>
235 </xsl:template>
237 <xsl:template match="Message">
239 <!-- Message Row -->
241 <xsl:variable name="messageId" select="generate-id()"/>
242 <xsl:variable name="rulename" select="TypeName"/>
244 <xsl:apply-templates select="Issue" >
245 <xsl:with-param name="messageId"><xsl:value-of select="$messageId"/></xsl:with-param>
246 </xsl:apply-templates>
248 <tr>
249 <td colspan="3">
250 <div class="MessageDiv" style="display: none">
251 <xsl:attribute name="id">
252 <xsl:value-of select="$messageId"/>
253 </xsl:attribute>
255 <!--- Rule Details -->
256 <table width="100%" class="RuleBlock">
257 <xsl:apply-templates select="Notes" mode="notes"/>
258 <xsl:apply-templates select="/FxCopReport/Rules/Rule[@TypeName=$rulename]" mode="ruledetails" />
259 </table>
260 </div>
261 </td>
262 </tr>
263 </xsl:template>
265 <xsl:template match="Issue">
266 <xsl:param name="messageId"></xsl:param>
267 <tr>
268 <xsl:attribute name="onClick">
269 javascript:ViewState('<xsl:value-of select="$messageId"/>');
270 </xsl:attribute>
272 <xsl:attribute name="bgcolor">
273 <xsl:choose>
274 <xsl:when test="position() mod 2 = 1">#EEEEEE</xsl:when>
275 <xsl:otherwise>white</xsl:otherwise>
276 </xsl:choose>
277 </xsl:attribute>
279 <td valign="top">
280 <xsl:attribute name="class"><xsl:value-of select="@Level" /></xsl:attribute>
281 <xsl:value-of select="@Level" />
282 </td>
283 <td valign="top">
284 <xsl:attribute name="class"><xsl:value-of select="@Level" /></xsl:attribute>
285 <xsl:value-of select="@Certainty" />
286 </td>
287 <td class="Resolution" valign="top">
288 <xsl:value-of select="text()" />
289 </td>
290 </tr>
291 <xsl:if test="@Path">
292 <tr class="SourceCode">
293 <td class="PropertyName">Source:</td>
294 <td class="PropertyContent" colspan="2">
296 <xsl:attribute name="href">
297 <xsl:value-of select="@Path"/>\<xsl:value-of select="@File"/>
298 </xsl:attribute>
299 <xsl:value-of select="@Path"/>\<xsl:value-of select="@File"/>
300 </a>
301 (Line <xsl:value-of select="@Line"/>)
302 </td>
303 </tr>
304 </xsl:if>
305 </xsl:template>
307 <xsl:template match="Notes" mode="notes">
308 <xsl:apply-templates select="User" mode="notes" />
309 </xsl:template>
311 <xsl:template match="User" mode="notes">
312 <tr class="Note">
313 <td class="Note">
314 <nobr class="NoteUser"><xsl:value-of select="@Name"/></nobr>
315 &#160;
316 <xsl:apply-templates select="Note" mode="notes">
317 <xsl:with-param name="username"><xsl:value-of select="@Name"/></xsl:with-param>
318 </xsl:apply-templates>
319 </td>
320 </tr>
321 </xsl:template>
323 <xsl:template match="Note" mode="notes">
324 <xsl:param name="username"></xsl:param>
325 <xsl:variable name="id" select="@Id"/>
326 <xsl:apply-templates select="/FxCopReport/Notes/User[@Name=$username]/Note[@Id=$id]" mode="notesPointer"/>
327 </xsl:template>
331 <xsl:template match="Note" mode="notesPointer">
332 <td colspan="2" class="Note">
333 <nobr class="NoteTime">[<xsl:value-of select="@Modified"/>]</nobr>:
334 <xsl:value-of select="."/>
335 </td>
336 </xsl:template>
338 <xsl:template match="Description" mode="ruledetails">
339 <tr>
340 <td class="PropertyName">Rule Description:</td>
341 <td class="PropertyContent"><xsl:value-of select="text()" /></td>
342 </tr>
343 </xsl:template>
345 <xsl:template match="LongDescription" mode="ruledetails">
346 <!-- Test, don't display line if no data present -->
347 <xsl:choose>
348 <xsl:when test="text()">
349 <tr>
350 <td class="PropertyName">Long Description:</td>
351 <td class="PropertyContent"><xsl:value-of select="text()" /></td>
352 </tr>
353 </xsl:when>
354 </xsl:choose>
355 </xsl:template>
357 <xsl:template match="File" mode="ruledetails">
358 <tr>
359 <td class="PropertyName">Rule File:</td>
360 <td class="PropertyContent"><xsl:value-of select="@Name"/> [<xsl:value-of select="@Version"/>]</td>
361 </tr>
362 </xsl:template>
364 <xsl:template match="Rule" mode="ruledetails">
365 <tr>
366 <td class="PropertyName">Rule:</td>
367 <td class="PropertyContent"><xsl:value-of select="Name" /></td>
368 </tr>
369 <tr>
370 <td class="PropertyName">Category:</td>
371 <td class="PropertyContent"><xsl:value-of select="Category" /></td>
372 </tr>
373 <tr>
374 <td class="PropertyName">Check Id:</td>
375 <td class="PropertyContent"><xsl:value-of select="CheckId" /></td>
376 </tr>
377 <xsl:apply-templates select="Description" mode="ruledetails" />
378 <xsl:apply-templates select="File" mode="ruledetails" />
379 </xsl:template>
381 <!-- End Rule Details -->
383 </xsl:stylesheet>