Sunday, February 20, 2011

XML and XSL transformation control for SharePoint 2010

The ASP.NET control control for SharePoint enable users to provide their XML and XSL files, spitting out the resulting HTML based on the two control parameters.

1. Copy and paste the code below in your custom SharePoint page:
<div>
<asp:Xml runat="server" id="xmlEmployee" DocumentSource="/_layouts/SPFix/Employee.xml" TransformSource="/_layouts/SPFix/Employee.xsl">
</asp:Xml>
</div>

2. The Document Source behavior takes an XML file path and Transform Source takes an XSL file path
3. You can see the resulting HTML spitted out to the browser when you hit your SharePoint custom page.

Quickest way is to try using SharePoint Designer as per the best practice you need to create a Visual Studio solution for your SharePoint pages.