SharePoint, as default, gives a lot of parameters to be rander in the XSL code.
After creating a new DVWP, we can clean the DVWP from unwanted parameters and functions, and convert it from <table> to <div> tags to be designed.
As for a start the XSL code can be at least 178 rows that we can remove and to be 31 rows tops. Sounds better and look better. The least rows we have, the faster the page will load.
There are many options and functions we can remove from the code that SharePoint Designer creates by default in a DVWP:
- Creating a new Data View from “Empty Data View” (by the “Data View” button) – when creating a new Data View, SPD will generate the web part with parameters and the values already in the code. By creating an empty one, you will control most of the values and parameters to be added.
- “Display all items” option (in the “Paging button), will remove some of the code.
- <xsl:when test="($ManualRefresh = 'True')"> - This function builds a table with “Refreshing” option. In many DVWP we don’t use it – so we can erase this.
- <xsl:call-template name="dvt_1.empty"/> and <xsl:template name="dvt_1.empty"> - Empty template
- “ms-alternating” class function – there is a function to design all of the rows which divided by 2. When designing a web part with styles and classes there is no need for it because we are overwriting it with our styles.
- <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1"> - the automode is a function is used to switch modes, usually between display and edit.
Pretty big code, and with a lot unused decelerated functions. But after we clean it, it looks like this:
Now, the only thing have left is to insert out classes and styles and the DVWP is ready.