Monday 7 May 2007

SharePoint 2007: DataViews - the best most flexible SharePoint toy (and how to solve rich text field HTML problems)

I have recently discovered the wonder that is a Data View web part. This web part is an invaluable tool in creating different views of data in your sites (or from external sources).

One of the things I have used it for is to display data from two list linked via a lookup. There are tons of pages on Data Views.

One of the weird things I found with the Data View was that when I tried to display data from a Rich Text field (containing rich formatting) I got a number or <div> and other HTML characters, which obviously were very unsightly.

To remove these, in SharePoint Designer I found the <xsl:value-of select="@your rich text field"> for the column and added the disable-output-escaping="yes" tag to it i.e.

from

<xsl:value-of select="@your rich text field">

to

<xsl:value-of select="@your rich text field" escaping="yes">