Skip to content

Instantly share code, notes, and snippets.

@anuraj
Forked from maartenba/inspectcode.xslt
Last active July 5, 2018 05:12
Show Gist options
  • Save anuraj/443ddd13ec298c027d64b59a61b2ad75 to your computer and use it in GitHub Desktop.
Save anuraj/443ddd13ec298c027d64b59a61b2ad75 to your computer and use it in GitHub Desktop.
R# InspectCode XSLT
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.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="no"/>
<xsl:template match="/" name="TopLevelReport">
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" />
<style>
body {font-family: 'Open Sans', sans-serif;}
th, td { text-align: left; }
.collapsible {
background-color: #777;
color: white;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}
.active, .collapsible:hover {
background-color: #555;
}
.collapsible:after {
content: '\002B';
color: white;
font-weight: bold;
float: right;
margin-left: 5px;
}
.active:after {
content: "\2212";
}
.content {
padding: 0 18px;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
background-color: #f1f1f1;
}
</style>
<title>Resharper InspectCode Report</title>
</head>
<body>
<h1>Resharper InspectCode Report
<xsl:value-of select="/Report/Information/Solution"/>
</h1>
<xsl:for-each select="/Report/Issues/Project">
<button class="collapsible">
<span><xsl:value-of select="@Name"/></span>
</button>
<div class="content">
<table style="width:100%">
<tr>
<th>File</th>
<th>Line #</th>
<th>Message</th>
</tr>
<xsl:for-each select="Issue">
<tr>
<td width="25%">
<xsl:value-of select="@File"/>
</td>
<td width="5%">
<xsl:value-of select="@Line"/>
</td>
<td width="75%">
<xsl:value-of select="@Message"/>
</td>
</tr>
</xsl:for-each>
</table>
</div>
</xsl:for-each>
<script>
<![CDATA[
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.maxHeight){
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});
}
]]>
</script>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment