diff options
author | Michael Koch <konqueror@gmx.de> | 2004-10-25 07:27:56 +0000 |
---|---|---|
committer | Michael Koch <konqueror@gmx.de> | 2004-10-25 07:27:56 +0000 |
commit | c15d5c704fca530335f4b8b731cc6c38be5b5d61 (patch) | |
tree | 87ccf9a2b2fedc2d7b314d93530e2e24a1974e0e /scripts/checkstyle2html.xsl | |
parent | 2b3ffe1203a94d8eceddfddda0bbfa3bcb9f7372 (diff) | |
download | classpath-c15d5c704fca530335f4b8b731cc6c38be5b5d61.tar.gz |
2004-10-25 Michael Koch <konqueror@gmx.de>
* scripts/checkstyle.css,
scripts/checkstyle2html.xsl:
New files
Diffstat (limited to 'scripts/checkstyle2html.xsl')
-rw-r--r-- | scripts/checkstyle2html.xsl | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/scripts/checkstyle2html.xsl b/scripts/checkstyle2html.xsl new file mode 100644 index 000000000..89639876a --- /dev/null +++ b/scripts/checkstyle2html.xsl @@ -0,0 +1,102 @@ +<?xml version='1.0'?> +<!-- XSL stylesheet to convert checkstyle XML to HTML --> +<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> + + <!-- This tells the XSLT processor to emit HTML --> + <xsl:output method='html' + doctype-public='-//W3C//DTD HTML 4.01//EN' + doctype-system='http://www.w3.org/TR/html4/strict.dtd' + omit-xml-declaration='yes'/> + + <!-- Match the checkstyle root element --> + <xsl:template match='checkstyle'> + <html> + <head> + <title>Checkstyle results</title> + <link rel='stylesheet' type='text/css' href='checkstyle.css' /> + </head> + <body> + <h1>Checkstyle results</h1> + <div>The following document contains the results of + <a href='http://checkstyle.sourceforge.net/'>Checkstyle</a>.</div> + + <h2>Summary</h2> + <table summary='Summary'> + <tr> + <th>Files</th><th>Infos</th><th>Warnings</th><th>Errors</th> + </tr> + <tr> + <td><xsl:value-of select='count(file)' /></td> + <td><xsl:value-of select='count(file/error[@severity="info"])' /></td> + <td><xsl:value-of select='count(file/error[@severity="warning"])' /></td> + <td><xsl:value-of select='count(file/error[@severity="error"])' /></td> + </tr> + </table> + + <h2>Files</h2> + <table summary='Files'> + <tr> + <th>File</th><th>I</th><th>W</th><th>E</th> + </tr> + <!-- Process file elements in file mode --> + <xsl:apply-templates select='file' mode='file'> + <xsl:sort select="@name"/> + </xsl:apply-templates> + </table> + + <!-- Process file elements in detail mode --> + <xsl:apply-templates select='file' mode='detail'> + <xsl:sort select="@name"/> + </xsl:apply-templates> + </body> + </html> + </xsl:template> + + <!-- Match a file element in file mode --> + <xsl:template match='file' mode='file'> + <xsl:if test='count(error) > 0'> + <tr> + <td> + <xsl:element name='a'> + <xsl:attribute name='href'> + #<xsl:value-of select='translate(string(@name),"/","__")' /> + </xsl:attribute> + <xsl:value-of select='@name' /> + </xsl:element> + </td> + <td><xsl:value-of select='count(error[@severity="info"])' /></td> + <td><xsl:value-of select='count(error[@severity="warning"])' /></td> + <td><xsl:value-of select='count(error[@severity="error"])' /></td> + </tr> + </xsl:if> + </xsl:template> + + <!-- Match a file element in detail mode--> + <xsl:template match='file' mode='detail'> + <xsl:if test='count(error) > 0'> + <h3> + <xsl:element name='a'> + <xsl:attribute name='name'> + <xsl:value-of select='translate(string(@name),"/","__")' /> + </xsl:attribute> + <xsl:value-of select='@name' /> + </xsl:element> + </h3> + <table summary='Errors'> + <tr> + <th>Error</th><th width="100px">Line</th> + </tr> + <xsl:apply-templates select='error' /> + </table> + </xsl:if> + </xsl:template> + + <!-- Match an error element --> + <xsl:template match='error'> + <tr> + <td><xsl:value-of select='@message'/></td> + <td><xsl:value-of select='@line' /></td> + </tr> + </xsl:template> + +</xsl:stylesheet> |