Question

I'm trying to read the value of a multi-line, enhanced rich text field from a content query web part using a custom ItemStyle template in SP 2010. Even though it has a value, it keeps coming back as blank. The column type is described as "Multiple lines of text", with "Enhanced rich text (Rich text with pictures, tables, and hyperlinks)" enabled.

The column name is "Opening Hours". In the *.webpart, I've defined it using

<property name="CommonViewFields" 
  type="string">Opening_x005F_x0020_Hours,Text</property> 
....
<property name="DataColumnRenames" 
  type="string">Opening_x005F_x0020_Hours,OpeningHours;</property>

In the custom ItemStyle_ContactDetails.xsl, it's read using this simple loop:

<xsl:for-each select="@*">
   P:<xsl:value-of select="name()" /><br />
   v:<xsl:value-of select="." /><br />
</xsl:for-each>

When I import the web part and insert it into a page, it displays this for the opening hours:

P:OpeningHours
v:

I've triple checked to ensure the column has value. Other fields display their values in the web part, though. This is the only Enhanced rich text field I'm using in this list. I also tried changing the type to HTML and RichHTML to no avail. What am I doing wrong? Thanks.

Was it helpful?

Solution

You have to disable output escaping by adding disable-output-escaping="yes" to the element. It is covered in this post on MSDN.

http://blogs.msdn.com/b/ben_hickman/archive/2009/05/22/content-query-web-part-example.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top