Sharepoint Content Query Webpart untrusted xsl file

sharepointweb-parts

I have created a custom xsl file for the Content Query Webpart. I assigned the path of the xsl file to the property "MainXsl" of the CQW. After I put the CQW to a sub sitecollection, it show me the following message: "The web part references an untrusted XSL file. Only XSL files contained in this site's Style Library may be referenced."

I have checked up, there is my xsl file in the sub sitecollection (Style Library/XSL Style Sheets) and is published.

Please tell me how to solve this problem?

Best Answer

Bit of thread necromancy here, but as this is one of the top Google result for the error message...

I was getting this error even with the XSL file in the site collection's Style Library. To fix, when you reference the XSL file (in my case in the .webpart file), use server-relative path, eg. /sites/[site name]/Style Library/[stylesheet].xsl and all will be well!

EDIT: From @MBentley's comment, you can also use URL tokens, such as ~site/Style Library/[stylesheet].xsl to avoid having to use the absolute URL.

Related Topic