Using SharePoint Designer 2010 you can create nice looking user interface renderings of data stored within lists and libraries without any custom coding by replacing the out of the box XSLT with your own custom XSLT. To get started, you need to take a couple simple steps to enable this advanced functionality in SharePoint Designer.
- Open a site in SharePoint Designer. You will need at least one web part page available in order to create a web part with custom XSLT. If you are in a publishing site you will need to create a web part page because you cannot edit the content of a publishing page using SharePoint Designer.
- Locate your test web part page and open it for editing in SharePoint Designer.
- On the Home tab click on the Advanced Mode button in the ribbon bar.
- Click in a web part zone and then from the insert tab select the Data View drop down and choose the list or library you wish to use as your data source.
- Select the newly created web part and in the Design tab under the List View Tools grouping, click on the Customize XSLT drop down and select Customize Entire View.
- You can now switch to the code view for the page and modify the XSL.
- Once you have finished modifying your web part you can save the page and then export your web part. This new web part can be used anywhere within the site that contains the source data list or library.
Based upon my testing you must include the following in your XSL or you will receive an “Unable to display this Web Part” error.
<xsl:include href=”/_layouts/xsl/main.xsl” />
SharePoint uses the main.xsl as the core XSL file for providing the defaul schema independent rendering of list and library views. Even if you are writing your own XSL it appears that SharePoint still needs access to pieces of that XML.