January 2011 Archives

My favorite HTTP trace tool is Charles. I use it a lot to capture the underlying messages that fly between federation partners. Often, I'll save these traces and send them to colleagues for review. Rather than just sending the trace though, I sometimes include an ordered list of the transactions in the body of my emails. To create this list quickly, I export the trace from Charles in XML format, and I run the following XSLT stylesheet over it:

<?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:output method="html" indent="yes" omit-xml-declaration="yes"/>

<xsl:template match="charles-session">
<xsl:apply-templates select="transaction"/>

<xsl:template match="transaction">
<xsl:value-of select="@protocol"/>
<xsl:value-of select="@host"/>
<xsl:if test="@port">
<xsl:value-of select="@port"/>
<xsl:value-of select="@path"/>
<xsl:if test="@query">
<xsl:when test="string-length(@query) > 80">
<xsl:value-of select="substring(@query, 0, 80)"/>
<xsl:value-of select="@query"/>
The result is some HTML that I can copy/paste into my email client w/ the hope that my colleagues will not even need to open the complete trace.