source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/etc/checkstyle/checkstyle-xdoc.xsl@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 4.5 KB
Line 
1<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
2 xmlns:lxslt="http://xml.apache.org/xslt"
3 xmlns:redirect="org.apache.xalan.lib.Redirect"
4 extension-element-prefixes="redirect">
5
6<!--
7 Copyright 2003-2004 The Apache Software Foundation
8
9 Licensed under the Apache License, Version 2.0 (the "License");
10 you may not use this file except in compliance with the License.
11 You may obtain a copy of the License at
12
13 http://www.apache.org/licenses/LICENSE-2.0
14
15 Unless required by applicable law or agreed to in writing, software
16 distributed under the License is distributed on an "AS IS" BASIS,
17 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 See the License for the specific language governing permissions and
19 limitations under the License.
20
21-->
22
23 <xsl:output method="xml" indent="yes"/>
24 <xsl:decimal-format decimal-separator="." grouping-separator="," />
25
26 <xsl:param name="output.dir" select="'.'"/>
27 <xsl:param name="basedir" select="'.'"/>
28
29 <xsl:template match="checkstyle">
30 <document>
31 <properties>
32 <title>Checkstyle Audit</title>
33 </properties>
34
35 <body>
36 <xsl:apply-templates select="." mode="summary"/>
37 <!-- File list part -->
38 <xsl:apply-templates select="." mode="filelist"/>
39 <xsl:apply-templates select="file[count(error) != 0]"/>
40 </body>
41 </document>
42 </xsl:template>
43
44 <xsl:template match="checkstyle" mode="filelist">
45 <section name="Files">
46 <table>
47 <tr>
48 <th>Name</th>
49 <th>Errors</th>
50 </tr>
51 <xsl:apply-templates select="file[count(error) != 0]" mode="filelist">
52 <xsl:sort select="count(error)" order="descending" data-type="number"/>
53 </xsl:apply-templates>
54 </table>
55 </section>
56 </xsl:template>
57
58 <xsl:template match="file" mode="filelist">
59 <tr>
60 <xsl:call-template name="alternated-row"/>
61 <td nowrap="nowrap">
62 <a>
63 <xsl:attribute name="href">
64 <xsl:text>files</xsl:text><xsl:value-of select="substring-after(@name, $basedir)"/><xsl:text>.html</xsl:text>
65 </xsl:attribute>
66 <xsl:value-of select="substring-after(@name, $basedir)"/>
67 </a>
68 </td>
69 <td><xsl:value-of select="count(error)"/></td>
70 </tr>
71 </xsl:template>
72
73 <xsl:template match="file">
74 <redirect:write file="{$output.dir}/files{substring-after(@name, $basedir)}.xml">
75 <document>
76 <properties>
77 <title>Checkstyle Audit</title>
78 </properties>
79
80 <body>
81 <section name="Details for {substring-after(@name, $basedir)}">
82 <table>
83 <tr>
84 <th>Error Description</th>
85 <th>Line</th>
86 </tr>
87 <xsl:for-each select="error">
88 <tr>
89 <xsl:call-template name="alternated-row"/>
90 <td><a title="{@source}"><xsl:value-of select="@message"/></a></td>
91 <td><xsl:value-of select="@line"/></td>
92 </tr>
93 </xsl:for-each>
94 </table>
95 </section>
96 </body>
97 </document>
98 </redirect:write>
99 </xsl:template>
100
101 <xsl:template match="checkstyle" mode="summary">
102 <section name="Summary">
103 <xsl:variable name="fileCount" select="count(file)"/>
104 <xsl:variable name="errorCount" select="count(file/error)"/>
105 <xsl:variable name="fileErrorCount" select="count(file[count(error) != 0])"/>
106 <table>
107 <tr>
108 <th>Files</th>
109 <th>Files With Errors</th>
110 <th>Errors</th>
111 </tr>
112 <tr>
113 <xsl:call-template name="alternated-row"/>
114 <td><xsl:value-of select="$fileCount"/></td>
115 <td><xsl:value-of select="$fileErrorCount"/></td>
116 <td><xsl:value-of select="$errorCount"/></td>
117 </tr>
118 </table>
119 </section>
120 </xsl:template>
121
122 <xsl:template name="alternated-row">
123 <xsl:attribute name="class">
124 <xsl:if test="position() mod 2 = 1">oddrow</xsl:if>
125 <xsl:if test="position() mod 2 = 0">evenrow</xsl:if>
126 </xsl:attribute>
127 </xsl:template>
128</xsl:stylesheet>
129
Note: See TracBrowser for help on using the repository browser.