You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

checkstyle.xsl 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  2. <xsl:output method="html" indent="yes"/>
  3. <xsl:decimal-format decimal-separator="." grouping-separator="," />
  4. <xsl:key name="files" match="file" use="@name" />
  5. <!-- Checkstyle XML Style Sheet by Stephane Bailliez <sbailliez@apache.org> -->
  6. <!-- Part of the Checkstyle distribution found at http://checkstyle.sourceforge.net -->
  7. <!-- Usage (generates checkstyle_report.html): -->
  8. <!-- <checkstyle failonviolation="false" config="${check.config}"> -->
  9. <!-- <fileset dir="${src.dir}" includes="**/*.java"/> -->
  10. <!-- <formatter type="xml" toFile="${doc.dir}/checkstyle_report.xml"/> -->
  11. <!-- </checkstyle> -->
  12. <!-- <style basedir="${doc.dir}" destdir="${doc.dir}" -->
  13. <!-- includes="checkstyle_report.xml" -->
  14. <!-- style="${doc.dir}/checkstyle-noframes-sorted.xsl"/> -->
  15. <xsl:template match="checkstyle">
  16. <html>
  17. <head>
  18. <style type="text/css">
  19. .bannercell {
  20. border: 0px;
  21. padding: 0px;
  22. }
  23. body {
  24. margin-left: 10;
  25. margin-right: 10;
  26. font:normal 80% arial,helvetica,sanserif;
  27. background-color:#FFFFFF;
  28. color:#000000;
  29. }
  30. .a td {
  31. background: #efefef;
  32. }
  33. .b td {
  34. background: #fff;
  35. }
  36. th, td {
  37. text-align: left;
  38. vertical-align: top;
  39. }
  40. th {
  41. font-weight:bold;
  42. background: #ccc;
  43. color: black;
  44. }
  45. table, th, td {
  46. font-size:100%;
  47. border: none
  48. }
  49. table.log tr td, tr th {
  50. }
  51. h2 {
  52. font-weight:bold;
  53. font-size:140%;
  54. margin-bottom: 5;
  55. }
  56. h3 {
  57. font-size:100%;
  58. font-weight:bold;
  59. background: #525D76;
  60. color: white;
  61. text-decoration: none;
  62. padding: 5px;
  63. margin-right: 2px;
  64. margin-left: 2px;
  65. margin-bottom: 0;
  66. }
  67. </style>
  68. </head>
  69. <body>
  70. <a name="top"></a>
  71. <!-- jakarta logo -->
  72. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  73. <tr>
  74. <td class="bannercell" rowspan="2">
  75. <!--a href="http://jakarta.apache.org/">
  76. <img src="http://jakarta.apache.org/images/jakarta-logo.gif" alt="http://jakarta.apache.org" align="left" border="0"/>
  77. </a-->
  78. </td>
  79. <td class="text-align:right"><h2>CheckStyle Audit</h2></td>
  80. </tr>
  81. <tr>
  82. <td class="text-align:right">Designed for use with <a href='http://checkstyle.sourceforge.net/'>CheckStyle</a> and <a href='http://jakarta.apache.org'>Ant</a>.</td>
  83. </tr>
  84. </table>
  85. <hr size="1"/>
  86. <!-- Summary part -->
  87. <xsl:apply-templates select="." mode="summary"/>
  88. <hr size="1" width="100%" align="left"/>
  89. <!-- Package List part -->
  90. <xsl:apply-templates select="." mode="filelist"/>
  91. <hr size="1" width="100%" align="left"/>
  92. <!-- For each package create its part -->
  93. <xsl:apply-templates select="file[@name and generate-id(.) = generate-id(key('files', @name))]" />
  94. <hr size="1" width="100%" align="left"/>
  95. </body>
  96. </html>
  97. </xsl:template>
  98. <xsl:template match="checkstyle" mode="filelist">
  99. <h3>Files</h3>
  100. <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
  101. <tr>
  102. <th>Name</th>
  103. <th>Errors</th>
  104. </tr>
  105. <xsl:for-each select="file[@name and generate-id(.) = generate-id(key('files', @name))]">
  106. <xsl:sort data-type="number" order="descending" select="count(key('files', @name)/error)"/>
  107. <xsl:variable name="errorCount" select="count(key('files', @name)/error)"/>
  108. <tr>
  109. <xsl:call-template name="alternated-row"/>
  110. <td><a href="#f-{@name}"><xsl:value-of select="@name"/></a></td>
  111. <td><xsl:value-of select="$errorCount"/></td>
  112. </tr>
  113. </xsl:for-each>
  114. </table>
  115. </xsl:template>
  116. <xsl:template match="file">
  117. <a name="f-{@name}"></a>
  118. <h3>File <xsl:value-of select="@name"/></h3>
  119. <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
  120. <tr>
  121. <th>Error Description</th>
  122. <th>Line</th>
  123. </tr>
  124. <xsl:for-each select="key('files', @name)/error">
  125. <xsl:sort data-type="number" order="ascending" select="@line"/>
  126. <tr>
  127. <xsl:call-template name="alternated-row"/>
  128. <td><xsl:value-of select="@message"/></td>
  129. <td><xsl:value-of select="@line"/></td>
  130. </tr>
  131. </xsl:for-each>
  132. </table>
  133. <a href="#top">Back to top</a>
  134. </xsl:template>
  135. <xsl:template match="checkstyle" mode="summary">
  136. <h3>Summary</h3>
  137. <xsl:variable name="fileCount" select="count(file[@name and generate-id(.) = generate-id(key('files', @name))])"/>
  138. <xsl:variable name="errorCount" select="count(file/error)"/>
  139. <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
  140. <tr>
  141. <th>Files</th>
  142. <th>Errors</th>
  143. </tr>
  144. <tr>
  145. <xsl:call-template name="alternated-row"/>
  146. <td><xsl:value-of select="$fileCount"/></td>
  147. <td><xsl:value-of select="$errorCount"/></td>
  148. </tr>
  149. </table>
  150. </xsl:template>
  151. <xsl:template name="alternated-row">
  152. <xsl:attribute name="class">
  153. <xsl:if test="position() mod 2 = 1">a</xsl:if>
  154. <xsl:if test="position() mod 2 = 0">b</xsl:if>
  155. </xsl:attribute>
  156. </xsl:template>
  157. </xsl:stylesheet>