123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 |
- <?xml version="1.0"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output
- method="xml"
- indent="yes"
- encoding="ISO-8859-1"
- doctype-public="-//W3C//DTD XHTML 1.1//EN"
- doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
- xalan:indent-amount="2"
- xmlns:xalan="http://xml.apache.org/xslt"/>
- <xsl:decimal-format decimal-separator="." grouping-separator="," />
- <xsl:template match="checkstyle">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
- <head>
- <title>Orion Checkstyle Audit Report</title>
- <style type="text/css">
- .bannercell {
- border: 0px;
- padding: 0px;
- }
- body {
- margin-left: 10;
- margin-right: 10;
- font:normal 80% arial,helvetica,sanserif;
- background-color:#FFFFFF;
- color:#000000;
- }
- p#intro {
- border-bottom: 1px solid #888;
- }
- .a td {
- background: #efefef;
- }
- .b td {
- background: #fff;
- }
- td.error {
- background: #f00;
- }
- td.warning {
- background: #ff0;
- }
- td.info {
- background: #fff;
- }
- th, td {
- text-align: left;
- vertical-align: top;
- }
- th {
- font-weight:bold;
- background: #ccc;
- color: black;
- }
- table, th, td {
- font-size:100%;
- border: none
- }
- table {
- margin: 0px;
- }
- table.log tr td, tr th {
- }
- div.box {
- border: 1px solid #449;
- margin: 15px 0px 15px 0px;
- padding: 0px 0px 15px 0px;
- }
- span.source {
- font-size:70%;
- font-family: Arial, Helvetica, sans-serif;
- color: #888;
- }
- h2, h3 {
- font-size: 100%;
- font-weight: bold;
- background: #525D76;
- color: white;
- text-decoration: none;
- padding: 5px;
- margin-right: 2px;
- margin-left: 2px;
- margin-bottom: 0;
- }
- </style>
- </head>
- <body>
- <h1 id="top">Orion CheckStyle Audit</h1>
- <p id="intro">Designed for use with
- <a href='http://checkstyle.sourceforge.net/'>CheckStyle</a> and
- <a href='http://jakarta.apache.org'>Ant</a>.
- </p>
- <p><a href='#sortbyerror'>Files sorted by error count</a> --
- <a href='#sortbyname'>Files sorted by name</a> --
- <a href='#sortbycount'>Files sorted by problem count</a>
- </p>
- <!-- Summary part -->
- <xsl:apply-templates select="." mode="summary"/>
- <!-- Package List part -->
- <xsl:apply-templates select="." mode="filelist"/>
- <!-- For each package create its part -->
- <xsl:for-each select="file[count(error)>0]">
- <xsl:sort select="@name"/>
- <xsl:apply-templates select="."/>
- <br/>
- <br/>
- </xsl:for-each>
- </body>
- </html>
- </xsl:template>
- <xsl:template match="checkstyle" mode="filelist">
- <div class="box">
- <h2 id="sortbyerror">Files Sorted By Errors</h2>
- <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
- <tr>
- <th>Name</th>
- <th>Errors</th>
- <th>Warnings</th>
- <th>Infos</th>
- </tr>
- <xsl:for-each select="file">
- <xsl:sort data-type="number" order="descending" select="count(error[@severity='error'])"/>
- <xsl:sort data-type="number" order="descending" select="count(error[@severity='warning'])"/>
- <xsl:sort data-type="number" order="descending" select="count(error[@severity='info'])"/>
- <xsl:variable name="eCount" select="count(error[@severity='error'])"/>
- <xsl:variable name="wCount" select="count(error[@severity='warning'])"/>
- <xsl:variable name="iCount" select="count(error[@severity='info'])"/>
- <xsl:if test="$eCount > 0">
- <tr>
- <xsl:call-template name="alternated-row"/>
- <xsl:variable name="foo" select="translate(@name,':\/','___')"/>
- <td><a href="#f-{$foo}"><xsl:value-of select="@name"/></a></td>
- <td><xsl:value-of select="$eCount"/></td>
- <td><xsl:value-of select="$wCount"/></td>
- <td><xsl:value-of select="$iCount"/></td>
- </tr>
- </xsl:if>
- </xsl:for-each>
- </table>
- </div>
- <a href="#top">Back to top</a>
- <div class="box">
- <h2 id="sortbywarning">Files Sorted By Warnings</h2>
- <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
- <tr>
- <th>Name</th>
- <th>Errors</th>
- <th>Warnings</th>
- <th>Infos</th>
- </tr>
- <xsl:for-each select="file">
- <xsl:sort data-type="number" order="descending" select="count(error[@severity='warning'])"/>
- <xsl:sort data-type="number" order="descending" select="count(error[@severity='error'])"/>
- <xsl:sort data-type="number" order="descending" select="count(error[@severity='info'])"/>
- <xsl:variable name="eCount" select="count(error[@severity='error'])"/>
- <xsl:variable name="wCount" select="count(error[@severity='warning'])"/>
- <xsl:variable name="iCount" select="count(error[@severity='info'])"/>
- <xsl:if test="$wCount > 0">
- <tr>
- <xsl:call-template name="alternated-row"/>
- <xsl:variable name="foo" select="translate(@name,':\/','___')"/>
- <td><a href="#f-{$foo}"><xsl:value-of select="@name"/></a></td>
- <td><xsl:value-of select="$eCount"/></td>
- <td><xsl:value-of select="$wCount"/></td>
- <td><xsl:value-of select="$iCount"/></td>
- </tr>
- </xsl:if>
- </xsl:for-each>
- </table>
- </div>
- <a href="#top">Back to top</a>
-
- <div class="box">
- <h2 id="sortbyname">Files Sorted By Name</h2>
- <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
- <tr>
- <th>Name</th>
- <th>Errors</th>
- <th>Warnings</th>
- <th>Infos</th>
- </tr>
- <xsl:for-each select="file">
- <xsl:sort select="@name"/>
- <xsl:variable name="eCount" select="count(error[@severity='error'])"/>
- <xsl:variable name="wCount" select="count(error[@severity='warning'])"/>
- <xsl:variable name="iCount" select="count(error[@severity='info'])"/>
- <tr>
- <xsl:call-template name="alternated-row"/>
- <xsl:variable name="foo" select="translate(@name,':\/','___')"/>
- <td>
- <xsl:choose>
- <xsl:when test="count(error)=0">
- <xsl:value-of select="@name"/>
- </xsl:when>
- <xsl:otherwise>
- <a href="#f-{$foo}"><xsl:value-of select="@name"/></a>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td><xsl:value-of select="$eCount"/></td>
- <td><xsl:value-of select="$wCount"/></td>
- <td><xsl:value-of select="$iCount"/></td>
- </tr>
- </xsl:for-each>
- </table>
- </div>
- <a href="#top">Back to top</a>
- <div class="box">
- <h2 id="sortbycount">Files Sorted By Problem Count</h2>
- <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
- <tr>
- <th>Name</th>
- <th>Errors</th>
- <th>Warnings</th>
- <th>Infos</th>
- </tr>
- <xsl:for-each select="file[count(error)>0]">
- <xsl:sort data-type="number" order="descending" select="count(error)"/>
- <xsl:variable name="eCount" select="count(error[@severity='error'])"/>
- <xsl:variable name="wCount" select="count(error[@severity='warning'])"/>
- <xsl:variable name="iCount" select="count(error[@severity='info'])"/>
- <tr>
- <xsl:call-template name="alternated-row"/>
- <xsl:variable name="foo" select="translate(@name,':\/','___')"/>
- <td><a href="#f-{$foo}"><xsl:value-of select="@name"/></a></td>
- <td><xsl:value-of select="$eCount"/></td>
- <td><xsl:value-of select="$wCount"/></td>
- <td><xsl:value-of select="$iCount"/></td>
- </tr>
- </xsl:for-each>
- </table>
- </div>
- <a href="#top">Back to top</a>
- </xsl:template>
- <xsl:template match="file">
- <div class="box">
- <xsl:variable name="foo" select="translate(@name,':\/','___')"/>
- <h2 id="f-{$foo}">File <xsl:value-of select="@name"/></h2>
- <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
- <tr>
- <th>Line</th>
- <th>Severity</th>
- <th>Error Description</th>
- <th>Source</th>
- </tr>
- <xsl:for-each select="error">
- <tr>
- <xsl:call-template name="alternated-row"/>
- <td><xsl:value-of select="@line"/></td>
- <td>
- <xsl:attribute name="class">
- <xsl:value-of select="@severity"/>
- </xsl:attribute>
- <xsl:value-of select="@severity"/>
- </td>
- <td><xsl:value-of select="@message"/></td>
- <td><span class="source"><xsl:value-of select="@source"/></span></td>
- </tr>
- </xsl:for-each>
- </table>
- </div>
- <a href="#top">Back to top</a>
- </xsl:template>
- <xsl:template match="checkstyle" mode="summary">
- <div class="box">
- <h2>Summary</h2>
- <xsl:variable name="fileCount" select="count(file)"/>
- <xsl:variable name="cleanCount" select="count(file[count(error)=0])"/>
- <xsl:variable name="probCount" select="count(file/error)"/>
- <xsl:variable name="errorCount" select="count(file/error[@severity='error'])"/>
- <xsl:variable name="warningCount" select="count(file/error[@severity='warning'])"/>
- <xsl:variable name="infoCount" select="count(file/error[@severity='info'])"/>
- <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
- <tr>
- <th>Files</th>
- <th>Clean Files</th>
- <th>Total Errors</th>
- <th>Total Warnings</th>
- <th>Total Infos</th>
- <th>Total Problems</th>
- </tr>
- <tr><xsl:call-template name="alternated-row"/>
- <td><xsl:value-of select="$fileCount"/></td>
- <td><xsl:value-of select="$cleanCount"/></td>
- <td><xsl:value-of select="$errorCount"/></td>
- <td><xsl:value-of select="$warningCount"/></td>
- <td><xsl:value-of select="$infoCount"/></td>
- <td><xsl:value-of select="$probCount"/></td>
- </tr>
- </table>
- </div>
- </xsl:template>
- <xsl:template name="alternated-row">
- <xsl:attribute name="class">
- <xsl:if test="position() mod 2 = 1">a</xsl:if>
- <xsl:if test="position() mod 2 = 0">b</xsl:if>
- </xsl:attribute>
- </xsl:template>
- </xsl:stylesheet>
|