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.
1 2 3 4 5 6 7 8 9 10 |
<span class="kwrd"><?</span><span class="html">xml</span> <span class="attr">version</span><span class="kwrd">="1.0"</span> ?<span class="kwrd">></span> <span class="kwrd"><</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">></span> <span class="rem"><!-- IdentityTransform --></span> <span class="kwrd"><</span><span class="html">xsl:template</span> <span class="attr">match</span><span class="kwrd">="/ | @* | node()"</span><span class="kwrd">></span> <span class="kwrd"><</span><span class="html">xsl:copy</span><span class="kwrd">></span> <span class="kwrd"><</span><span class="html">xsl:apply-templates</span> <span class="attr">select</span><span class="kwrd">="@* | node()"</span><span class="kwrd">/></span> <span class="kwrd"></</span><span class="html">xsl:copy</span><span class="kwrd">></span> <span class="kwrd"></</span><span class="html">xsl:template</span><span class="kwrd">></span> <span class="kwrd"></</span><span class="html">xsl:stylesheet</span><span class="kwrd">></span> |
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }