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