From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.5+) Gecko/20011116 BuildID: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.5+) Gecko/20011116 Loading an XHTML document saved as .xml, I have a missing XSLT document referenced by a <?xml-stylesheet ?> processing instruction. This 404 means the XML parser should ignore the processing instruction; it does not. Reproducible: Always Steps to Reproduce: 1. Load the attached testcase (coming up) Actual Results: Blank page. Expected Results: "If you can read this, you don't need glasses" appears on the page in H1 format. Mozilla 0.9.5 renders the page without the special H1 formatting. So this is definitely a regression on an already bad bug.
Strange... my local copy of said testcase is coming up blank, but the online page is giving me plaintext. :(
Neither http://www.w3.org/TR/xml-stylesheet/ nor http://www.w3.org/TR/xslt specify the behaviour for a 404 in a stylesheet. It's an error, and it should be reported. A "just do as if nothing ever happened" is plain wrong, IMHO.
bz touched this in the last couple of days, at least for css
CSS stylesheet loading and XSLT stylesheet loading is totally different afaik. I doubt it is related.
*** Bug 144396 has been marked as a duplicate of this bug. ***
Peter should look at this.
Btw, in the case of CSS we just act as if there was no stylesheet so one could argue the same should happen with XSLT. On the other hand, it is very likely that the data would be totally unusable or seriously wrong, so an error result is also justified. I think I'd prefer seeing an error message. What does IE do?
IE6 displays this error message when a referenced xslt stylesheet can't be loaded: The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. -------------------------------------------------------------------------------- XML document must have a top level element. Error processing resource '<url>'. In my opinion, an error message like this is the correct behavior. However, when using IE in this manner, I wish it had a link/button/something to display the xml without the stylesheet (perhaps in the spiffy IE xml-pretty printing mode).
IE's behavior is wrong in that they totally deny access to the XML document underneath. They block access to the data. Heikki: why would it be "totally unusable or seriously wrong"? MathML and XHTML are two XML languages Mozilla currently renders (relatively) correctly without XSLT stylesheets; if the stylesheet is 404 or the wrong mimetype (there's been another bug filed for that, which this may be a dupe of), an error is justified, but that doesn't mean the MathML or XHTML aren't any good because the stylesheet's busted... For the record, the Amaya 6.1 editor does give the wrong stylesheet PI, which breaks MathML in Mozilla. Other than that, the MathML Amaya puts out is on very solid ground. (I filed a bug on this, and duped it to that other bug.)
For example, if I send you a P3P policy file in XML, you will have a hard time reading it without a stylesheet. An XSLT stylesheet can order the data in logical order, make summaries, indices, links, and generate content to explain the terse markup. I think this would be a typical situation where XSLT is used: the raw XML is useless to most people, and needs some kind of stylesheet to make any sense for humans. Also it is quite possible that the raw XML would contain information for several mutually excusive situations, needing a stylesheet to show and hide the relevant parts. Without a stylesheet you could easily draw wrong conclusions.
*** Bug 181571 has been marked as a duplicate of this bug. ***
Re comment 2: Behavior seems to have changed. In a recent nightly, Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4a) Gecko/20030328 I get a blank gray screen. I'm going to e-mail the W3C lists for xml-stylesheet and XSLT. We really should get an answer on this.
:( W3C hasn't said much yet; the one reply I got says "implementation-dependent". We're on our own.
This should be done with a nsIStreamListener, either directly in txStylesheetSink or in a separate object. This needs to hook itself up between the channel and the parser. This should detect all netwerk errors, including 404 and bad mime. It could provide a hook for both chrome and file schemes to trigger content sniffing, too. This would be in OnStartRequest, check for unknown-content and the right scheme, get the stream-converter-service and convert it. But that should be a separate bug, IMHO.
> It could provide a hook for both chrome and file schemes to trigger content > sniffing, too. That should arguably be moved down into the channel impls, a la ftp and http channels.
Fixed with checkin for bug 203192.