tools/checkstyle-noframes-sorted.xsl
changeset 1042 6ca974ea549b
equal deleted inserted replaced
1041:e5a970600066 1042:6ca974ea549b
       
     1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
       
     2   <xsl:output method="html" indent="yes" />
       
     3   <xsl:decimal-format decimal-separator="." grouping-separator="," />
       
     4 
       
     5   <xsl:key name="files" match="file" use="@name" />
       
     6 
       
     7   <!-- Checkstyle XML Style Sheet by Stephane Bailliez <sbailliez@apache.org>         -->
       
     8   <!-- Part of the Checkstyle distribution found at http://checkstyle.sourceforge.net -->
       
     9   <!-- Usage (generates checkstyle_report.html):                                      -->
       
    10   <!--    <checkstyle failonviolation="false" config="${check.config}">               -->
       
    11   <!--      <fileset dir="${src.dir}" includes="**/*.java"/>                          -->
       
    12   <!--      <formatter type="xml" toFile="${doc.dir}/checkstyle_report.xml"/>         -->
       
    13   <!--    </checkstyle>                                                               -->
       
    14   <!--    <style basedir="${doc.dir}" destdir="${doc.dir}"                            -->
       
    15   <!--            includes="checkstyle_report.xml"                                    -->
       
    16   <!--            style="${doc.dir}/checkstyle-noframes-sorted.xsl"/>                 -->
       
    17 
       
    18   <xsl:template match="checkstyle">
       
    19     <html>
       
    20       <head>
       
    21         <style type="text/css">
       
    22           .bannercell {
       
    23           border: 0px;
       
    24           padding: 0px;
       
    25           }
       
    26           body {
       
    27           margin-left: 10;
       
    28           margin-right: 10;
       
    29           font:normal 80% arial,helvetica,sanserif;
       
    30           background-color:#FFFFFF;
       
    31           color:#000000;
       
    32           }
       
    33           .a td {
       
    34           background: #efefef;
       
    35           }
       
    36           .b td {
       
    37           background: #fff;
       
    38           }
       
    39           th, td {
       
    40           text-align: left;
       
    41           vertical-align: top;
       
    42           }
       
    43           th {
       
    44           font-weight:bold;
       
    45           background: #ccc;
       
    46           color: black;
       
    47           }
       
    48           table, th, td {
       
    49           font-size:100%;
       
    50           border: none
       
    51           }
       
    52           table.log tr td, tr th {
       
    53 
       
    54           }
       
    55           h2 {
       
    56           font-weight:bold;
       
    57           font-size:140%;
       
    58           margin-bottom: 5;
       
    59           }
       
    60           h3 {
       
    61           font-size:100%;
       
    62           font-weight:bold;
       
    63           background: #525D76;
       
    64           color: white;
       
    65           text-decoration: none;
       
    66           padding: 5px;
       
    67           margin-right: 2px;
       
    68           margin-left: 2px;
       
    69           margin-bottom: 0;
       
    70           }
       
    71         </style>
       
    72       </head>
       
    73       <body>
       
    74         <a name="top"></a>
       
    75         <!-- jakarta logo -->
       
    76         <table border="0" cellpadding="0" cellspacing="0" width="100%">
       
    77           <tr>
       
    78             <td class="bannercell" rowspan="2">
       
    79               <!--a href="http://jakarta.apache.org/">
       
    80               <img src="http://jakarta.apache.org/images/jakarta-logo.gif" alt="http://jakarta.apache.org" align="left" border="0"/>
       
    81               </a-->
       
    82             </td>
       
    83             <td class="text-align:right">
       
    84               <h2>CheckStyle Audit</h2>
       
    85             </td>
       
    86           </tr>
       
    87           <tr>
       
    88             <td class="text-align:right">Designed for use with
       
    89               <a href='http://checkstyle.sourceforge.net/'>CheckStyle</a>
       
    90               and<a href='http://jakarta.apache.org'>Ant</a>.
       
    91             </td>
       
    92           </tr>
       
    93         </table>
       
    94         <hr size="1" />
       
    95 
       
    96         <!-- Summary part -->
       
    97         <xsl:apply-templates select="." mode="summary" />
       
    98         <hr size="1" width="100%" align="left" />
       
    99 
       
   100         <!-- Package List part -->
       
   101         <xsl:apply-templates select="." mode="filelist" />
       
   102         <hr size="1" width="100%" align="left" />
       
   103 
       
   104         <!-- For each package create its part -->
       
   105         <xsl:apply-templates select="file[@name and generate-id(.) = generate-id(key('files', @name))]" />
       
   106 
       
   107         <hr size="1" width="100%" align="left" />
       
   108 
       
   109 
       
   110       </body>
       
   111     </html>
       
   112   </xsl:template>
       
   113 
       
   114 
       
   115   <xsl:template match="checkstyle" mode="filelist">
       
   116     <h3>Files</h3>
       
   117     <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
       
   118       <tr>
       
   119         <th>Name</th>
       
   120         <th>Errors</th>
       
   121       </tr>
       
   122       <xsl:for-each select="file[@name and generate-id(.) = generate-id(key('files', @name))]">
       
   123         <xsl:sort data-type="number" order="descending" select="count(key('files', @name)/error)" />
       
   124         <xsl:variable name="errorCount" select="count(error)" />
       
   125         <tr>
       
   126           <xsl:call-template name="alternated-row" />
       
   127           <td>
       
   128             <a href="#f-{@name}">
       
   129               <xsl:value-of select="@name" />
       
   130             </a>
       
   131           </td>
       
   132           <td>
       
   133             <xsl:value-of select="$errorCount" />
       
   134           </td>
       
   135         </tr>
       
   136       </xsl:for-each>
       
   137     </table>
       
   138   </xsl:template>
       
   139 
       
   140 
       
   141   <xsl:template match="file">
       
   142     <a name="f-{@name}"></a>
       
   143     <h3>File
       
   144       <xsl:value-of select="@name" />
       
   145     </h3>
       
   146 
       
   147     <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
       
   148       <tr>
       
   149         <th>Error Description</th>
       
   150         <th>Line</th>
       
   151       </tr>
       
   152       <xsl:for-each select="key('files', @name)/error">
       
   153         <xsl:sort data-type="number" order="ascending" select="@line" />
       
   154         <tr>
       
   155           <xsl:call-template name="alternated-row" />
       
   156           <td>
       
   157             <xsl:value-of select="@message" />
       
   158           </td>
       
   159           <td>
       
   160             <xsl:value-of select="@line" />
       
   161           </td>
       
   162         </tr>
       
   163       </xsl:for-each>
       
   164     </table>
       
   165     <a href="#top">Back to top</a>
       
   166   </xsl:template>
       
   167 
       
   168 
       
   169   <xsl:template match="checkstyle" mode="summary">
       
   170     <h3>Summary</h3>
       
   171     <xsl:variable name="fileCount" select="count(file[@name and generate-id(.) = generate-id(key('files', @name))])" />
       
   172     <xsl:variable name="errorCount" select="count(file/error)" />
       
   173     <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
       
   174       <tr>
       
   175         <th>Files</th>
       
   176         <th>Errors</th>
       
   177       </tr>
       
   178       <tr>
       
   179         <xsl:call-template name="alternated-row" />
       
   180         <td>
       
   181           <xsl:value-of select="$fileCount" />
       
   182         </td>
       
   183         <td>
       
   184           <xsl:value-of select="$errorCount" />
       
   185         </td>
       
   186       </tr>
       
   187     </table>
       
   188   </xsl:template>
       
   189 
       
   190   <xsl:template name="alternated-row">
       
   191     <xsl:attribute name="class">
       
   192       <xsl:if test="position() mod 2 = 1">a</xsl:if>
       
   193       <xsl:if test="position() mod 2 = 0">b</xsl:if>
       
   194     </xsl:attribute>
       
   195   </xsl:template>
       
   196 </xsl:stylesheet>