Recall: Cannot load the XSL file


Just found another reason behind the "Cannot load the XSL file" error.
Imagine you activate the feature only to a site which is not the rootsite (like http://foo/sites/sitecollection).
The webpart will then search for the XSL at http://foo/styles... Of course the XSL is not there because the solution is not deployed in http://foo.
Workaround is to edit the .webpart file and alter the following properties:
<property name="MainXslLink" type="string">/sites/[sitecollection]/Style Library/ECQWP XSL Style Sheets/ECQWPMain.xslt</property>
    <property name="ItemXslLink" type="string">/sites/[sitecollection]/Style Library/ECQWP XSL Style Sheets/ECQWPItems.xslt</property>
    <property name="HeaderXslLink" type="string">/sites/[sitecollection]/Style Library/XSL Style Sheets/Header.xsl</property>
You can then import the webpart.
Works like a charm then, great stuff!!


manosfloyd wrote Feb 14, 2008 at 12:29 PM

Just in case you're still interest on it:

I was already developping our own CQWP when I found out about yours. I was overwritting the xsl files and then I realize you were using a much better solution here, but when we tried our CQWP in a site collection, even when the feature was being activated at the root level, the xsl's were not being found.
So, by now think an option could be to add the server location on the code, something as:
        SPSite currSite = SPContext.Current.Site;
        this.MainXslLink = currSite.ServerRelativeUrl +this.MainXslLink ;
        this.ItemXslLink = currSite.ServerRelativeUrl + this.ItemXslLink;
It's working Ok for US,


manosfloyd wrote Feb 14, 2008 at 12:34 PM

Sorry, I 'didnt mention before.

I'm caling this code on the init event.

junx13 wrote Aug 4, 2008 at 3:09 AM

Just a question , has this been planned to be worked on ? Thanks for the great work!

wrote Feb 14, 2013 at 6:11 PM