Tallan Blog

Tallan’s Experts Share Their Knowledge on Technology, Trends and Solutions to Business Challenges

Displaying Enhanced Rich Text in Content Query Web Part

SharePoint has the Content Query web part, which is a control that allows a user to display an aggregated list of items based on some criteria. You can choose to return items from all sites within a site collection or from a specific list; all based on a list type and content type. You also get a few different display options, but if you try to return an Enhanced Rich Text field, that is to say some HTML and CSS Styling, the results are a bit funky. The HTML markup is actually encoded, so you get something like this:

Content Query displaying a RichText Encoded field.

Content Query displaying a RichText Encoded field.

Not exactly what I was looking for, but it turns out there’s a pretty quick and simple fix for this.

  1.  In the site you are adding the Content Query web part go to Site Contents > Style Library > XSL Style Sheets and download a copy of ItemStyle.xsl.
  2. Open up ItemStyle.xsl in your favorite text editor and find all instances of the following:
        <div class="description">
            <xsl:value-of select="@Description"/>

    And replace them with:

        <div class="description">
            <xsl:value-of disable-output-escaping="yes" select="@Description"/>
  3. Save the file and upload it back into the Style Library > XSL Style Sheets SharePoint Folder.
  4. Make sure to publish the file after you’ve uploaded it

Your Content Query web part should now display Enhanced Rich Text fields correctly.

Content Query displaying a decoded RichText field.

Content Query displaying a decoded RichText field.

Learn more about Tallan or see us in person at one of our many Events!

Share this post:

6 Comments. Leave new

Scott Rosenbloom
December 28, 2015 9:54 am

I know this is an older post, but I have a question: the code you suggest works when I’m logged in as an administrator. When I log in as a regular user and refresh, the HTML comes back, and some customizations I made in the XSL (as an admin) are no longer showing. Thoughts?

Brian Feldmann
December 29, 2015 8:53 am

Hey Scott, did you make sure to publish a major version of the XSL file after you made the changes?

Thank you very much! How I glad to have found your article!

My God, this is the first code-it-yourself SharePoint tutorial I have followed that ACTUALLY WORKED!


I tried this with Content Search Web Part but unfortunately this code did not work. Does this code also work for Content Search Web Part?

Still works in SP 2016! Thank you for the article!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>