[30383] | 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="org.apache.xalan.lib.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="xml" indent="yes"/>
|
---|
| 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 | <document>
|
---|
| 32 | <properties>
|
---|
| 33 | <title>Checkstyle Audit</title>
|
---|
| 34 | </properties>
|
---|
| 35 |
|
---|
| 36 | <body>
|
---|
| 37 | <xsl:apply-templates select="." mode="summary"/>
|
---|
| 38 | <!-- File list part -->
|
---|
| 39 | <xsl:apply-templates select="." mode="filelist"/>
|
---|
| 40 | <xsl:apply-templates select="file[count(error) != 0]"/>
|
---|
| 41 | </body>
|
---|
| 42 | </document>
|
---|
| 43 | </xsl:template>
|
---|
| 44 |
|
---|
| 45 | <xsl:template match="checkstyle" mode="filelist">
|
---|
| 46 | <section name="Files">
|
---|
| 47 | <table>
|
---|
| 48 | <tr>
|
---|
| 49 | <th>Name</th>
|
---|
| 50 | <th>Errors</th>
|
---|
| 51 | </tr>
|
---|
| 52 | <xsl:apply-templates select="file[count(error) != 0]" mode="filelist">
|
---|
| 53 | <xsl:sort select="count(error)" order="descending" data-type="number"/>
|
---|
| 54 | </xsl:apply-templates>
|
---|
| 55 | </table>
|
---|
| 56 | </section>
|
---|
| 57 | </xsl:template>
|
---|
| 58 |
|
---|
| 59 | <xsl:template match="file" mode="filelist">
|
---|
| 60 | <tr>
|
---|
| 61 | <xsl:call-template name="alternated-row"/>
|
---|
| 62 | <td nowrap="nowrap">
|
---|
| 63 | <a>
|
---|
| 64 | <xsl:attribute name="href">
|
---|
| 65 | <xsl:text>files</xsl:text><xsl:value-of select="substring-after(@name, $basedir)"/><xsl:text>.html</xsl:text>
|
---|
| 66 | </xsl:attribute>
|
---|
| 67 | <xsl:value-of select="substring-after(@name, $basedir)"/>
|
---|
| 68 | </a>
|
---|
| 69 | </td>
|
---|
| 70 | <td><xsl:value-of select="count(error)"/></td>
|
---|
| 71 | </tr>
|
---|
| 72 | </xsl:template>
|
---|
| 73 |
|
---|
| 74 | <xsl:template match="file">
|
---|
| 75 | <redirect:write file="{$output.dir}/files{substring-after(@name, $basedir)}.xml">
|
---|
| 76 | <document>
|
---|
| 77 | <properties>
|
---|
| 78 | <title>Checkstyle Audit</title>
|
---|
| 79 | </properties>
|
---|
| 80 |
|
---|
| 81 | <body>
|
---|
| 82 | <section name="Details for {substring-after(@name, $basedir)}">
|
---|
| 83 | <table>
|
---|
| 84 | <tr>
|
---|
| 85 | <th>Error Description</th>
|
---|
| 86 | <th>Line</th>
|
---|
| 87 | </tr>
|
---|
| 88 | <xsl:for-each select="error">
|
---|
| 89 | <tr>
|
---|
| 90 | <xsl:call-template name="alternated-row"/>
|
---|
| 91 | <td><a title="{@source}"><xsl:value-of select="@message"/></a></td>
|
---|
| 92 | <td><xsl:value-of select="@line"/></td>
|
---|
| 93 | </tr>
|
---|
| 94 | </xsl:for-each>
|
---|
| 95 | </table>
|
---|
| 96 | </section>
|
---|
| 97 | </body>
|
---|
| 98 | </document>
|
---|
| 99 | </redirect:write>
|
---|
| 100 | </xsl:template>
|
---|
| 101 |
|
---|
| 102 | <xsl:template match="checkstyle" mode="summary">
|
---|
| 103 | <section name="Summary">
|
---|
| 104 | <xsl:variable name="fileCount" select="count(file)"/>
|
---|
| 105 | <xsl:variable name="errorCount" select="count(file/error)"/>
|
---|
| 106 | <xsl:variable name="fileErrorCount" select="count(file[count(error) != 0])"/>
|
---|
| 107 | <table>
|
---|
| 108 | <tr>
|
---|
| 109 | <th>Files</th>
|
---|
| 110 | <th>Files With Errors</th>
|
---|
| 111 | <th>Errors</th>
|
---|
| 112 | </tr>
|
---|
| 113 | <tr>
|
---|
| 114 | <xsl:call-template name="alternated-row"/>
|
---|
| 115 | <td><xsl:value-of select="$fileCount"/></td>
|
---|
| 116 | <td><xsl:value-of select="$fileErrorCount"/></td>
|
---|
| 117 | <td><xsl:value-of select="$errorCount"/></td>
|
---|
| 118 | </tr>
|
---|
| 119 | </table>
|
---|
| 120 | </section>
|
---|
| 121 | </xsl:template>
|
---|
| 122 |
|
---|
| 123 | <xsl:template name="alternated-row">
|
---|
| 124 | <xsl:attribute name="class">
|
---|
| 125 | <xsl:if test="position() mod 2 = 1">oddrow</xsl:if>
|
---|
| 126 | <xsl:if test="position() mod 2 = 0">evenrow</xsl:if>
|
---|
| 127 | </xsl:attribute>
|
---|
| 128 | </xsl:template>
|
---|
| 129 | </xsl:stylesheet>
|
---|
| 130 |
|
---|