Fix the build.
[castle.git] / Samples / MonoRail / MRCCnetDashboard / Dashboard.Web / xsl / fxcop-summary.xsl
blob320d5542b8a21bcfb09c85d6c26825e7c2aa7c12
1 <?xml version="1.0"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schemas.microsoft.com/intellisense/ie5">
4 <xsl:output method="html"/>
6 <xsl:variable name="fxcop.root" select="//FxCopReport"/>
7 <xsl:variable name="fxcop.version" select="$fxcop.root/@Version" />
8 <xsl:variable name="fxcop.lastAnalysis" select="$fxcop.root/@LastAnalysis"/>
9 <xsl:variable name="message.list" select="$fxcop.root//Messages"/>
11 <xsl:template match="/">
12 <xsl:variable name="modifications.list" select="/cruisecontrol/modifications" />
13 <xsl:variable name="modifications.list.count" select="count($modifications.list)" />
14 <xsl:variable name="message.list.count" select="count($message.list)"/>
15 <xsl:variable name="namespaces.list" select="$fxcop.root/Namespaces"/>
16 <xsl:variable name="targets.list" select="$fxcop.root/Targets"/>
18 <xsl:if test="($message.list.count > 0) and ($modifications.list.count > 0)">
19 <div id="fxcop-summary">
20 <script>
21 function toggleRuleVisiblity(blockId)
23 var block = document.getElementById(blockId);
24 var plus = document.getElementById(blockId + '.plus');
25 if (block.style.display=='none') {
26 block.style.display='block';
27 plus.innerText='- ';
28 } else {
29 block.style.display='none';
30 plus.innerText='+ ';
33 </script>
35 <table class="section-table" cellSpacing="0" cellPadding="2" width="98%" border="0">
36 <tr>
37 <td class="sectionheader" colSpan="4">FxCop <xsl:value-of select="$fxcop.version" /> Summary</td>
38 </tr>
39 <tr>
40 <td><b>Target rules</b></td>
41 </tr>
42 <xsl:apply-templates select="$targets.list"/>
43 <tr>
44 <td><b>Namespace rules</b></td>
45 </tr>
46 <xsl:apply-templates select="$namespaces.list" />
47 </table>
48 </div>
49 </xsl:if>
50 </xsl:template>
52 <!-- Reports rules relating specifically to namespaces -->
53 <xsl:template match="Namespace">
54 <xsl:if test="@Name">
55 <tr style="cursor:pointer">
56 <xsl:attribute name="onClick">toggleRuleVisiblity('<xsl:value-of select="@Name"/>');</xsl:attribute>
57 <td colspan="2" class="section-data">
58 <span><xsl:attribute name="id"><xsl:value-of select="@Name"/>.plus</xsl:attribute>+ </span>
59 <xsl:value-of select="@Name" />
60 <div style="display: none; border: 1px solid gray">
61 <xsl:attribute name="id"><xsl:value-of select="@Name"/></xsl:attribute>
62 <xsl:apply-templates select="Messages">
63 <xsl:sort select="Message//@Level" />
64 </xsl:apply-templates>
65 </div>
66 </td>
67 </tr>
68 </xsl:if>
69 </xsl:template>
71 <xsl:template match="Target">
72 <xsl:if test="@Name">
73 <xsl:variable name="filename" select="translate(@Name, '\', '/')"/>
74 <tr style="cursor:pointer">
75 <xsl:attribute name="onClick">toggleRuleVisiblity('<xsl:value-of select="$filename"/>');</xsl:attribute>
76 <td colspan="2" class="section-data">
77 <span><xsl:attribute name="id"><xsl:value-of select="$filename"/>.plus</xsl:attribute>+ </span>
78 <xsl:value-of select="@Name" />
79 <div style="display: none; border: 1px solid gray">
80 <xsl:attribute name="id"><xsl:value-of select="$filename"/></xsl:attribute>
81 <xsl:apply-templates select="Messages">
82 <xsl:sort select="Message//@Level" />
83 </xsl:apply-templates>
84 <xsl:apply-templates select="Modules"/>
85 </div>
86 </td>
87 </tr>
88 </xsl:if>
89 </xsl:template>
91 <xsl:template match="Module">
92 <xsl:apply-templates select="Namespaces//Classes">
93 <xsl:sort select="Class"/>
94 </xsl:apply-templates>
95 </xsl:template>
97 <!-- Starts of the rules relating to class defined in the application -->
98 <xsl:template match="Class">
99 <div class="fxcop-class">
100 <table style="WIDTH: 30pc">
101 <tr>
102 <td colspan="2" class="fxcop-class-header"><img src="images/class.gif"/><xsl:value-of select="@Name"/></td>
103 </tr>
105 <xsl:if test="Messages">
106 <tr>
107 <td>
108 <xsl:apply-templates select="Messages">
109 <xsl:sort select="Message//@Level"/>
110 </xsl:apply-templates>
111 </td>
112 </tr>
113 </xsl:if>
115 <xsl:if test="Fields">
116 <tr>
117 <xsl:apply-templates select="Fields">
118 <xsl:sort select="Field" />
119 </xsl:apply-templates>
120 </tr>
121 </xsl:if>
122 <xsl:if test="Properties">
123 <tr>
124 <xsl:apply-templates select="Properties">
125 <xsl:sort select="Property"/>
126 </xsl:apply-templates>
127 </tr>
128 </xsl:if>
129 <xsl:apply-templates select="Methods" mode="fromClass">
130 <xsl:sort select="Method"/>
131 </xsl:apply-templates>
132 </table>
133 </div>
134 </xsl:template>
136 <!-- Displays the fields. These refer to variables at class level -->
137 <xsl:template match="Field">
138 <tr>
139 <td width="20%"><img src="images/field.gif"/><xsl:value-of select="@Name"/></td>
140 <td>
141 <xsl:apply-templates select="Messages">
142 <xsl:sort select="Message//@Level" />
143 </xsl:apply-templates>
144 </td>
145 </tr>
146 </xsl:template>
148 <!-- Displays methods on the class -->
149 <xsl:template match="Method" mode="fromClass">
150 <tr>
151 <td colspan="2"><img src="images/method.gif"/><xsl:value-of select="@Name"/></td>
152 </tr>
153 <tr>
154 <td width="20%"></td>
155 <td>
156 <xsl:apply-templates select="Messages">
157 <xsl:sort select="Message//@Level" />
158 </xsl:apply-templates>
159 </td>
160 </tr>
161 </xsl:template>
163 <!-- Displays the summary of the property -->
164 <xsl:template match="Property">
165 <tr>
166 <td colspan="3"><img src="images/property.gif"/><xsl:value-of select="@Name"/></td>
167 </tr>
168 <xsl:apply-templates select="Methods" mode="fromProperty">
169 <xsl:sort select="@Name"/>
170 </xsl:apply-templates>
171 </xsl:template>
173 <!-- Displays accessor methods for properties -->
174 <xsl:template match="Method" mode="fromProperty">
175 <tr>
176 <td width="10%"></td>
177 <td colspan="2"><xsl:value-of select="@Name"/></td>
178 </tr>
179 <tr>
180 <td width="10%"></td>
181 <td width="10%"></td>
182 <td>
183 <xsl:apply-templates select="Messages">
184 <xsl:sort select="Message//@Level" />
185 </xsl:apply-templates>
186 </td>
187 </tr>
188 </xsl:template>
192 <xsl:template match="Message">
193 <xsl:variable name="level" select=".//@Level" />
194 <xsl:variable name="certainty" select=".//@Certainty" />
195 <xsl:variable name="ruleName" select="Rule/@TypeName" />
196 <xsl:variable name="sourceFile" select=".//SourceCode/@File" />
197 <xsl:variable name="line" select=".//SourceCode/@Line" />
198 <xsl:variable name="resolution" select=".//Resolution/Text" />
200 <div class="section-data" style="margin-left:10px">
201 <img>
202 <xsl:if test="$level='CriticalError'">
203 <xsl:attribute name="src">images/fxcop-critical-error.gif</xsl:attribute>
204 </xsl:if>
205 <xsl:if test="$level='Error'">
206 <xsl:attribute name="src">images/fxcop-error.gif</xsl:attribute>
207 </xsl:if>
208 <xsl:if test="$level='Warning'">
209 <xsl:attribute name="src">images/fxcop-warning.gif</xsl:attribute>
210 </xsl:if>
211 <xsl:if test="$level='CriticalWarning'">
212 <xsl:attribute name="src">images/fxcop-critical-warning.gif</xsl:attribute>
213 </xsl:if>
214 <xsl:attribute name="alt"><xsl:value-of select="$level"/> (<xsl:value-of select="$certainty"/>% certainty)</xsl:attribute>
215 </img>
217 <xsl:attribute name="href"><xsl:value-of select="$fxcop.root/Rules/Rule[@TypeName=$ruleName]/Url"/></xsl:attribute>
218 <xsl:value-of select="$ruleName"/>
219 </a>
220 <xsl:if test=".//SourceCode/@Line">
221 in <xsl:value-of select="$sourceFile"/>
222 </xsl:if>
223 <xsl:if test="$line > 0">
224 (line: <xsl:value-of select="$line"/>)
225 </xsl:if>
226 <div style="margin-left:18px; margin-bottom:4px">
227 <xsl:value-of select="$resolution"/>
228 </div>
229 </div>
230 </xsl:template>
232 </xsl:stylesheet>