XSL Tips

When writing XSL, it is often desirable to be able to see the raw XML that you're trying to transform. This is especially helpful when customizing XSL for web parts such as content query. The red text below show how to modify the ContentQueryMain.xsl file to do this for a Content Query web part. This can be used in other web parts that utilize XSL transforms also.

<xsl:template match="/">
    <textarea rows="20" cols="100">
<xsl:apply-templates/>
</textarea>
    <xsl:call-template name="OuterTemplate" />
/xsl:template>
<xsl:template match="node()|@*">
<!-- Copy the current node -->
<xsl:copy>
<!-- Including any child nodes it has and any attributes -->
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>