Pass-through XSL for debugging

When debugging certain webparts (e.g. CQWP), you often want to see the raw XML before the XSL is applied. The XSLs below (developed by a colleague) will spit out the original XML.

<xsl:stylesheet version="1.0" xmlns:xsl="">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:template match="/">
			<xsl:copy-of select="*"/>


This one below renders the XML as a table, with each entity as a row, and each attribute as a column. This would only work if the XML is a single list of entities, and the entities have no child entities.

<xsl:stylesheet version="1.0" xmlns:xsl="">
	<xsl:variable name="UTCTime" select="/Rows/queryData/CurrentTimeUTC" />
	<xsl:template match="/">
			<xsl:for-each select="//row">
					<xsl:for-each select="@*">
							<br />
								<xsl:value-of select="name()" />
							<xsl:value-of select="." />

About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in WebPart, XSL. Bookmark the permalink.

1 Response to Pass-through XSL for debugging

  1. Tony says:

    Just used this little code snip in a hot situation to save my butt! Thanks!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s