Skip to content

Dumping the RAW CQWP Query Results (or How To Change the ContentQueryMain.xsl)

Sometimes working with SharePoint feels like picking a lock. You know that if you get the right combination the lock will open and you’ll be able to get what you want — however, figuring out that critical combination is difficult. I’ve spent too many hours trying to do something simple — I wanted to look at the results of the query generated by the CQWP in its raw form. There are several posts that talk about how to dump out the attributes/fields that are coming back from the query, including Heather Solomon’s. This uses a simple technique in the ItemStyle.xsl which creates a template that iterates through each of the attributes by using a select of @* (meaning Attributes, All). However, I just wanted to see the raw XML. The XSLT to do that is pretty trivial…

However, there aren’t a ton of examples on how to even customize the main XSL for the Content Query Web part. The property you need to change in the web part file is MainXslLink. However, this property isn’t covered in either How to: Customize the Content Query Web Part by using Custom Properties or How to: Customize XSL for the Content Query Web Part. I located the property and tried to customize it with my little dumpall.xsl that I keep around (it is little more than the XSL snippet above). However, every time I’d use it I’d get an error message:

Help Your SharePoint User

Well, it turns out that there are some dependencies in the CQWP to what’s in the main XSLT file. (No I didn’t isolate them.) So instead of starting with a blank file to dump out everything I made a copy of the ContentQueryMain.xsl where I replaced the following snippet:

with the snippet above to dump everything out. This worked beautifully. It dumped out what the CQWP was providing to the XSLT for transformation.

1 Comment

  1. Hello!
    Very Interesting post! Thank you for such interesting resource!
    PS: Sorry for my bad english, I’v just started to learn this language ;)
    See you!
    Your, Raiul Baztepo

Add a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this: