I have created a Site Collection with a number of Sites that were created using the same Site template have therefore have an instance of the same List type (Issue Tracking) - 'Tasks'. I simply want to create a Dashboard overview on the root Site of the Site Collection. The CQWP seemed an obvious choice for this. However, I can't believe that the only way to add more fields and customize it to display anything useful is to Export the Web Part, change the XML by hand and then create custom XSLT!

I literally want it to display the aggregated List content, presented in exactly the same format as the child Lists - I don't need to change the fields or provide a fancy design. Even if I did this manual process once it seems slow, error prone and time consuming. Is there anything out there that would allow me to simply define a View on child Lists and then specify that View in the Web Part properties. It would then render like any any other List.

I can develop this Web Part myself if necessary, but I want to make sure I haven't overlooked anything first.


Mike Taylor

2 Answers 2


We can use CQWP to show it as ListView, Refer the below steps:

  • Edit ContentQueryMain.xsl file

Search <xsl:template name="OuterTemplate.Body">

Change it as:

<xsl:call-template name="OuterTemplate.CallItemTemplate">
<xsl:with-param name="CurPosition" select="$CurPosition" />
<xsl:with-param name="LastRow" select="$LastRow" /></xsl:call-template>

Search <xsl:template name="OuterTemplate.CallItemTemplate"> - Line 147

You see the "CallItemTemplate". Copy the second line and past it directly beneath it and make it look like this:

<xsl:template name="OuterTemplate.CallItemTemplate"><xsl:param name="CurPosition" /><xsl:param name="LastRow" />

Because we want to use this within our custom item template we also have give the parameter through to the template by adding a when statement just before the within the CallItemTemplate:

<xsl:when test="@Style='SPGrid'"><xsl:apply-templates select="." mode="itemstyle"><xsl:with-param name="CurPos" select="$CurPosition" /><xsl:with-param name="Last" select="$LastRow" /></xsl:apply-templates></xsl:when>

In this statement we specify that it only has to pass-through the parameter when the item template is SPGrid. So our custom template is going to be called “SPGrid”.

  • Edit ItemStyle.xsl

Within this file we add our custom xslt item template named "SPGrid".

<xsl:variable name="SafeImageUrl">
  <xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
    <xsl:with-param name="UrlColumnName" select="'ImageUrl'"/>
<xsl:variable name="SafeLinkUrl">
  <xsl:call-template name="OuterTemplate.GetSafeLink">
    <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
<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:variable name="LinkTarget">
  <xsl:if test="@OpenInNewWindow = 'True'" >_blank</xsl:if>

<xsl:variable name="tableStart">
  <xsl:if test="$CurPos = 1">
    <table width="100%" class="ms-listviewtable" cellpadding="1" cellspacing="0" border="0">
      <tr class="ms-viewheadertr ms-vhltr">
        <th class="ms-vh-icon"></th>
        <th class="ms-vh2">Name</th>

<xsl:variable name="tableEnd">
  <xsl:if test="$CurPos = $Last">
    <![CDATA[ </table> ]]>

<xsl:value-of select="$tableStart" disable-output-escaping="yes"/>
<tr class="ms-alternating ms-itmhover">
  <td class="ms-vb-icon">
      <xsl:if test="string-length(@DocumentIconImageUrl) != 0">
        <div class="image-area-left">
          <img class="image" src="{@DocumentIconImageUrl}" title="" />
  <td class="ms-vb2">
    <a href="{$SafeLinkUrl}" title="{@LinkToolTip}">                  <xsl:value-of select="$DisplayTitle"/>
    <xsl:value-of select="@Title"/>
<xsl:value-of select="$tableEnd" disable-output-escaping="yes"/></xsl:template>

I guess first 3lines for template are not getting added. Please manage and match the code with other templates available in ItemStyle.xsl


"List Type" is meaningless from a SharePoint perspective as it sees everything in terms of content types. If your custom list uses a specific content type then the CQWP can easily query all items of that type across the entire site collection (if needed), but if each list just has its own fields without using a content type then you pretty much have to roll your own solution based on the list name instead.

Adding custom fields is precisely how you describe but not quite the way you describe it. Exporting the web part and modifying the XML is only required once and that is only to tell it to use a different XSL file when it renders. Once that is done and uploaded back to the page, you shouldn't need to edit the Xml again. The custom fields is actually done by adding them to the Item rendering XSL and choosing that Item Style from the dropdown. That makes the custom fields visible in the Tool Part and then you can remap to your heart's delight. You can also edit freely edit the custom XSL file as well to make it behave the way you like.

Why Microsoft doesn't include the option to specify a different XSL file right in the tool part is beyond me, but that is what they did. They allow it for the XML Viewer Web Part, but not this one, go figure.

  • 1
    I see what you're saying, and my understanding of Content Types is obviously not all there, but this is not a Custom List - it is the built in Issue Tracking one I believe. As far as your comment on XML - from what I've read (and I could be wrong) you need to change CommonViewFields too, which to me is the error prone bit - finding the correct field InternalName and Type to use is a faff IMO. I haven't done the XSLT part yet, but importing the Web Part with CommonViewFields changed gives you no hint as to whether it actually got parsed correctly or not. Dec 11, 2012 at 17:59
  • 1
    Go into one fo the list settings and click on the Advanced settings link. Toggle the Allow management of content types to Yes and click OK. This will then tell you what the content type is for the Issues Tracking list and in turn use that in the CQWP to roll up the data. Dec 11, 2012 at 18:05
  • 1
    Ok, done what you suggested but I'm not exactly sure what's changed. I can see that 'Issues' is the only Content Type and in CQWP I have changed it to use List Content Types and Issues. I still only get one column displayed - how do I get more without messing about in XSLT? Dec 11, 2012 at 18:15
  • 1
    How it appears is in the Presentation section of the CQWP settings and it has a limited number of Item Styles available out of the box. If you need more or a different layout, you will need to create your own XSL. This might help: heathersolomon.com/blog/articles/customitemstyle.aspx
    – Dave Wise
    Dec 11, 2012 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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