Tutorial :Firefox and remote XSL stylesheets


I’m trying to load local XML files with a remote XSL stylesheet. IE seems to handle this just fine but not firefox. Is there a fix for this?


A few things to check:

Check that you're using the right mime-type and character encoding on the server side. Firefox will work out the encoding for itself when loading a local file, but will honour the server mime-type/encoding declaration when requesting from the server.

I've seen a few posts (eg here) that claim that Firefox simply doesn't support loading remote XSL templates using absolute paths. I doubt this, and suspect it's more likely the mime issue as per above leading them to believe this, but it might be worth asking Mozilla about this directly.

Finally, have you tested that the XSL stylesheet works when pulled locally? And can you confirm that it is really XSLT, and not one of Microsoft's bizarre IE-only XSL variants, such as WD-XSL?


If it's not a syntax problem, I think it's a same origin policy issue. Firefox (and also Chrome and IE9) doesn't transform a local XML with a remote XSLT for security reasons. It gives an unknown error 805303f4. Imagine that the XSLT could produce malicious JavaScript, embedded in the HTML output code.

Solutions, if you are the developer:

  • make the transformation on the server side and give the user the link to the output HTML
  • download locally (on the background) both the XML and the XSLT and then open the XML for the user

I noticed that CSS and image files can remain on the server without restrictions.


You could also change this setting on firefox:

  1. about.config
  2. Accept security warning (and be careful :-))
  3. Look for security.fileuri.strict_origin_policy
  4. Set it to false


On the original question: If you get this error with Firefox when opening your XML document:

Error loading stylesheet: An unknown error has occurred (805303f4)  

and if the XSLT stylesheet is referenced in the xml-stylesheet processing instruction using an absolute URL to a site different than the site of the XML document, then one solution can be to make Firefox use CORS by installing the Force CORS add-on. Of course, this requires that the server of the XSLT file supports CORS as well.

This made the difference for me (for the case of a local XML file referencing a remote XSLT using an absolute URL).

I also have the same-origin policy for file URIs turned off in Firefox by setting in about:config:

security.fileuri.strict_origin_policy = false  

but that did not do the trick in this case (and can even be set to true for this case).


I've had issues with Firefox performing the transform correctly, but was able to fix it by adding the XHTML namespace.

See the following for more info: How can I make XSLT work in chrome?


I have solved exactly same problem - it seems it was somehow related to the "Same origin policy". Domains http://someting.org and http://www.someting.org are not the same - my problem was referencing the .xsl stylesheet using the first variant (without the "www." part). After I've added the "www." part to my .xls stylesheet url, everything works fine.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »