, , , ,

A data form web part generated complicated HTML and sometimes creates problem for the designers. When you look into generated HTML you can notice some attributes we don’t want to appear in the markup.

<div style="margin: 0px auto; padding: 0px; width: 800px;" xmlns:ddwrt2="urn:frontpage:internal" xmlns:sharepoint="Microsoft.SharePoint.WebControls" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:x="http://www.w3.org/2001/XMLSchema">

I know you hate them, but I have good news. You can get rid of these very easy. All you need to do is to go to stylesheet declaration and modify value for exclude-result-prefixes like this: ddwrt asp __designer xsl msxsl SharePoint ddwrt2 d x.

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="ddwrt asp __designer xsl msxsl SharePoint ddwrt2 d x" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">

Also, you need to be sure you don’t have namespaces declared on template level. Put all namespaces in stylesheet declaration and remove them, if you have, from template declarations.

I did not try yet, but you probably can apply the same thing to XSLT list view web part, if you customize XSLT, as what I described above is XSLT related. But I leave it up to you to try.