none
Show the Body of Announcement at Content Query Web Part RRS feed

  • Question

  • I attempt to show the Body of Announcement at Content Query Web Part.

    Case 1
    I get the following result:
    The 1st line shows the Title as normal.
    The 2nd line shows:
    <div class=ExternalClass90BF9EBAACDA4DF59EBCBD401F04EBBF><div>Hello!</div></div>
    It should be 'Hello!' only without the html code.

    I tried the following at the webpart file:
    <property name="CommonViewFields" type="string">Body, Note</property> or
    <property name="CommonViewFields" type="string">Body, RichHTML</property> or
    <property name="CommonViewFields" type="string">Body, RichText</property>.
    Certainly, I have the following at the ItemStyle file:
    <div class="description">
    <xsl:value-of select="@Body" />.


    Case 2
    I get the following result:
    The 1st line shows the Title as normal.
    The 2nd line shows nothing of the Announcement Body.

    I tried the following at the webpart file:
    <property name="CommonViewFields" type="string">Body_x0020_content, RichHTML</property> or
    <property name="CommonViewFields" type="string">Body_x0020_content, Note</property> or
    <property name="CommonViewFields" type="string">Body_x0020_content, RichText</property>
    with the ItemStyle file:
    <div class="description">
    <xsl:value-of select="@Body_x0020_content" />.

    and
    <property name="CommonViewFields" type="string">Body_x005F_x0020_content, RichHTML</property> or
    <property name="CommonViewFields" type="string">Body_x005F_x0020_content, Note</property> or
    <property name="CommonViewFields" type="string">Body_x005F_x0020_content, RichText</property>
    with the ItemStyle file:
    <div class="description">
    <xsl:value-of select="@Body_x005F_x0020_content" />.

    Please help.

    I have read the following:
    http://www.heathersolomon.com/blog/articles/CustomItemStyle.aspx
    http://blogs.msdn.com/ecm/archive/2006/10/25/configuring-and-customizing-the-content-query-web-part.aspx

    Tuesday, May 12, 2009 7:00 AM

Answers

  • You have probably moved on from this problem but in case someone else needs the answer:

    First in the web part you need to use this:
     <property name="CommonViewFields" type="string">Body, RichHTML</property>

    Second in your XSL you need to use this:
    <xsl:value-of select="@Body" disable-output-escaping="yes"/>

    Then you should be all set.

    Andrew

    Wednesday, April 7, 2010 9:15 PM

All replies

  • You have probably moved on from this problem but in case someone else needs the answer:

    First in the web part you need to use this:
     <property name="CommonViewFields" type="string">Body, RichHTML</property>

    Second in your XSL you need to use this:
    <xsl:value-of select="@Body" disable-output-escaping="yes"/>

    Then you should be all set.

    Andrew

    Wednesday, April 7, 2010 9:15 PM
  • Thank you Andrew!
    Wednesday, June 2, 2010 9:02 PM
  • Thanks Andrew for the response, please can you let me know where will i find the XSL file so that i can go ahead with the second step.
    Monday, March 19, 2012 11:51 AM
  • Hi Tulajaram,

    In case you haven't found it yet, that code will be on whatever page the Web Part is on and can be opened in Designer.

    Tuesday, May 1, 2012 3:39 PM
  • Andrew - I'm wondering if there's a 2019 SharePoint online version of this. I'm doing the same thing - pulling an image and the body from an announcement list in a CQWP, and I get the same response as above: 
    • <div class="ExternalClassB59096E05DA04E79B8AC9E052611B55E"><p>TEXT​</p></div>
    Friday, August 30, 2019 10:53 PM