[28082] | 1 | <?xml version="1.0"?>
|
---|
| 2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
---|
| 3 | xmlns:lxslt="http://xml.apache.org/xslt"
|
---|
| 4 | xmlns:redirect="http://xml.apache.org/xalan/redirect"
|
---|
| 5 | extension-element-prefixes="redirect">
|
---|
| 6 |
|
---|
| 7 | <!--
|
---|
| 8 | Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
| 9 | contributor license agreements. See the NOTICE file distributed with
|
---|
| 10 | this work for additional information regarding copyright ownership.
|
---|
| 11 | The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
| 12 | (the "License"); you may not use this file except in compliance with
|
---|
| 13 | the License. You may obtain a copy of the License at
|
---|
| 14 |
|
---|
| 15 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 16 |
|
---|
| 17 | Unless required by applicable law or agreed to in writing, software
|
---|
| 18 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 20 | See the License for the specific language governing permissions and
|
---|
| 21 | limitations under the License.
|
---|
| 22 | -->
|
---|
| 23 |
|
---|
| 24 | <xsl:output method="html" indent="yes" encoding="US-ASCII"/>
|
---|
| 25 | <xsl:decimal-format decimal-separator="." grouping-separator="," />
|
---|
| 26 |
|
---|
| 27 | <xsl:param name="output.dir" select="'.'"/>
|
---|
| 28 | <xsl:param name="basedir" select="'.'"/>
|
---|
| 29 |
|
---|
| 30 | <xsl:template match="checkstyle">
|
---|
| 31 | <!-- create the index.html -->
|
---|
| 32 | <redirect:write file="{$output.dir}/index.html">
|
---|
| 33 | <xsl:call-template name="index.html"/>
|
---|
| 34 | </redirect:write>
|
---|
| 35 |
|
---|
| 36 | <!-- create the stylesheet.css -->
|
---|
| 37 | <redirect:write file="{$output.dir}/stylesheet.css">
|
---|
| 38 | <xsl:call-template name="stylesheet.css"/>
|
---|
| 39 | </redirect:write>
|
---|
| 40 |
|
---|
| 41 | <!-- create the overview-summary.html at the root -->
|
---|
| 42 | <redirect:write file="{$output.dir}/overview-frame.html">
|
---|
| 43 | <xsl:apply-templates select="." mode="overview"/>
|
---|
| 44 | </redirect:write>
|
---|
| 45 |
|
---|
| 46 | <!-- create the all-classes.html at the root -->
|
---|
| 47 | <redirect:write file="{$output.dir}/allclasses-frame.html">
|
---|
| 48 | <xsl:apply-templates select="." mode="all.classes"/>
|
---|
| 49 | </redirect:write>
|
---|
| 50 |
|
---|
| 51 | <!-- process all files -->
|
---|
| 52 | <xsl:apply-templates select="file[count(error) != 0]"/>
|
---|
| 53 | </xsl:template>
|
---|
| 54 |
|
---|
| 55 | <xsl:template name="index.html">
|
---|
| 56 | <html>
|
---|
| 57 | <head>
|
---|
| 58 | <title>CheckStyle Audit</title>
|
---|
| 59 | </head>
|
---|
| 60 | <frameset cols="20%,80%">
|
---|
| 61 | <frame src="allclasses-frame.html" name="fileListFrame"/>
|
---|
| 62 | <frame src="overview-frame.html" name="fileFrame"/>
|
---|
| 63 | </frameset>
|
---|
| 64 | <noframes>
|
---|
| 65 | <h2>Frame Alert</h2>
|
---|
| 66 | <p>
|
---|
| 67 | This document is designed to be viewed using the frames feature.
|
---|
| 68 | If you see this message, you are using a non-frame-capable web client.
|
---|
| 69 | </p>
|
---|
| 70 | </noframes>
|
---|
| 71 | </html>
|
---|
| 72 | </xsl:template>
|
---|
| 73 |
|
---|
| 74 | <xsl:template name="pageHeader">
|
---|
| 75 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 76 | <tr>
|
---|
| 77 | <td class="text-align:right"><h2>CheckStyle Audit</h2></td>
|
---|
| 78 | </tr>
|
---|
| 79 | <tr>
|
---|
| 80 | <td class="text-align:right">Designed for use with
|
---|
| 81 | <a href='http://checkstyle.sourceforge.net/'>CheckStyle</a> and
|
---|
| 82 | <a href='http://ant.apache.org/'>Ant</a>.</td>
|
---|
| 83 | </tr>
|
---|
| 84 | </table>
|
---|
| 85 | <hr size="1"/>
|
---|
| 86 | </xsl:template>
|
---|
| 87 |
|
---|
| 88 | <xsl:template match="checkstyle" mode="overview">
|
---|
| 89 | <html>
|
---|
| 90 | <head>
|
---|
| 91 | <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
|
---|
| 92 | </head>
|
---|
| 93 | <body>
|
---|
| 94 | <!-- page header -->
|
---|
| 95 | <xsl:call-template name="pageHeader"/>
|
---|
| 96 |
|
---|
| 97 | <!-- Summary part -->
|
---|
| 98 | <xsl:apply-templates select="." mode="summary"/>
|
---|
| 99 | <hr size="1" width="100%" align="left"/>
|
---|
| 100 |
|
---|
| 101 | <!-- File list part -->
|
---|
| 102 | <xsl:apply-templates select="." mode="filelist"/>
|
---|
| 103 | </body>
|
---|
| 104 | </html>
|
---|
| 105 | </xsl:template>
|
---|
| 106 |
|
---|
| 107 | <xsl:template name="stylesheet.css">
|
---|
| 108 | .bannercell {
|
---|
| 109 | border: 0px;
|
---|
| 110 | padding: 0px;
|
---|
| 111 | }
|
---|
| 112 | body {
|
---|
| 113 | margin-left: 10;
|
---|
| 114 | margin-right: 10;
|
---|
| 115 | font:normal 80% arial,helvetica,sanserif;
|
---|
| 116 | background-color:#FFFFFF;
|
---|
| 117 | color:#000000;
|
---|
| 118 | }
|
---|
| 119 | .oddrow td {
|
---|
| 120 | background: #efefef;
|
---|
| 121 | }
|
---|
| 122 | .evenrow td {
|
---|
| 123 | background: #fff;
|
---|
| 124 | }
|
---|
| 125 | th, td {
|
---|
| 126 | text-align: left;
|
---|
| 127 | vertical-align: top;
|
---|
| 128 | }
|
---|
| 129 | th {
|
---|
| 130 | font-weight:bold;
|
---|
| 131 | background: #ccc;
|
---|
| 132 | color: black;
|
---|
| 133 | }
|
---|
| 134 | table, th, td {
|
---|
| 135 | font-size:100%;
|
---|
| 136 | border: none
|
---|
| 137 | }
|
---|
| 138 | table.log tr td, tr th {
|
---|
| 139 |
|
---|
| 140 | }
|
---|
| 141 | h2 {
|
---|
| 142 | font-weight:bold;
|
---|
| 143 | font-size:140%;
|
---|
| 144 | margin-bottom: 5;
|
---|
| 145 | }
|
---|
| 146 | h3 {
|
---|
| 147 | font-size:100%;
|
---|
| 148 | font-weight:bold;
|
---|
| 149 | background: #525D76;
|
---|
| 150 | color: white;
|
---|
| 151 | text-decoration: none;
|
---|
| 152 | padding: 5px;
|
---|
| 153 | margin-right: 2px;
|
---|
| 154 | margin-left: 2px;
|
---|
| 155 | margin-bottom: 0;
|
---|
| 156 | }
|
---|
| 157 | </xsl:template>
|
---|
| 158 |
|
---|
| 159 | <!--
|
---|
| 160 | Creates an all-classes.html file that contains a link to all files.
|
---|
| 161 | -->
|
---|
| 162 | <xsl:template match="checkstyle" mode="all.classes">
|
---|
| 163 | <html>
|
---|
| 164 | <head>
|
---|
| 165 | <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
|
---|
| 166 | </head>
|
---|
| 167 | <body>
|
---|
| 168 | <h2>Files</h2>
|
---|
| 169 | <p>
|
---|
| 170 | <table width="100%">
|
---|
| 171 | <!-- For each file create its part -->
|
---|
| 172 | <xsl:apply-templates select="file[count(error) != 0]" mode="all.classes">
|
---|
| 173 | <xsl:sort select="substring-after(@name, $basedir)"/>
|
---|
| 174 | </xsl:apply-templates>
|
---|
| 175 | </table>
|
---|
| 176 | </p>
|
---|
| 177 | </body>
|
---|
| 178 | </html>
|
---|
| 179 | </xsl:template>
|
---|
| 180 |
|
---|
| 181 | <xsl:template match="checkstyle" mode="filelist">
|
---|
| 182 | <h3>Files</h3>
|
---|
| 183 | <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
|
---|
| 184 | <tr>
|
---|
| 185 | <th>Name</th>
|
---|
| 186 | <th>Errors</th>
|
---|
| 187 | </tr>
|
---|
| 188 | <xsl:apply-templates select="file[count(error) != 0]" mode="filelist">
|
---|
| 189 | <xsl:sort select="count(error)" order="descending" data-type="number"/>
|
---|
| 190 | </xsl:apply-templates>
|
---|
| 191 | </table>
|
---|
| 192 | </xsl:template>
|
---|
| 193 |
|
---|
| 194 | <xsl:template match="file" mode="filelist">
|
---|
| 195 | <tr>
|
---|
| 196 | <xsl:call-template name="alternated-row"/>
|
---|
| 197 | <td nowrap="nowrap">
|
---|
| 198 | <a>
|
---|
| 199 | <xsl:attribute name="href">
|
---|
| 200 | <xsl:text>files/</xsl:text><xsl:value-of select="substring-after(@name, $basedir)"/><xsl:text>.html</xsl:text>
|
---|
| 201 | </xsl:attribute>
|
---|
| 202 | <xsl:value-of select="substring-after(@name, $basedir)"/>
|
---|
| 203 | </a>
|
---|
| 204 | </td>
|
---|
| 205 | <td><xsl:value-of select="count(error)"/></td>
|
---|
| 206 | </tr>
|
---|
| 207 | </xsl:template>
|
---|
| 208 |
|
---|
| 209 | <xsl:template match="file" mode="all.classes">
|
---|
| 210 | <tr>
|
---|
| 211 | <td nowrap="nowrap">
|
---|
| 212 | <a target="fileFrame">
|
---|
| 213 | <xsl:attribute name="href">
|
---|
| 214 | <xsl:text>files/</xsl:text><xsl:value-of select="substring-after(@name, $basedir)"/><xsl:text>.html</xsl:text>
|
---|
| 215 | </xsl:attribute>
|
---|
| 216 | <xsl:value-of select="substring-after(@name, $basedir)"/>
|
---|
| 217 | </a>
|
---|
| 218 | </td>
|
---|
| 219 | </tr>
|
---|
| 220 | </xsl:template>
|
---|
| 221 |
|
---|
| 222 | <!--
|
---|
| 223 | transform string like a/b/c to ../../../
|
---|
| 224 | @param path the path to transform into a descending directory path
|
---|
| 225 | -->
|
---|
| 226 | <xsl:template name="path">
|
---|
| 227 | <xsl:param name="path"/>
|
---|
| 228 |
|
---|
| 229 | <!-- Convert a windows path '\' to a unix path '/' for further processing. -->
|
---|
| 230 | <xsl:variable name="path2" select="translate($path,'\','/')"/>
|
---|
| 231 |
|
---|
| 232 |
|
---|
| 233 | <xsl:if test="contains($path2,'/')">
|
---|
| 234 | <xsl:text>../</xsl:text>
|
---|
| 235 | <xsl:call-template name="path">
|
---|
| 236 | <xsl:with-param name="path"><xsl:value-of select="substring-after($path2,'/')"/></xsl:with-param>
|
---|
| 237 | </xsl:call-template>
|
---|
| 238 | </xsl:if>
|
---|
| 239 | <xsl:if test="not(contains($path2,'/')) and not($path2 = '')">
|
---|
| 240 | <xsl:text>../</xsl:text>
|
---|
| 241 | </xsl:if>
|
---|
| 242 | </xsl:template>
|
---|
| 243 |
|
---|
| 244 | <xsl:template match="file">
|
---|
| 245 | <redirect:write file="{$output.dir}/files/{substring-after(@name, $basedir)}.html">
|
---|
| 246 | <html>
|
---|
| 247 | <head>
|
---|
| 248 | <link rel="stylesheet" type="text/css">
|
---|
| 249 | <xsl:attribute name="href"><xsl:call-template name="path"><xsl:with-param name="path" select="substring-after(@name, $basedir)"/></xsl:call-template><xsl:text>stylesheet.css</xsl:text></xsl:attribute>
|
---|
| 250 | </link>
|
---|
| 251 | </head>
|
---|
| 252 | <body>
|
---|
| 253 | <xsl:call-template name="pageHeader"/>
|
---|
| 254 | <h3>File <xsl:value-of select="substring-after(@name, $basedir)"/></h3>
|
---|
| 255 | <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
|
---|
| 256 | <tr>
|
---|
| 257 | <th>Error Description</th>
|
---|
| 258 | <th>Line:Column</th>
|
---|
| 259 | </tr>
|
---|
| 260 | <xsl:for-each select="error">
|
---|
| 261 | <tr>
|
---|
| 262 | <xsl:call-template name="alternated-row"/>
|
---|
| 263 | <td><a title="{@source}"><xsl:value-of select="@message"/></a></td>
|
---|
| 264 | <td align="center"><xsl:value-of select="@line"/><xsl:if test="@column">:<xsl:value-of select="@column"/></xsl:if></td>
|
---|
| 265 | </tr>
|
---|
| 266 | </xsl:for-each>
|
---|
| 267 | </table>
|
---|
| 268 | </body>
|
---|
| 269 | </html>
|
---|
| 270 | </redirect:write>
|
---|
| 271 | </xsl:template>
|
---|
| 272 |
|
---|
| 273 | <xsl:template match="checkstyle" mode="summary">
|
---|
| 274 | <h3>Summary</h3>
|
---|
| 275 | <xsl:variable name="fileCount" select="count(file)"/>
|
---|
| 276 | <xsl:variable name="errorCount" select="count(file/error)"/>
|
---|
| 277 | <xsl:variable name="fileErrorCount" select="count(file[count(error) != 0])"/>
|
---|
| 278 | <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
|
---|
| 279 | <tr>
|
---|
| 280 | <th>Total Files</th>
|
---|
| 281 | <th>Files With Errors</th>
|
---|
| 282 | <th>Errors</th>
|
---|
| 283 | </tr>
|
---|
| 284 | <tr>
|
---|
| 285 | <xsl:call-template name="alternated-row"/>
|
---|
| 286 | <td><xsl:value-of select="$fileCount"/></td>
|
---|
| 287 | <td><xsl:value-of select="$fileErrorCount"/></td>
|
---|
| 288 | <td><xsl:value-of select="$errorCount"/></td>
|
---|
| 289 | </tr>
|
---|
| 290 | </table>
|
---|
| 291 | </xsl:template>
|
---|
| 292 |
|
---|
| 293 | <xsl:template name="alternated-row">
|
---|
| 294 | <xsl:attribute name="class">
|
---|
| 295 | <xsl:if test="position() mod 2 = 1">oddrow</xsl:if>
|
---|
| 296 | <xsl:if test="position() mod 2 = 0">evenrow</xsl:if>
|
---|
| 297 | </xsl:attribute>
|
---|
| 298 | </xsl:template>
|
---|
| 299 | </xsl:stylesheet> |
---|