ReSharper command line tools XSLT
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:output method="html" indent="yes" /> | |
<xsl:template match="/"> | |
<html> | |
<body> | |
<h1>Statistics</h1> | |
<p>Total codebase size: <xsl:value-of select="//CodebaseCost"/></p> | |
<p>Code to analyze: <xsl:value-of select="//TotalDuplicatesCost"/></p> | |
<p>Total size of duplicated fragments: <xsl:value-of select="//TotalFragmentsCost" /></p> | |
<h1>Detected Duplicates</h1> | |
<xsl:for-each select="//Duplicates/Duplicate"> | |
<h2>Duplicated Code. Size: <xsl:value-of select="@Cost"/></h2> | |
<h3>Duplicated Fragments:</h3> | |
<xsl:for-each select="Fragment"> | |
<xsl:variable name="i" select="position()"/> | |
<p>Fragment <xsl:value-of select="$i"/> in file <xsl:value-of select="FileName"/></p> | |
<pre><xsl:value-of select="Text"/></pre> | |
</xsl:for-each> | |
</xsl:for-each> | |
</body> | |
</html> | |
</xsl:template> | |
</xsl:stylesheet> |
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> | |
<xsl:key name="ISSUETYPES" match="/Report/Issues/Project/Issue" use="@TypeId"/> | |
<xsl:output method="html" indent="yes"/> | |
<xsl:template match="/" name="TopLevelReport"> | |
<html> | |
<head> | |
<title>Resharper InspectCode Report</title> | |
<style> | |
body { font-family: Arial; } | |
th, td { text-align: left; } | |
.severity { font-weight: bold; } | |
</style> | |
</head> | |
<body> | |
<h1>Resharper InspectCode Report</h1> | |
<xsl:for-each select="/Report/IssueTypes/IssueType"> | |
<h2> | |
<span class="severity"><xsl:value-of select="@Severity"/></span>: <xsl:value-of select="@Description"/> | |
</h2> | |
<table style="width:100%"> | |
<tr> | |
<th>File</th> | |
<th>Line Number</th> | |
<th>Message</th> | |
</tr> | |
<xsl:for-each select="key('ISSUETYPES',@Id)"> | |
<tr> | |
<td> | |
<xsl:value-of select="@File"/> | |
</td> | |
<td> | |
<xsl:value-of select="@Line"/> | |
</td> | |
<td> | |
<xsl:value-of select="@Message"/> | |
</td> | |
</tr> | |
</xsl:for-each> | |
</table> | |
<br /> | |
<hr /> | |
<br /> | |
</xsl:for-each> | |
</body> | |
</html> | |
</xsl:template> | |
</xsl:stylesheet> |
param ($xml, $xsl, $output) | |
if (-not $xml -or -not $xsl -or -not $output) | |
{ | |
Write-Host "& .\Transform-Xslt.ps1 [-xml] xml-input [-xsl] xsl-input [-output] transform-output" | |
exit; | |
} | |
trap [Exception] | |
{ | |
Write-Host $_.Exception; | |
} | |
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform; | |
$xslt.Load($xsl); | |
$xslt.Transform($xml, $output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment