Viewing raw data in a Content Query Web Part

Partly a reminder for myself, but hopefully useful for others…

I regularly use the Content Query Web Part (CQWP) and the Data Form Web Part to format how data, usually from SharePoint lists, is presented back to the user. A common scenario for me is to check that the data being returned by the query includes the data I need. The below steps show how to add an ‘Extended Content Query Web Part’ into the gallery which includes an additional view style to return the data:

1) Navigate to the style library at the root of the site collection and make a copy of ItemStyle.xsl called ExtendedItemStyle.xsl

2) Edit ExtendedItemStyle.xsl to include the following XSL template – I placed my template as the last template in the file:

  <xsl:template name="DisplayRawData" match="Row[@Style='DisplayRawData']" mode="itemstyle">
  	<xsl:for-each select="@*">
  		<xsl:value-of select="name()"/>
 	 	<xsl:text> = </xsl:text>
 	 	<xsl:value-of select="."/><br/>

3) Make sure that ExtenedItemStyle.xsl is checked in and has a major version published

4) Navigate to the web part gallery and download a copy of ContentQuery.webpart locally

5) Modify this .webpart:

  • Change filename to ExtendedContentQuery.webpart
  • Modify Title property to be ‘Extended Content Query’
  • Update the ItemXslLink line to (for example):
    <property name="ItemXslLink" type="string">

    Note – line breaks added for clarity.

6) Upload this new .webpart file back into the web part gallery, and set any properties desired; I have added mine into the ‘Content Rollup’ group so that it appears with the regular Content Query web part

Now, adding this web part to a page will enable you to return the raw data returned by a query, as the screenshots below show.

CQWP Raw Data Web Part Properties

CQWP Raw Data Results

share and enjoy
  • Print
  • Twitter
  • Digg
  • StumbleUpon
  • Yahoo! Buzz
  • Google Bookmarks
  • Facebook

3 comments to Viewing raw data in a Content Query Web Part

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>