Identity XSL

21 Jul

I’m constantly digging around to find a copy of an Identity XSL to use in my SharePoint development.  As so much of SharePoint can be modified through XSL customizations, it’s important to be able to get a copy of the source XML so you can go work in a proper XSL Debugger (such as Oxygen XML) to create your XSL files.

 

To do that, I use this identity XSL (for example, as my search results XSL) and it causes SharePoint to print out the raw source XML into the page source, where I can copy it and use it.

<span class="kwrd">&lt;?</span><span class="html">xml</span> <span class="attr">version</span><span class="kwrd">="1.0"</span> ?<span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">xsl:stylesheet</span> <span class="attr">version</span><span class="kwrd">="1.0"</span> <span class="attr">xmlns:xsl</span><span class="kwrd">="http://www.w3.org/1999/XSL/Transform"</span><span class="kwrd">&gt;</span>
    <span class="rem">&lt;!-- IdentityTransform --&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">xsl:template</span> <span class="attr">match</span><span class="kwrd">="/ | @* | node()"</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">xsl:copy</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">xsl:apply-templates</span> <span class="attr">select</span><span class="kwrd">="@* | node()"</span><span class="kwrd">/&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">xsl:copy</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">xsl:template</span><span class="kwrd">&gt;</span>

<span class="kwrd">&lt;/</span><span class="html">xsl:stylesheet</span><span class="kwrd">&gt;</span>
Tweet about this on TwitterShare on Google+Share on FacebookShare on RedditEmail this to someoneShare on LinkedInShare on StumbleUpon

Leave a Reply

Your email address will not be published. Required fields are marked *