XHTML documents render incorrectly when served as application/xhtml+xml

VERIFIED INVALID

Status

()

Core
Layout
VERIFIED INVALID
15 years ago
15 years ago

People

(Reporter: Andreas Ehn, Unassigned)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021028
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021028

When a (valid) XHTML document is served as application/xhtml+xml it renders
incorrectly. The same document is ok when served as text/html.

Examples:

http://dantooine.dyndns.org/~ehn/index.xhtml
http://dantooine.dyndns.org/~ehn/index.html

That's the same document (one is a symlink to the other) served with different
content types.

Reproducible: Always

Steps to Reproduce:
1. Start Mozilla
2. Go to http://dantooine.dyndns.org/~ehn/index.xhtml
Actual Results:  
The layout is broken.

Expected Results:  
Render the valid XHTML document correctly.

Comment 1

15 years ago
Remove <link href="style/general.css" rel="stylesheet" type="text/css" /> and
put <?xml-stylesheet href="style/general.css" type="text/css"?> after the
doctype declaration.

Comment 2

15 years ago
Eh, never mind (well, yes add it anyway). Your comment delimiters preceding the
inline CSS doesn't work well with XML. Delete those delimiters and it will work
(Netscape 1.07 won't render application/xhtml+xml anyway, so you won't need them).
Agreed. You can use "comments" in <style> and <script> in HTML because those 
elements are declared content type CDATA, so no markup is recognized within 
them except for end-tags. XML doesn't have CDATA content types, so the "<!--" 
really *is* parsed as a comment and the content disappears. See XHTML 1.0 
Appendix C, Section 4. This bug is INVALID.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → INVALID
(Reporter)

Comment 4

15 years ago
Ok, I removed the comments around the inlined CSS and changed <link
href="style/general.css" rel="stylesheet" type="text/css" />" to
<?xml-stylesheet href="style/general.css" type="text/css"?>. Most of the
problems disappeared. However, there is still one difference in the way the
document renderes when served as application/xhtml+xml as opposed to text/html.
With the former content type the background (defined in the general.css) is ignored.

Comment 5

15 years ago
That's because the background is defined on the body element. In XHTML yous
should define that stuff on the html element.

Comment 6

15 years ago
Btw, leave <link href="style/general.css" rel="stylesheet" type="text/css" /> if
you intend to serve your document also as HTML. HTML renderers don't recognize
XML directives and thus need the linked stylesheet.

Also, our fave browser IE doesn't recognize XML linked stylesheets and in fact
defaults to quirks mode if such a tag is there... if you need IE compatibility,
you should remove <?xml-stylesheet href="style/general.css" type="text/css"?>. I
am sorry if I have confused you.
(Reporter)

Comment 7

15 years ago
Everything works well now. Thanks for clearing things up!
verified per reporter
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.