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">
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';
29 block.style.display='none';
35 <table class=
"section-table" cellSpacing=
"0" cellPadding=
"2" width=
"98%" border=
"0">
37 <td class=
"sectionheader" colSpan=
"4">FxCop
<xsl:value-of select=
"$fxcop.version" /> Summary
</td>
40 <td><b>Target rules
</b></td>
42 <xsl:apply-templates select=
"$targets.list"/>
44 <td><b>Namespace rules
</b></td>
46 <xsl:apply-templates select=
"$namespaces.list" />
52 <!-- Reports rules relating specifically to namespaces -->
53 <xsl:template match=
"Namespace">
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>
71 <xsl:template match=
"Target">
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"/>
91 <xsl:template match=
"Module">
92 <xsl:apply-templates select=
"Namespaces//Classes">
93 <xsl:sort select=
"Class"/>
94 </xsl:apply-templates>
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">
102 <td colspan=
"2" class=
"fxcop-class-header"><img src=
"images/class.gif"/><xsl:value-of select=
"@Name"/></td>
105 <xsl:if test=
"Messages">
108 <xsl:apply-templates select=
"Messages">
109 <xsl:sort select=
"Message//@Level"/>
110 </xsl:apply-templates>
115 <xsl:if test=
"Fields">
117 <xsl:apply-templates select=
"Fields">
118 <xsl:sort select=
"Field" />
119 </xsl:apply-templates>
122 <xsl:if test=
"Properties">
124 <xsl:apply-templates select=
"Properties">
125 <xsl:sort select=
"Property"/>
126 </xsl:apply-templates>
129 <xsl:apply-templates select=
"Methods" mode=
"fromClass">
130 <xsl:sort select=
"Method"/>
131 </xsl:apply-templates>
136 <!-- Displays the fields. These refer to variables at class level -->
137 <xsl:template match=
"Field">
139 <td width=
"20%"><img src=
"images/field.gif"/><xsl:value-of select=
"@Name"/></td>
141 <xsl:apply-templates select=
"Messages">
142 <xsl:sort select=
"Message//@Level" />
143 </xsl:apply-templates>
148 <!-- Displays methods on the class -->
149 <xsl:template match=
"Method" mode=
"fromClass">
151 <td colspan=
"2"><img src=
"images/method.gif"/><xsl:value-of select=
"@Name"/></td>
154 <td width=
"20%"></td>
156 <xsl:apply-templates select=
"Messages">
157 <xsl:sort select=
"Message//@Level" />
158 </xsl:apply-templates>
163 <!-- Displays the summary of the property -->
164 <xsl:template match=
"Property">
166 <td colspan=
"3"><img src=
"images/property.gif"/><xsl:value-of select=
"@Name"/></td>
168 <xsl:apply-templates select=
"Methods" mode=
"fromProperty">
169 <xsl:sort select=
"@Name"/>
170 </xsl:apply-templates>
173 <!-- Displays accessor methods for properties -->
174 <xsl:template match=
"Method" mode=
"fromProperty">
176 <td width=
"10%"></td>
177 <td colspan=
"2"><xsl:value-of select=
"@Name"/></td>
180 <td width=
"10%"></td>
181 <td width=
"10%"></td>
183 <xsl:apply-templates select=
"Messages">
184 <xsl:sort select=
"Message//@Level" />
185 </xsl:apply-templates>
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">
202 <xsl:if test=
"$level='CriticalError'">
203 <xsl:attribute name=
"src">images/fxcop-critical-error.gif
</xsl:attribute>
205 <xsl:if test=
"$level='Error'">
206 <xsl:attribute name=
"src">images/fxcop-error.gif
</xsl:attribute>
208 <xsl:if test=
"$level='Warning'">
209 <xsl:attribute name=
"src">images/fxcop-warning.gif
</xsl:attribute>
211 <xsl:if test=
"$level='CriticalWarning'">
212 <xsl:attribute name=
"src">images/fxcop-critical-warning.gif
</xsl:attribute>
214 <xsl:attribute name=
"alt"><xsl:value-of select=
"$level"/> (
<xsl:value-of select=
"$certainty"/>% certainty)
</xsl:attribute>
217 <xsl:attribute name=
"href"><xsl:value-of select=
"$fxcop.root/Rules/Rule[@TypeName=$ruleName]/Url"/></xsl:attribute>
218 <xsl:value-of select=
"$ruleName"/>
220 <xsl:if test=
".//SourceCode/@Line">
221 in
<xsl:value-of select=
"$sourceFile"/>
223 <xsl:if test=
"$line > 0">
224 (line:
<xsl:value-of select=
"$line"/>)
226 <div style=
"margin-left:18px; margin-bottom:4px">
227 <xsl:value-of select=
"$resolution"/>