OSDN Git Service

Merged gcj-eclipse branch to trunk.
[pf3gnuchains/gcc-fork.git] / libjava / classpath / scripts / checkstyle2html.xsl
1 <?xml version='1.0'?>
2 <!-- XSL stylesheet to convert checkstyle XML to HTML -->
3 <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
4
5   <!-- This tells the XSLT processor to emit HTML -->
6   <xsl:output method='html'
7     doctype-public='-//W3C//DTD HTML 4.01//EN'
8     doctype-system='http://www.w3.org/TR/html4/strict.dtd'
9     omit-xml-declaration='yes'/>
10
11   <!-- Match the checkstyle root element -->
12   <xsl:template match='checkstyle'>
13     <html>
14       <head>
15         <title>Checkstyle results</title>
16         <link rel='stylesheet' type='text/css' href='checkstyle.css' />
17       </head>
18       <body>
19         <h1>Checkstyle results</h1>
20         <div>The following document contains the results of
21         <a href='http://checkstyle.sourceforge.net/'>Checkstyle</a>.</div>
22         
23         <h2>Summary</h2>
24         <table summary='Summary'>
25           <tr>
26             <th>Files</th><th>Infos</th><th>Warnings</th><th>Errors</th>
27           </tr>
28           <tr>
29             <td><xsl:value-of select='count(file)' /></td>
30             <td><xsl:value-of select='count(file/error[@severity="info"])' /></td>
31             <td><xsl:value-of select='count(file/error[@severity="warning"])' /></td>
32             <td><xsl:value-of select='count(file/error[@severity="error"])' /></td>
33           </tr>
34         </table>
35
36         <h2>Files</h2>
37         <table summary='Files'>
38           <tr>
39             <th>File</th><th>I</th><th>W</th><th>E</th>
40           </tr>
41           <!-- Process file elements in file mode -->
42           <xsl:apply-templates select='file' mode='file'>
43             <xsl:sort select="@name"/>
44           </xsl:apply-templates>
45         </table>
46
47         <!-- Process file elements in detail mode -->
48         <xsl:apply-templates select='file' mode='detail'>
49           <xsl:sort select="@name"/>
50         </xsl:apply-templates>
51       </body>
52     </html>
53   </xsl:template>
54
55   <!-- Match a file element in file mode -->
56   <xsl:template match='file' mode='file'>
57     <xsl:if test='count(error) &gt; 0'>
58       <tr>
59         <td>
60           <xsl:element name='a'>
61             <xsl:attribute name='href'>
62               #<xsl:value-of select='translate(string(@name),"/","__")' />
63             </xsl:attribute>
64             <xsl:value-of select='@name' />
65           </xsl:element>
66         </td>
67         <td><xsl:value-of select='count(error[@severity="info"])' /></td>
68         <td><xsl:value-of select='count(error[@severity="warning"])' /></td>
69         <td><xsl:value-of select='count(error[@severity="error"])' /></td>
70       </tr>
71     </xsl:if>
72   </xsl:template>
73
74   <!-- Match a file element in detail mode-->
75   <xsl:template match='file' mode='detail'>
76     <xsl:if test='count(error) &gt; 0'>
77       <h3>
78         <xsl:element name='a'>
79           <xsl:attribute name='name'>
80             <xsl:value-of select='translate(string(@name),"/","__")' />
81           </xsl:attribute>
82           <xsl:value-of select='@name' />
83         </xsl:element>
84       </h3>
85       <table summary='Errors'>
86         <tr>
87           <th>Error</th><th width="100px">Line</th>
88         </tr>
89         <xsl:apply-templates select='error' />
90       </table>
91     </xsl:if>
92   </xsl:template>
93
94   <!-- Match an error element -->
95   <xsl:template match='error'>
96     <tr>
97       <td><xsl:value-of select='@message'/></td>
98       <td><xsl:value-of select='@line' /></td>
99     </tr>
100   </xsl:template>
101
102 </xsl:stylesheet>