Fix for SharePoint 2013 Content Query Web Part with No Results Nesting Elements

In SharePoint 2013, the handling of a content query web part that brings back no results is extremely poor. It causes some elements before it to start nesting everything after it – here’s a quick fix.

  1. Open up the ContentQuerymain.xsl in the /Style Library/XSL Style Sheets folder
  2. There is a template that is used for empty results – <template name=”OuterTemplate.Empty”></template>
  3. Replace that with the code below
<xsl:template name="OuterTemplate.Empty">
  <xsl:param name="EditMode" />
      <xsl:when test="$EditMode = 'True' and string-length($cbq_errortext) = 0">
        <div class="wp-content description">
          <xsl:value-of disable-output-escaping="yes" select="$cbq_viewemptytext" />
        <div style="display:none">No results found</div>

You may also like...

Leave a Reply

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

17 + 19 =