XSL and dumping XML

Posted within Development on

When you’re attempting to construct an XSL template its always helpful to know the structure of the XML you’re transforming. When working with lists in SharePoint, this isn’t always obvious.

One quick solution is simply to dump the XML to the page so you can review it.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<pre>
<xsl:copy-of select="*"/>
</pre>
</xsl:template>
</xsl:stylesheet>

Simples!