Home > SharePoint > Sharepoint 2007 Xslt debug

Sharepoint 2007 Xslt debug


Sometimes there are problems that needs more than one try when creating an xslt webpart in SharePoint , for example for the correct formatting; and to modify the xslt , click Apply, see the result , repeat click on XSL editor , change the xslt, click on Apply… could be a long time.

There is the possibility of to get the XML produced from SharePoint , and then debug locally on Visual Studio 2010 without the delays of the above cicle.

Click on XSL editor, make a copy of original XSLT (important!…) and paste

<xsl:stylesheet version="1.0?" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml" version="1.0?" encoding="UTF-8?" indent="yes"/>
	<xsl:template match="/">
			<xsl:copy-of select="*"/>

Clic on Apply , the page formatting goes bad but you should obtain something as this:

Select all the produced XML and copy on the clipboard.

Open Visual Studio 2010 , new xslt file, paste in this the original XSLT of the web part , create a new XML file and paste the produced XML, save it on disk.

Click on XSLT file , in his properties select as input the XML file:

From the XML menu launch debugging, with breakpoints in XSLT if needs :

This will open a new html window, with the results ; at this point close the HTML window, modify the XSLT and restart debug : it is very fast if compared to the same procedure directly on the SharePoint page.


Categories: SharePoint
%d bloggers like this: