0

query web part output in SharepointI have edited my CQWP by adding the field 'Body' from my NEWS list into the 'CommonViewProperties' of the web part.

I imported the web part, added it, and put the 'Body' in the description section of the web part. This brings back the text with div tabs and other tabs. How do I just bring back the text found in the field without the html markup tabs?

setting on web part

  • this is the xml for the query web part<property name="QueryOverride" type="string" /> <property name="PageSize" type="int">-1</property> <property name="UseSQLDataSourcePaging" type="bool">True</property> <property name="FeedEnabled" type="bool">False</property> <property name="CommonViewFields" type="string">Title, DisplayImage, Body</property> <property name="FilterField3" type="string" /> <property name="Hidden" type="bool">False</property> <property name="MainXslLink" type="string" /> – MEV May 22 '17 at 13:48
0

I updated the ITEM STYLE.XLST file in style library.

<xsl:template name="AnnouncementwithImage" match="Row[@Style='AnnouncementwithImage']" mode="itemstyle">
<xsl:variable name="SafeLinkUrl">
  <xsl:call-template name="OuterTemplate.GetSafeLink">
    <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
  </xsl:call-template>
</xsl:variable>
<xsl:variable name="SafeImageUrl">
        <xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
            <xsl:with-param name="UrlColumnName" select="'ImageUrl'"/>
        </xsl:call-template>
</xsl:variable>
<xsl:variable name="DisplayTitle">
  <xsl:call-template name="OuterTemplate.GetTitle">
    <xsl:with-param name="Title" select="@Title"/>
    <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
  </xsl:call-template>
</xsl:variable>
<div class="item link-item" style="padding: 0 30px">
  <xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
  <h3 title="{@LinkToolTip}" style="margin-bottom:3px;padding:3px;border-bottom:1px solid #224d79;color:#224d79;font-size:24px;display:block">
     <xsl:value-of select="$DisplayTitle"/>
  </h3>
  <i><xsl:value-of select="ddwrt:FormatDateTime(@Created, 1033, 'MMMM d, yyyy')" /></i>
  <div style="font-size:14px !important;">
   <xsl:if test="string-length($SafeImageUrl) != 0">
            <div class="image-area-left" style="padding-right:10px">
                <a href="{$SafeLinkUrl}">
                  <xsl:if test="$ItemsHaveStreams = 'True'">
                    <xsl:attribute name="onclick">
                      <xsl:value-of select="@OnClickForWebRendering"/>
                    </xsl:attribute>
                  </xsl:if>
                  <xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'">
                    <xsl:attribute name="onclick">
                      <xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/>
                    </xsl:attribute>
                  </xsl:if>
                  <img width="174" height="134" style="border:2px solid #c2c2c2" src="{$SafeImageUrl}" title="{@ImageUrlAltText}"/>
                </a>
            </div>
     </xsl:if>
   <xsl:value-of disable-output-escaping="yes" select="@Body" />
  </div>
</div>

this allows news items to be displayed in the manner desired, easily borrow this code for use of title, created, displayimage, body

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.