ContentQueryWebPart Error

After we upgraded to SharePoint 2010, few web parts were giving the below error.

Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer

Recently I’ve added a Content Query Web Part and I got the same error. Checked the error log and got the following

Error while executing web part: System.Xml.Xsl.XslLoadException: XSLT compile error. An error occurred at (1,462). ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
...nclude) --- End of inner exception stack trace --- at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include) at System.Xml.Xsl.Xslt.XsltLoader.Load(Compiler compiler
...rt.LoadXslCompiledTransform(WSSXmlUrlResolver someXmlResolver) at Microsoft.SharePoint.WebPartPages.DataFormWebPart.GetXslCompiledTransform() at Microsoft.SharePoint.WebPartPages.DataFormWebPart.
InnerException 1: System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at System.Xml.XmlDownloadManager.GetNonFileStream(Uri u

After going mad for hours, finally found this small thing which saved us. One of the internal XSL files referred from the “StyleSheet Library” was not published. Publishing all the xsl files fixed the issue.