/tools/StyleCop/StyleCopReport.xsl

http://github.com/agross/netopenspace · Extensible Stylesheet Language Transformations · 325 lines · 324 code · 1 blank · 0 comment · 0 complexity · 2359e421426dfcbaff9f65485700ff19 MD5 · raw file

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--Designed and generated by Altova StyleVision Enterprise Edition 2008 rel. 2 sp2 - see http://www.altova.com/stylevision for more information.-->
  3. <xsl:stylesheet version="2.0"
  4. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  5. xmlns:mstns="http://stylecopcmd.sourceforge.net/StyleCopReport.xsd"
  6. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  7. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  8. exclude-result-prefixes="mstns xs xsi">
  9. <xsl:output version="4.0"
  10. method="html"
  11. indent="yes"
  12. encoding="UTF-8"
  13. doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
  14. doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
  15. <xsl:param name="SV_OutputFormat"
  16. select="'HTML'" />
  17. <xsl:template match="/">
  18. <html>
  19. <head>
  20. <title>StyleCop Report</title>
  21. <style type="text/css">
  22. body {
  23. font-family: Segoe UI, Verdana, Tahoma, Sans-Serif;
  24. font-size: .8em;
  25. }
  26. .violation, .value, code {
  27. color: #C60A0A;
  28. }
  29. h3 {
  30. color: navy;
  31. }
  32. table {
  33. width: 100%;
  34. border: none;
  35. }
  36. .expand{
  37. cursor: pointer;
  38. }
  39. td {
  40. padding: .2em;
  41. }
  42. .violation {
  43. width: 80px;
  44. }
  45. .name {
  46. width: 250px;
  47. }
  48. .line {
  49. width: 50px;
  50. }
  51. .subitem {
  52. display: none;
  53. margin-left: 1em;
  54. }
  55. .label {
  56. font-weight: bold;
  57. }
  58. tr.level1 {background-color: #f0f0f0;}
  59. tr.level2 {background-color: #e1e1e1;}
  60. tr.level3 {background-color: #d2d2d2;}
  61. tr.level4 {background-color: silver;}
  62. table.level5 {background-color: #dee7ec;}
  63. code {
  64. display: block;
  65. padding: 1em 0.3em;
  66. background-color: #ffffe9;
  67. font-size: 1.2em;
  68. }
  69. </style>
  70. <script type="text/javascript">
  71. //{concat(concat(&quot;var el = document.getElementById(&apos;solution&quot;, mstns:ID), &quot;&apos;);
  72. function toggleExpand(element)
  73. {
  74. el = document.getElementById(element);
  75. if (!el)
  76. {
  77. return;
  78. }
  79. if (el.style.display=='block')
  80. {
  81. el.style.display='none';
  82. }
  83. else
  84. {
  85. el.style.display='block';
  86. }
  87. }
  88. </script>
  89. </head>
  90. <body>
  91. <xsl:for-each select="/">
  92. <h3>
  93. <xsl:text>StyleCop Report</xsl:text>
  94. </h3>
  95. <ul id="summary">
  96. <li>
  97. <span class="label">
  98. <xsl:text>Total Solutions: </xsl:text>
  99. </span>
  100. <span class="value">
  101. <xsl:value-of select="count(mstns:StyleCopReport/mstns:Solutions)" />
  102. </span>
  103. </li>
  104. <li>
  105. <span class="label">
  106. <xsl:text>Total Source Files: </xsl:text>
  107. </span>
  108. <span class="value">
  109. <xsl:value-of select="count(//mstns:SourceCodeFiles)" />
  110. </span>
  111. </li>
  112. <li>
  113. <span class="label">
  114. <xsl:text>Total Number of Violations: </xsl:text>
  115. </span>
  116. <span class="value">
  117. <xsl:value-of select="count(//mstns:Violations)" />
  118. </span>
  119. </li>
  120. </ul>
  121. <table>
  122. <tbody>
  123. <tr>
  124. <td class="violation">
  125. <xsl:text>Violations</xsl:text>
  126. </td>
  127. <td class="name">
  128. <xsl:text>Solution Name</xsl:text>
  129. </td>
  130. <td>
  131. <xsl:text>Path</xsl:text>
  132. </td>
  133. </tr>
  134. </tbody>
  135. </table>
  136. <xsl:for-each select="mstns:StyleCopReport">
  137. <xsl:for-each select="mstns:Solutions">
  138. <table class="expand">
  139. <tbody onclick="toggleExpand('{concat('solution', mstns:ID)}')">
  140. <tr class="level1">
  141. <td class="violation">
  142. <xsl:value-of select="count(mstns:Projects/mstns:SourceCodeFiles/mstns:Violations)" />
  143. </td>
  144. <td class="name">
  145. <xsl:for-each select="mstns:Name">
  146. <xsl:apply-templates />
  147. </xsl:for-each>
  148. </td>
  149. <td>
  150. <xsl:for-each select="mstns:Location">
  151. <xsl:apply-templates />
  152. </xsl:for-each>
  153. </td>
  154. </tr>
  155. </tbody>
  156. </table>
  157. <div class="subitem"
  158. id='{concat("solution", mstns:ID)}'>
  159. <xsl:for-each select="mstns:Projects">
  160. <table>
  161. <tbody>
  162. <tr>
  163. <td class="violation">
  164. <xsl:text>Violations</xsl:text>
  165. </td>
  166. <td class="name">
  167. <xsl:text>Project Name</xsl:text>
  168. </td>
  169. <td>
  170. <xsl:text>Path</xsl:text>
  171. </td>
  172. </tr>
  173. </tbody>
  174. </table>
  175. <table class="expand">
  176. <tbody onclick="toggleExpand('{concat('project', mstns:ID)}')">
  177. <tr class="level2">
  178. <td class="violation">
  179. <xsl:value-of select="count(mstns:SourceCodeFiles/mstns:Violations)" />
  180. </td>
  181. <td class="name">
  182. <xsl:for-each select="mstns:Name">
  183. <xsl:apply-templates />
  184. </xsl:for-each>
  185. </td>
  186. <td>
  187. <xsl:for-each select="mstns:Location">
  188. <xsl:apply-templates />
  189. </xsl:for-each>
  190. </td>
  191. </tr>
  192. </tbody>
  193. </table>
  194. <div class="subitem"
  195. id='{concat("project", mstns:ID )}'>
  196. <table>
  197. <tbody>
  198. <tr>
  199. <td class="violation">
  200. <xsl:text>Violations</xsl:text>
  201. </td>
  202. <td class="name">
  203. <xsl:text>Name</xsl:text>
  204. </td>
  205. <td>
  206. <xsl:text>Path</xsl:text>
  207. </td>
  208. </tr>
  209. </tbody>
  210. </table>
  211. <xsl:for-each select="mstns:SourceCodeFiles">
  212. <xsl:if test="count(mstns:Violations) &gt; 0">
  213. <table class="expand">
  214. <tbody onclick="toggleExpand('{concat('files', mstns:ID)}')">
  215. <tr class="level3">
  216. <td class="violation">
  217. <xsl:value-of select="count(mstns:Violations)" />
  218. </td>
  219. <td class="name">
  220. <xsl:for-each select="mstns:Name">
  221. <xsl:apply-templates />
  222. </xsl:for-each>
  223. </td>
  224. <td>
  225. <xsl:for-each select="mstns:Path">
  226. <xsl:apply-templates />
  227. </xsl:for-each>
  228. </td>
  229. </tr>
  230. </tbody>
  231. </table>
  232. <div class="subitem"
  233. id='{concat("files", mstns:ID )}'>
  234. <table>
  235. <tbody>
  236. <tr>
  237. <td class="violation">
  238. <xsl:text>Rule</xsl:text>
  239. </td>
  240. <td>
  241. <xsl:text>Description</xsl:text>
  242. </td>
  243. <td class="line">
  244. <xsl:text>Line</xsl:text>
  245. </td>
  246. </tr>
  247. </tbody>
  248. </table>
  249. <xsl:for-each select="mstns:Violations">
  250. <xsl:for-each select="mstns:Rules">
  251. <table class="expand"
  252. onclick="toggleExpand('line{concat(mstns:CheckId, ../mstns:ID)}'); toggleExpand('{concat(mstns:CheckId, ../mstns:ID)}');">
  253. <tbody>
  254. <tr class="level4">
  255. <td class="violation">
  256. <xsl:for-each select="mstns:CheckId">
  257. <xsl:apply-templates />
  258. </xsl:for-each>
  259. </td>
  260. <td>
  261. <xsl:value-of select="../mstns:Message" />
  262. </td>
  263. <td class="line">
  264. <xsl:value-of select="../mstns:Line" />
  265. </td>
  266. </tr>
  267. </tbody>
  268. </table>
  269. <div class="subitem"
  270. id="line{concat(mstns:CheckId, ../mstns:ID)}">
  271. <code>
  272. <xsl:value-of select="../mstns:SourceCodeLine" />
  273. </code>
  274. </div>
  275. <table class="subitem level5"
  276. id="{concat(mstns:CheckId, ../mstns:ID)}">
  277. <tbody>
  278. <tr>
  279. <td class="label">
  280. <xsl:text>Name:</xsl:text>
  281. </td>
  282. <td>
  283. <xsl:for-each select="mstns:Name">
  284. <xsl:apply-templates />
  285. </xsl:for-each>
  286. </td>
  287. </tr>
  288. <tr>
  289. <td class="label">
  290. <xsl:text>Namespace:</xsl:text>
  291. </td>
  292. <td>
  293. <xsl:for-each select="mstns:Namespace">
  294. <xsl:apply-templates />
  295. </xsl:for-each>
  296. </td>
  297. </tr>
  298. <tr>
  299. <td class="label">
  300. <xsl:text>Description:</xsl:text>
  301. </td>
  302. <td>
  303. <xsl:for-each select="mstns:Description">
  304. <xsl:apply-templates />
  305. </xsl:for-each>
  306. </td>
  307. </tr>
  308. </tbody>
  309. </table>
  310. </xsl:for-each>
  311. </xsl:for-each>
  312. </div>
  313. </xsl:if>
  314. </xsl:for-each>
  315. </div>
  316. </xsl:for-each>
  317. </div>
  318. </xsl:for-each>
  319. </xsl:for-each>
  320. </xsl:for-each>
  321. </body>
  322. </html>
  323. </xsl:template>
  324. </xsl:stylesheet>