/tools/FxCop/Xml/FxCopReportExcludes.xsl

http://github.com/agross/netopenspace · Extensible Stylesheet Language Transformations · 376 lines · 339 code · 37 blank · 0 comment · 0 complexity · 573a5874afd92a61b3e793970cc4024e MD5 · raw file

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