Closed Bug 267161 Opened 20 years ago Closed 20 years ago

style sheet processing instruction linking to XHTML style element causes a MIME type error

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 61675

People

(Reporter: martin.honnen, Assigned: dbaron)

Details

Attachments

(2 files)

The test case I am going to upload is an XML file served as text/xml which
contains a style sheet processing instruction
<?xml-stylesheet type="text/css" href="#internalStyle"?>
linking to an XHTML <style id="internalStyle" type="text/css"> element in the
document. That causes an error message alike the following in Mozilla's
JavaScript console:

Error: The stylesheet
http://localhost/javascript/test2004110101.xml#internalStyle was not loaded
because its MIME type, "text/xml", is not "text/css".
Source File: http://localhost/javascript/test2004110101.xml
Line: 0

The CSS seems to be applied nevertheless but the error message irritates me and
I think it is wrong, I don't see anything wrong with the markup and obviously
the content of the <style> element is text/css and not text/xml, that is only
the content type of the document containing the <style> element. Thus I think
Mozilla should not display that error message if the style sheet processing
insruction links to an internal <style type="text/css"> element.
> The CSS seems to be applied nevertheless 

That happens even without the processing instruction, because you have a <style>
element in the XHTML namespace in your document.  Those are defined to apply style.

> I don't see anything wrong with the markup and obviously the content of the
> <style> element is text/css and not text/xml

The processing instruction's href is a relative URI resolved relative to the
base URI of the page.  Then the resulting URI is loaded.  So the processing
instruction simply points back at the original XHTML page, which is in fact NOT
text/css.  Processing instructions have no concept of "internal" linking.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
(In reply to comment #2)

> The processing instruction's href is a relative URI resolved relative to the
> base URI of the page.  Then the resulting URI is loaded.  So the processing
> instruction simply points back at the original XHTML page, which is in fact NOT
> text/css.  Processing instructions have no concept of "internal" linking.

I have based my bug report and the construct of having a style sheet processing
instruction using a fragment identifier on the appendix in the XHTML 1.0
recommendation:
  http://www.w3.org/TR/xhtml1/#C_14
There you can find
  <?xml-stylesheet href="#internalStyle" type="text/css"?>
and then
  <style type="text/css" id="internalStyle">
so at least the authors of that spec think that the stylesheet processing
instruction should link to an embedded element via a fragment identifier.
We already have a bug for <?xml-stylesheet href="#something" type="text/css"?>
not working. That's bug 61675.
The XHTML authors seem to be assuming that a certain very early draft created by
the CSS WG is actually a specification.  It's not, and given the issues in how
it's defined it's not going to be one in the near future.

In short, that part of the XHTML specification directly contradicts other
specifications.
Also note that if things _did_ work as the XHTML WG seems to think they work the
stylesheet would be applied twice.  Which is unlikely to be desirable in any case.
(In reply to comment #2)

> The processing instruction's href is a relative URI resolved relative to the
> base URI of the page.  Then the resulting URI is loaded.  So the processing
> instruction simply points back at the original XHTML page, which is in fact NOT
> text/css.  Processing instructions have no concept of "internal" linking.

In addition to my previous comment I have just looked at the W3C recommendation
  http://www.w3.org/TR/xml-stylesheet/
and it says clearly:
  "Since the value of the href attribute is a URI reference, it may be a
relative URI and it may contain a fragment identifier. In particular the URI
reference may contain only a fragment identifier. Such a URI reference is a
reference to a part of the document containing the xml-stylesheet processing
instruction (see [RFC2396]). The consequence is that the xml-stylesheet
processing instruction allows style sheets to be embedded in the same document
as the xml-stylesheet processing instruction."
It does say it clearly, but there is no test suite and no known interoperable
implementations of "relative URIs".
Status: RESOLVED → REOPENED
Resolution: INVALID → ---

*** This bug has been marked as a duplicate of 61675 ***
Status: REOPENED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → DUPLICATE
This test case shows that Mozilla recognizes a fragment identifier in the href
(pseudo) attribute of an <?xml-stylesheet?> processing instruction if the type
is text/xsl so it is even more odd that the fragment identifier is not
recognized in the case of text/css.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: