I’ve been doing a bit with XSL transforms in SharePoint lately and found myself needing the XML that was actually being transformed. The web part I was using was taking in a transform and applying it internally against some XML it had pulled from multiple datasources.
For obvious reasons, it didn’t help what I was looking for. I searched around for “XSL that outputs XML”, “XSL that returns original XML”, “XSL transform that outputs XML”, “XSL transform that gives XML” and other variations of “XSL”, “XSL transform” and “XML” (I’ve put those in there in the hope you’ll find this page with similar search requests and were looking for this solution 😉 ) and eventually found what I was looking for… the XSL identity transform. Once you know the name, you feel stupid that you didn’t think of typing that in but alas, what can you do.
So without further ado, I present the XSL Identity transform…
<?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/ | @* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()" /> </xsl:copy> </xsl:template> </xsl:stylesheet>