This series assumes that you are familiar with the “HTML Calculated Column” .
Part I: fallback to SP 2007
Part II: edit in SharePoint Designer
In this part II, I am going to show a straightforward method that can be applied via SharePoint Designer.
In SharePoint 2010, lists are rendered through a new component, the XSLT List View (XLV) .
Let’s add to a page a list with an HTML Calculated Column. Naturally, this column will be rendered as text. If we edit the page in SharePoint Designer, in split mode, it will look like this (click picture to enlarge):
The XSLT hierarchy is displayed at the bottom of the page. The tag that renders the field reads as follows:
This is a complicated expression, but for our purpose we don’t need to understand it. What we are going to do is tell SharePoint to interpret the field as HTML instead of just text, by adding the disable-output-escaping attribute (see picture below):
<xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping="yes">
And here we go, the field is now rendered as HTML:
The final result in the browser:
Note that the HTML rendering is done in the XSLT view itself. So if you have asynchronous updates enabled, all content refreshes will be rendered as HTML.
How about SP 2007?
Dealing with a standard Data View Web Part is more difficult, as explained here.
Conclusion: the HTML Calculated Column plays better with the XSLT List View in SP 2010 than it did with the Data View Web Part in SP 2007.
Your feedback and suggestions are welcome, they will guide me in my investigations. Also, let me know if you need more details on the step shown in this post.