Code Metrics, Reporting, and XSLT Debugging
In my last post, I announced a new power tool that allows you to analyze your managed assemblies to determine various complexity metrics. The output of the power tool is a fairly simple XML file, so in this post, I wanted to show you how simple it is to turn that simple xml file into a report you could actually use.
All you need to do is drop the XSLT and CSS file into the same directory as your xml results after running the power tool, and then be sure to add one line to that xml file, like so:
<?xml-stylesheet type="text/xsl" href="MetricResultsTransform.xslt" ?>
right after the xml declaration statement at the top of the file.
Once you’ve done that, you’ll get a simple report that looks something like this:
NOTE: If you aren’t familiar with Visual Studio’s ability to debug XSLT transforms, I highly recommend checking it out. All you need to do is open an XSLT file in VS, set a break point anywhere in the XSLT file, then hit Alt-F5. VS will then allow you to step through the various transformations, seeing the result of the transformation in the doc well. Very cool stuff if you find yourself having to write lots of XSLTs.