carbidecpp20devenv/plugins/org.apache.ant_1.7.0.v200803061910/etc/checkstyle/checkstyle-frames.xsl
changeset 1 82d1d1de1a01
equal deleted inserted replaced
-1:000000000000 1:82d1d1de1a01
       
     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  2002-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="html" indent="yes" encoding="US-ASCII"/>
       
    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         <!-- create the index.html -->
       
    31         <redirect:write file="{$output.dir}/index.html">
       
    32             <xsl:call-template name="index.html"/>
       
    33         </redirect:write>
       
    34 
       
    35         <!-- create the stylesheet.css -->
       
    36         <redirect:write file="{$output.dir}/stylesheet.css">
       
    37             <xsl:call-template name="stylesheet.css"/>
       
    38         </redirect:write>
       
    39 
       
    40         <!-- create the overview-summary.html at the root -->
       
    41         <redirect:write file="{$output.dir}/overview-frame.html">
       
    42             <xsl:apply-templates select="." mode="overview"/>
       
    43         </redirect:write>
       
    44 
       
    45         <!-- create the all-classes.html at the root -->
       
    46         <redirect:write file="{$output.dir}/allclasses-frame.html">
       
    47             <xsl:apply-templates select="." mode="all.classes"/>
       
    48         </redirect:write>
       
    49 
       
    50         <!-- process all files -->
       
    51         <xsl:apply-templates select="file[count(error) != 0]"/>
       
    52     </xsl:template>
       
    53 
       
    54     <xsl:template name="index.html">
       
    55         <html>
       
    56             <head>
       
    57                 <title>CheckStyle Audit</title>
       
    58             </head>
       
    59             <frameset cols="20%,80%">
       
    60                 <frame src="allclasses-frame.html" name="fileListFrame"/>
       
    61                 <frame src="overview-frame.html" name="fileFrame"/>
       
    62             </frameset>
       
    63             <noframes>
       
    64                 <h2>Frame Alert</h2>
       
    65                 <p>
       
    66                     This document is designed to be viewed using the frames feature.
       
    67                     If you see this message, you are using a non-frame-capable web client.
       
    68                 </p>
       
    69             </noframes>
       
    70         </html>
       
    71     </xsl:template>
       
    72 
       
    73     <xsl:template name="pageHeader">
       
    74         <table border="0" cellpadding="0" cellspacing="0" width="100%">
       
    75             <tr>
       
    76                 <td class="text-align:right"><h2>CheckStyle Audit</h2></td>
       
    77             </tr>
       
    78             <tr>
       
    79                 <td class="text-align:right">Designed for use with
       
    80                   <a href='http://checkstyle.sourceforge.net/'>CheckStyle</a> and
       
    81                   <a href='http://ant.apache.org/'>Ant</a>.</td>
       
    82             </tr>
       
    83         </table>
       
    84         <hr size="1"/>
       
    85     </xsl:template>
       
    86 
       
    87     <xsl:template match="checkstyle" mode="overview">
       
    88         <html>
       
    89             <head>
       
    90                 <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
       
    91             </head>
       
    92             <body>
       
    93                 <!-- page header -->
       
    94                 <xsl:call-template name="pageHeader"/>
       
    95 
       
    96                 <!-- Summary part -->
       
    97                 <xsl:apply-templates select="." mode="summary"/>
       
    98                 <hr size="1" width="100%" align="left"/>
       
    99 
       
   100                 <!-- File list part -->
       
   101                 <xsl:apply-templates select="." mode="filelist"/>
       
   102             </body>
       
   103         </html>
       
   104     </xsl:template>
       
   105 
       
   106     <xsl:template name="stylesheet.css">
       
   107         .bannercell {
       
   108         border: 0px;
       
   109         padding: 0px;
       
   110         }
       
   111         body {
       
   112         margin-left: 10;
       
   113         margin-right: 10;
       
   114         font:normal 80% arial,helvetica,sanserif;
       
   115         background-color:#FFFFFF;
       
   116         color:#000000;
       
   117         }
       
   118         .oddrow td {
       
   119         background: #efefef;
       
   120         }
       
   121         .evenrow td {
       
   122         background: #fff;
       
   123         }
       
   124         th, td {
       
   125         text-align: left;
       
   126         vertical-align: top;
       
   127         }
       
   128         th {
       
   129         font-weight:bold;
       
   130         background: #ccc;
       
   131         color: black;
       
   132         }
       
   133         table, th, td {
       
   134         font-size:100%;
       
   135         border: none
       
   136         }
       
   137         table.log tr td, tr th {
       
   138 
       
   139         }
       
   140         h2 {
       
   141         font-weight:bold;
       
   142         font-size:140%;
       
   143         margin-bottom: 5;
       
   144         }
       
   145         h3 {
       
   146         font-size:100%;
       
   147         font-weight:bold;
       
   148         background: #525D76;
       
   149         color: white;
       
   150         text-decoration: none;
       
   151         padding: 5px;
       
   152         margin-right: 2px;
       
   153         margin-left: 2px;
       
   154         margin-bottom: 0;
       
   155         }
       
   156     </xsl:template>
       
   157 
       
   158     <!--
       
   159     Creates an all-classes.html file that contains a link to all files.
       
   160     -->
       
   161     <xsl:template match="checkstyle" mode="all.classes">
       
   162         <html>
       
   163             <head>
       
   164                 <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
       
   165             </head>
       
   166             <body>
       
   167                 <h2>Files</h2>
       
   168                 <p>
       
   169                     <table width="100%">
       
   170                         <!-- For each file create its part -->
       
   171                         <xsl:apply-templates select="file[count(error) != 0]" mode="all.classes">
       
   172                             <xsl:sort select="substring-after(@name, $basedir)"/>
       
   173                         </xsl:apply-templates>
       
   174                     </table>
       
   175                 </p>
       
   176             </body>
       
   177         </html>
       
   178     </xsl:template>
       
   179 
       
   180     <xsl:template match="checkstyle" mode="filelist">
       
   181         <h3>Files</h3>
       
   182         <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
       
   183             <tr>
       
   184                 <th>Name</th>
       
   185                 <th>Errors</th>
       
   186             </tr>
       
   187             <xsl:apply-templates select="file[count(error) != 0]" mode="filelist">
       
   188                 <xsl:sort select="count(error)" order="descending" data-type="number"/>
       
   189             </xsl:apply-templates>
       
   190         </table>
       
   191     </xsl:template>
       
   192 
       
   193     <xsl:template match="file" mode="filelist">
       
   194         <tr>
       
   195             <xsl:call-template name="alternated-row"/>
       
   196             <td nowrap="nowrap">
       
   197                 <a>
       
   198                     <xsl:attribute name="href">
       
   199                         <xsl:text>files/</xsl:text><xsl:value-of select="substring-after(@name, $basedir)"/><xsl:text>.html</xsl:text>
       
   200                     </xsl:attribute>
       
   201                     <xsl:value-of select="substring-after(@name, $basedir)"/>
       
   202                 </a>
       
   203             </td>
       
   204             <td><xsl:value-of select="count(error)"/></td>
       
   205         </tr>
       
   206     </xsl:template>
       
   207 
       
   208     <xsl:template match="file" mode="all.classes">
       
   209         <tr>
       
   210             <td nowrap="nowrap">
       
   211                 <a target="fileFrame">
       
   212                     <xsl:attribute name="href">
       
   213                         <xsl:text>files/</xsl:text><xsl:value-of select="substring-after(@name, $basedir)"/><xsl:text>.html</xsl:text>
       
   214                     </xsl:attribute>
       
   215                     <xsl:value-of select="substring-after(@name, $basedir)"/>
       
   216                 </a>
       
   217             </td>
       
   218         </tr>
       
   219     </xsl:template>
       
   220 
       
   221     <!--
       
   222     transform string like a/b/c to ../../../
       
   223     @param path the path to transform into a descending directory path
       
   224     -->
       
   225     <xsl:template name="path">
       
   226         <xsl:param name="path"/>
       
   227         <xsl:if test="contains($path,'/')">
       
   228             <xsl:text>../</xsl:text>
       
   229             <xsl:call-template name="path">
       
   230                 <xsl:with-param name="path"><xsl:value-of select="substring-after($path,'/')"/></xsl:with-param>
       
   231             </xsl:call-template>
       
   232         </xsl:if>
       
   233         <xsl:if test="not(contains($path,'/')) and not($path = '')">
       
   234             <xsl:text>../</xsl:text>
       
   235         </xsl:if>
       
   236     </xsl:template>
       
   237 
       
   238     <xsl:template match="file">
       
   239         <redirect:write file="{$output.dir}/files/{substring-after(@name, $basedir)}.html">
       
   240             <html>
       
   241                 <head>
       
   242                     <link rel="stylesheet" type="text/css">
       
   243                         <xsl:attribute name="href"><xsl:call-template name="path"><xsl:with-param name="path" select="substring-after(@name, $basedir)"/></xsl:call-template><xsl:text>stylesheet.css</xsl:text></xsl:attribute>
       
   244                     </link>
       
   245                 </head>
       
   246                 <body>
       
   247                     <xsl:call-template name="pageHeader"/>
       
   248                     <h3>File <xsl:value-of select="substring-after(@name, $basedir)"/></h3>
       
   249                     <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
       
   250                         <tr>
       
   251                             <th>Error Description</th>
       
   252                             <th>Line:Column</th>
       
   253                         </tr>
       
   254                         <xsl:for-each select="error">
       
   255                             <tr>
       
   256                                 <xsl:call-template name="alternated-row"/>
       
   257                                 <td><a title="{@source}"><xsl:value-of select="@message"/></a></td>
       
   258                                 <td align="center"><xsl:value-of select="@line"/><xsl:if test="@column">:<xsl:value-of select="@column"/></xsl:if></td>
       
   259                             </tr>
       
   260                         </xsl:for-each>
       
   261                     </table>
       
   262                 </body>
       
   263             </html>
       
   264         </redirect:write>
       
   265     </xsl:template>
       
   266 
       
   267     <xsl:template match="checkstyle" mode="summary">
       
   268         <h3>Summary</h3>
       
   269         <xsl:variable name="fileCount" select="count(file)"/>
       
   270         <xsl:variable name="errorCount" select="count(file/error)"/>
       
   271         <xsl:variable name="fileErrorCount" select="count(file[count(error) != 0])"/>
       
   272         <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
       
   273             <tr>
       
   274                 <th>Total Files</th>
       
   275                 <th>Files With Errors</th>
       
   276                 <th>Errors</th>
       
   277             </tr>
       
   278             <tr>
       
   279                 <xsl:call-template name="alternated-row"/>
       
   280                 <td><xsl:value-of select="$fileCount"/></td>
       
   281                 <td><xsl:value-of select="$fileErrorCount"/></td>
       
   282                 <td><xsl:value-of select="$errorCount"/></td>
       
   283             </tr>
       
   284         </table>
       
   285     </xsl:template>
       
   286 
       
   287     <xsl:template name="alternated-row">
       
   288         <xsl:attribute name="class">
       
   289             <xsl:if test="position() mod 2 = 1">oddrow</xsl:if>
       
   290             <xsl:if test="position() mod 2 = 0">evenrow</xsl:if>
       
   291         </xsl:attribute>
       
   292     </xsl:template>
       
   293 </xsl:stylesheet>