I have been trying for days to understand why, following an upgrade to Sp2010, none of the statements used in my web part definitions are working. The work fine in SP Designer 2010 and render as before but displaying the web pages in a browser, they do not. What gets rendered appears to use data from the appropriate list (as defined in the web part) but using whatever the last valid stylesheet was rendered, which of course makes no sense. If I remove the import statement completely I get the same result so I can only assume the runtime is unable to find the included stylesheet? I have tried everything I can think of with no luck.

This is a major issue as the only solution I have is to copy all the stylesheet code back into their respective web parts (30+ pf them), which is such a retrograde step.

N.B. I have tried creating a web part page in an empty SP2010 site then putting the XSL template in an external .xsl file and trying to include it but have hit the same issue, so it doesn't appear to be an issue with the migrated site, rather, something in the site configurations of our SP2010 farm?

I would be so grateful for any help available.

  • I'd recommend you to check SharePoint ULS logs, and post here the exception message or something like this. If stylesheet is not found, it must be an exception message. Oct 27, 2011 at 12:05
  • Thanks for this. I don't have access to the logs but I'll check with our system admin guys. Nov 1, 2011 at 9:31
  • Maybe the upgrade caused a custom solution to stop working. I mean, maybe it broke a custom webpart that you use alot.
    – bgmCoder
    Dec 9, 2015 at 23:46

2 Answers 2


I've had issues using the xsl:import before when I am importing items that are in a SharePoint library. If I'm importing a file from the filesystem then I have no trouble; but from the Style Library for example I get an error about not being able to load the XSL file (in the ULS Logs).

If you are unable to deploy your XSL to the filesystem then I think the options would be to either keep the XSL in the web part (as it is by default when using SPD or perhaps to use the XSL Link property of the web parts (which can be set through the UI) to point to a re-usable XSL file in a SharePoint library.

My personal preference is to use the XSL Link property.

  • Thanks for the reply Glyn. I'm actually holding the xsl code in a folder in the site's file system. I'll try moving it somewhere else then, if that fails, try the xsl:link option. Nov 1, 2011 at 9:31

This might be way off but have you ensured that your tag is located in the web part code correctly? It's important that it's directly after the tag and won't work anywhere else.

Additionally, does your XSL file in the style library have the appropriate tag at the top?


<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xsl msxsl ddwrt"
<xsl:output method="html" indent="no"/>
/* code */

These are two gotchas that have bitten me before.

  • Can you describe the first gotcha you refer to a bit more? I am having the same issue as the original author. Dec 27, 2011 at 23:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.