/tools/StyleCop/StyleCopReport.xsl
http://github.com/agross/netopenspace · Extensible Stylesheet Language Transformations · 325 lines · 324 code · 1 blank · 0 comment · 0 complexity · 2359e421426dfcbaff9f65485700ff19 MD5 · raw file
- <?xml version="1.0" encoding="UTF-8"?>
- <!--Designed and generated by Altova StyleVision Enterprise Edition 2008 rel. 2 sp2 - see http://www.altova.com/stylevision for more information.-->
- <xsl:stylesheet version="2.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:mstns="http://stylecopcmd.sourceforge.net/StyleCopReport.xsd"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- exclude-result-prefixes="mstns xs xsi">
- <xsl:output version="4.0"
- method="html"
- indent="yes"
- encoding="UTF-8"
- doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
- doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
- <xsl:param name="SV_OutputFormat"
- select="'HTML'" />
- <xsl:template match="/">
- <html>
- <head>
- <title>StyleCop Report</title>
- <style type="text/css">
- body {
- font-family: Segoe UI, Verdana, Tahoma, Sans-Serif;
- font-size: .8em;
- }
- .violation, .value, code {
- color: #C60A0A;
- }
- h3 {
- color: navy;
- }
- table {
- width: 100%;
- border: none;
- }
- .expand{
- cursor: pointer;
- }
- td {
- padding: .2em;
- }
- .violation {
- width: 80px;
- }
- .name {
- width: 250px;
- }
- .line {
- width: 50px;
- }
- .subitem {
- display: none;
- margin-left: 1em;
- }
- .label {
- font-weight: bold;
- }
- tr.level1 {background-color: #f0f0f0;}
- tr.level2 {background-color: #e1e1e1;}
- tr.level3 {background-color: #d2d2d2;}
- tr.level4 {background-color: silver;}
- table.level5 {background-color: #dee7ec;}
- code {
- display: block;
- padding: 1em 0.3em;
- background-color: #ffffe9;
- font-size: 1.2em;
- }
- </style>
- <script type="text/javascript">
- //{concat(concat("var el = document.getElementById('solution", mstns:ID), "');
- function toggleExpand(element)
- {
- el = document.getElementById(element);
- if (!el)
- {
- return;
- }
-
- if (el.style.display=='block')
- {
- el.style.display='none';
- }
- else
- {
- el.style.display='block';
- }
- }
- </script>
- </head>
- <body>
- <xsl:for-each select="/">
- <h3>
- <xsl:text>StyleCop Report</xsl:text>
- </h3>
- <ul id="summary">
- <li>
- <span class="label">
- <xsl:text>Total Solutions: </xsl:text>
- </span>
- <span class="value">
- <xsl:value-of select="count(mstns:StyleCopReport/mstns:Solutions)" />
- </span>
- </li>
- <li>
- <span class="label">
- <xsl:text>Total Source Files: </xsl:text>
- </span>
- <span class="value">
- <xsl:value-of select="count(//mstns:SourceCodeFiles)" />
- </span>
- </li>
- <li>
- <span class="label">
- <xsl:text>Total Number of Violations: </xsl:text>
- </span>
- <span class="value">
- <xsl:value-of select="count(//mstns:Violations)" />
- </span>
- </li>
- </ul>
- <table>
- <tbody>
- <tr>
- <td class="violation">
- <xsl:text>Violations</xsl:text>
- </td>
- <td class="name">
- <xsl:text>Solution Name</xsl:text>
- </td>
- <td>
- <xsl:text>Path</xsl:text>
- </td>
- </tr>
- </tbody>
- </table>
- <xsl:for-each select="mstns:StyleCopReport">
- <xsl:for-each select="mstns:Solutions">
- <table class="expand">
- <tbody onclick="toggleExpand('{concat('solution', mstns:ID)}')">
- <tr class="level1">
- <td class="violation">
- <xsl:value-of select="count(mstns:Projects/mstns:SourceCodeFiles/mstns:Violations)" />
- </td>
- <td class="name">
- <xsl:for-each select="mstns:Name">
- <xsl:apply-templates />
- </xsl:for-each>
- </td>
- <td>
- <xsl:for-each select="mstns:Location">
- <xsl:apply-templates />
- </xsl:for-each>
- </td>
- </tr>
- </tbody>
- </table>
- <div class="subitem"
- id='{concat("solution", mstns:ID)}'>
- <xsl:for-each select="mstns:Projects">
- <table>
- <tbody>
- <tr>
- <td class="violation">
- <xsl:text>Violations</xsl:text>
- </td>
- <td class="name">
- <xsl:text>Project Name</xsl:text>
- </td>
- <td>
- <xsl:text>Path</xsl:text>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="expand">
- <tbody onclick="toggleExpand('{concat('project', mstns:ID)}')">
- <tr class="level2">
- <td class="violation">
- <xsl:value-of select="count(mstns:SourceCodeFiles/mstns:Violations)" />
- </td>
- <td class="name">
- <xsl:for-each select="mstns:Name">
- <xsl:apply-templates />
- </xsl:for-each>
- </td>
- <td>
- <xsl:for-each select="mstns:Location">
- <xsl:apply-templates />
- </xsl:for-each>
- </td>
- </tr>
- </tbody>
- </table>
- <div class="subitem"
- id='{concat("project", mstns:ID )}'>
- <table>
- <tbody>
- <tr>
- <td class="violation">
- <xsl:text>Violations</xsl:text>
- </td>
- <td class="name">
- <xsl:text>Name</xsl:text>
- </td>
- <td>
- <xsl:text>Path</xsl:text>
- </td>
- </tr>
- </tbody>
- </table>
- <xsl:for-each select="mstns:SourceCodeFiles">
- <xsl:if test="count(mstns:Violations) > 0">
- <table class="expand">
- <tbody onclick="toggleExpand('{concat('files', mstns:ID)}')">
- <tr class="level3">
- <td class="violation">
- <xsl:value-of select="count(mstns:Violations)" />
- </td>
- <td class="name">
- <xsl:for-each select="mstns:Name">
- <xsl:apply-templates />
- </xsl:for-each>
- </td>
- <td>
- <xsl:for-each select="mstns:Path">
- <xsl:apply-templates />
- </xsl:for-each>
- </td>
- </tr>
- </tbody>
- </table>
- <div class="subitem"
- id='{concat("files", mstns:ID )}'>
- <table>
- <tbody>
- <tr>
- <td class="violation">
- <xsl:text>Rule</xsl:text>
- </td>
- <td>
- <xsl:text>Description</xsl:text>
- </td>
- <td class="line">
- <xsl:text>Line</xsl:text>
- </td>
- </tr>
- </tbody>
- </table>
- <xsl:for-each select="mstns:Violations">
- <xsl:for-each select="mstns:Rules">
- <table class="expand"
- onclick="toggleExpand('line{concat(mstns:CheckId, ../mstns:ID)}'); toggleExpand('{concat(mstns:CheckId, ../mstns:ID)}');">
- <tbody>
- <tr class="level4">
- <td class="violation">
- <xsl:for-each select="mstns:CheckId">
- <xsl:apply-templates />
- </xsl:for-each>
- </td>
- <td>
- <xsl:value-of select="../mstns:Message" />
- </td>
- <td class="line">
- <xsl:value-of select="../mstns:Line" />
- </td>
- </tr>
- </tbody>
- </table>
- <div class="subitem"
- id="line{concat(mstns:CheckId, ../mstns:ID)}">
- <code>
- <xsl:value-of select="../mstns:SourceCodeLine" />
- </code>
- </div>
- <table class="subitem level5"
- id="{concat(mstns:CheckId, ../mstns:ID)}">
- <tbody>
- <tr>
- <td class="label">
- <xsl:text>Name:</xsl:text>
- </td>
- <td>
- <xsl:for-each select="mstns:Name">
- <xsl:apply-templates />
- </xsl:for-each>
- </td>
- </tr>
- <tr>
- <td class="label">
- <xsl:text>Namespace:</xsl:text>
- </td>
- <td>
- <xsl:for-each select="mstns:Namespace">
- <xsl:apply-templates />
- </xsl:for-each>
- </td>
- </tr>
- <tr>
- <td class="label">
- <xsl:text>Description:</xsl:text>
- </td>
- <td>
- <xsl:for-each select="mstns:Description">
- <xsl:apply-templates />
- </xsl:for-each>
- </td>
- </tr>
- </tbody>
- </table>
- </xsl:for-each>
- </xsl:for-each>
- </div>
- </xsl:if>
- </xsl:for-each>
- </div>
- </xsl:for-each>
- </div>
- </xsl:for-each>
- </xsl:for-each>
- </xsl:for-each>
- </body>
- </html>
- </xsl:template>
- </xsl:stylesheet>