I'm using a CQWP in a sub-site and its referencing back to xsl style sheets in the Style library(in the site collection) xsl files are ItemStyle.xsl ,header.xsl and ContentQueryMain.xsl. The same CQWP is used in the site collection but using a modified ContentQueryMain.xsl and it works.The modification basically just adds a DIV before start element of the webpart to apply a different class and an ID.

The problem i have though is when i edit the CQWP in the subsite using sharepoint designer and change the ContentQueryMain.xsl to the modified one and save it.

It doesn't add the DIV element because when i reopen the CQWP in the subsite site and look at the changes it sets it back to ContentQueryMain.xsl and not the modified one.

Any ideas what is happening?


I believe you issue comes from the fact that the link to the CQWP XSLT might not be referencing anymore that site collection level XSLT files. There are 3 XSLT files, obviously in the Style Library located, and when exporting it, it might that the actual link to your XSLT file has been changed.

I would look via the Notepad at the exported CQWP and look for MainXslLink (others being HeaderXslLink, ItemXslLink) and make sure the actual path starts with "~site/Style Library" rather than the actual absolute sub-site address.

| improve this answer | |

You might have a caching problem. The xsl files won't be rendered every time instead the will be compiled and stored in a cache.

During development i had this issues a couple of times. What you can try to do is to reload the page by holding shift+refresh in the address bar or disable the caching behaviour.

On the content query web part there is a property UseCache that needs to be set to false. Then the xsl files won't be cached anymore and you will see the result immediately. After you made your changes you can enable the cache setting back.

You need also make sure that all the XSL Files in the web part configuration will be loaded from the root of the site collection. Those files also must be stored inside of the style library.

| improve this answer | |
  • Thanks guys for the response. Its on a SharePoint 2010.Fortunately enough i exported and imported to a subsite and it worked.Also had a look at the webpart code i exported and it looked the same.But when i did it manually it didn't. – naijacoder Jan 1 '14 at 22:50

Is this 2010 or 2013? In 2010 you could select the CQWP and see the properties for the web part in SPD but I have not figured out how to do the same thing in 2013 yet. In 2013 you seem to be back to 2007 days when you had to export the web part and edit the XML.

| 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.