|
| 1 | +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
| 2 | +<!-- |
| 3 | + Licensed to the Apache Software Foundation (ASF) under one or more |
| 4 | + contributor license agreements. See the NOTICE file distributed with |
| 5 | + this work for additional information regarding copyright ownership. |
| 6 | + The ASF licenses this file to You under the Apache License, Version 2.0 |
| 7 | + (the "License"); you may not use this file except in compliance with |
| 8 | + the License. You may obtain a copy of the License at |
| 9 | +
|
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +
|
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | +--> |
| 18 | + |
| 19 | +<xsl:output method="html" indent="yes"/> |
| 20 | +<xsl:decimal-format decimal-separator="." grouping-separator="," /> |
| 21 | + |
| 22 | +<xsl:key name="files" match="file" use="@name" /> |
| 23 | + |
| 24 | +<!-- Checkstyle XML Style Sheet by Stephane Bailliez <[email protected]> --> |
| 25 | +<!-- Part of the Checkstyle distribution found at http://checkstyle.sourceforge.net --> |
| 26 | +<!-- Usage (generates checkstyle_report.html): --> |
| 27 | +<!-- <checkstyle failonviolation="false" config="${check.config}"> --> |
| 28 | +<!-- <fileset dir="${src.dir}" includes="**/*.java"/> --> |
| 29 | +<!-- <formatter type="xml" toFile="${doc.dir}/checkstyle_report.xml"/> --> |
| 30 | +<!-- </checkstyle> --> |
| 31 | +<!-- <style basedir="${doc.dir}" destdir="${doc.dir}" --> |
| 32 | +<!-- includes="checkstyle_report.xml" --> |
| 33 | +<!-- style="${doc.dir}/checkstyle-noframes-sorted.xsl"/> --> |
| 34 | + |
| 35 | +<xsl:template match="checkstyle"> |
| 36 | + <html> |
| 37 | + <head> |
| 38 | + <style type="text/css"> |
| 39 | + .bannercell { |
| 40 | + border: 0px; |
| 41 | + padding: 0px; |
| 42 | + } |
| 43 | + body { |
| 44 | + margin-left: 10; |
| 45 | + margin-right: 10; |
| 46 | + font:normal 80% arial,helvetica,sanserif; |
| 47 | + background-color:#FFFFFF; |
| 48 | + color:#000000; |
| 49 | + } |
| 50 | + .a td { |
| 51 | + background: #efefef; |
| 52 | + } |
| 53 | + .b td { |
| 54 | + background: #fff; |
| 55 | + } |
| 56 | + th, td { |
| 57 | + text-align: left; |
| 58 | + vertical-align: top; |
| 59 | + } |
| 60 | + th { |
| 61 | + font-weight:bold; |
| 62 | + background: #ccc; |
| 63 | + color: black; |
| 64 | + } |
| 65 | + table, th, td { |
| 66 | + font-size:100%; |
| 67 | + border: none |
| 68 | + } |
| 69 | + table.log tr td, tr th { |
| 70 | + |
| 71 | + } |
| 72 | + h2 { |
| 73 | + font-weight:bold; |
| 74 | + font-size:140%; |
| 75 | + margin-bottom: 5; |
| 76 | + } |
| 77 | + h3 { |
| 78 | + font-size:100%; |
| 79 | + font-weight:bold; |
| 80 | + background: #525D76; |
| 81 | + color: white; |
| 82 | + text-decoration: none; |
| 83 | + padding: 5px; |
| 84 | + margin-right: 2px; |
| 85 | + margin-left: 2px; |
| 86 | + margin-bottom: 0; |
| 87 | + } |
| 88 | + </style> |
| 89 | + </head> |
| 90 | + <body> |
| 91 | + <a name="top"></a> |
| 92 | + <!-- jakarta logo --> |
| 93 | + <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 94 | + <tr> |
| 95 | + <td class="bannercell" rowspan="2"> |
| 96 | + <!--a href="http://jakarta.apache.org/"> |
| 97 | + <img src="http://jakarta.apache.org/images/jakarta-logo.gif" alt="http://jakarta.apache.org" align="left" border="0"/> |
| 98 | + </a--> |
| 99 | + </td> |
| 100 | + <td class="text-align:right"><h2>CheckStyle Audit</h2></td> |
| 101 | + </tr> |
| 102 | + <tr> |
| 103 | + <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> |
| 104 | + </tr> |
| 105 | + </table> |
| 106 | + <hr size="1"/> |
| 107 | + |
| 108 | + <!-- Summary part --> |
| 109 | + <xsl:apply-templates select="." mode="summary"/> |
| 110 | + <hr size="1" width="100%" align="left"/> |
| 111 | + |
| 112 | + <!-- Package List part --> |
| 113 | + <xsl:apply-templates select="." mode="filelist"/> |
| 114 | + <hr size="1" width="100%" align="left"/> |
| 115 | + |
| 116 | + <!-- For each package create its part --> |
| 117 | + <xsl:apply-templates select="file[@name and generate-id(.) = generate-id(key('files', @name))]" /> |
| 118 | + |
| 119 | + <hr size="1" width="100%" align="left"/> |
| 120 | + |
| 121 | + |
| 122 | + </body> |
| 123 | + </html> |
| 124 | +</xsl:template> |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + <xsl:template match="checkstyle" mode="filelist"> |
| 129 | + <h3>Files</h3> |
| 130 | + <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> |
| 131 | + <tr> |
| 132 | + <th>Name</th> |
| 133 | + <th>Errors</th> |
| 134 | + </tr> |
| 135 | + <xsl:for-each select="file[@name and generate-id(.) = generate-id(key('files', @name))]"> |
| 136 | + <xsl:sort data-type="number" order="descending" select="count(key('files', @name)/error)"/> |
| 137 | + <xsl:variable name="errorCount" select="count(error)"/> |
| 138 | + <tr> |
| 139 | + <xsl:call-template name="alternated-row"/> |
| 140 | + <td><a href="#f-{@name}"><xsl:value-of select="@name"/></a></td> |
| 141 | + <td><xsl:value-of select="$errorCount"/></td> |
| 142 | + </tr> |
| 143 | + </xsl:for-each> |
| 144 | + </table> |
| 145 | + </xsl:template> |
| 146 | + |
| 147 | + |
| 148 | + <xsl:template match="file"> |
| 149 | + <a name="f-{@name}"></a> |
| 150 | + <h3>File <xsl:value-of select="@name"/></h3> |
| 151 | + |
| 152 | + <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> |
| 153 | + <tr> |
| 154 | + <th>Error Description</th> |
| 155 | + <th>Line</th> |
| 156 | + </tr> |
| 157 | + <xsl:for-each select="key('files', @name)/error"> |
| 158 | + <xsl:sort data-type="number" order="ascending" select="@line"/> |
| 159 | + <tr> |
| 160 | + <xsl:call-template name="alternated-row"/> |
| 161 | + <td><xsl:value-of select="@message"/></td> |
| 162 | + <td><xsl:value-of select="@line"/></td> |
| 163 | + </tr> |
| 164 | + </xsl:for-each> |
| 165 | + </table> |
| 166 | + <a href="#top">Back to top</a> |
| 167 | + </xsl:template> |
| 168 | + |
| 169 | + |
| 170 | + <xsl:template match="checkstyle" mode="summary"> |
| 171 | + <h3>Summary</h3> |
| 172 | + <xsl:variable name="fileCount" select="count(file[@name and generate-id(.) = generate-id(key('files', @name))])"/> |
| 173 | + <xsl:variable name="errorCount" select="count(file/error)"/> |
| 174 | + <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> |
| 175 | + <tr> |
| 176 | + <th>Files</th> |
| 177 | + <th>Errors</th> |
| 178 | + </tr> |
| 179 | + <tr> |
| 180 | + <xsl:call-template name="alternated-row"/> |
| 181 | + <td><xsl:value-of select="$fileCount"/></td> |
| 182 | + <td><xsl:value-of select="$errorCount"/></td> |
| 183 | + </tr> |
| 184 | + </table> |
| 185 | + </xsl:template> |
| 186 | + |
| 187 | + <xsl:template name="alternated-row"> |
| 188 | + <xsl:attribute name="class"> |
| 189 | + <xsl:if test="position() mod 2 = 1">a</xsl:if> |
| 190 | + <xsl:if test="position() mod 2 = 0">b</xsl:if> |
| 191 | + </xsl:attribute> |
| 192 | + </xsl:template> |
| 193 | +</xsl:stylesheet> |
| 194 | + |
| 195 | + |
0 commit comments