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?
相关问题
- Illegal to have multiple roots (start tag in epilo
- Newtonsoft DeserializeXNode expands internal array
- how to use special characters like '<'
- XML - XSLT - document() function inside count() fu
- convert logback.xml to log4j.properties
相关文章
- Creating XML Elements without namespace declaratio
- Get Attribute Value From Simple XML Using JQuery /
- Firefox remembering radio buttons incorrectly
- Directly signing an Office Word document using XML
- When sending XML to JMS should I use TextMessage o
- Fragment Content Overlaps Toolbar and Bottom Navig
- Getting “Error: Missing Constraints in ConstraintL
- xslt localization
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?
You could also change this setting on firefox:
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.
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:
I noticed that CSS and image files can remain on the server without restrictions.
On the original question: If you get this error with Firefox when opening your XML document:
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:
but that did not do the trick in this case (and can even be set to true for this case).