Forum Moderators: not2easy

Message Too Old, No Replies

Should I go beyond xhtml 1.0 strict?

         

wizpl

2:36 pm on Nov 1, 2005 (gmt 0)

10+ Year Member




I have just polished my website, which is valid xhtml 1.0 strict with tableless layout, uses no hacks, at the same time being accessible even for text browsers, and with css stylysheet just looks beautiful :)

The one thing I noticed is that it also validates as xhtml 1.1, if I only change the doctype. I've tried to read on this subject, but in a flood of information still too technical for me, I cannot find a simple answer.

What are practical pros and cones of xhtml 1.1 vs 1.0 and moving from text/html content to xml/xhtml? I mean what about accessibility of such documents, will I gain anything with 1.1?

Robin_reala

2:53 pm on Nov 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As for 1.1, if you don't know why you'd want it you don't need it. As for application/xhtml+xml, that's a different matter. The benefit is that you have to provide valid code, which theoretically decreases the chances of any bugs going unnoticed and should speed up rendering (no tag soup parser with fallbacks is required). In practise IE doesn't support it, and Mozilla doesn't render it incrementally (which leads to long delays before users see anything). Unless you need to use MathML or SVG in a modular XML environment I'd leave it alone. Well, I say I would, but I didn't :) I'm a sucker for shiny tech.

JAB Creations

4:14 pm on Nov 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ahh a good question and the answer if you have the umm, you know what is yes!

Robin is right about such things (hehe in my opinion to an extent).

I say yes go ahead with it but beware of what you're getting in to! document.write is an example of JS code that won't work and there are ways of getting around all sorts of problems.

I do hope you have copies of about 20 browsers because you're going to need to test them all!

You have to serve XHTML 1.1 (and there is no strict/transitional) files with a mime of "application/xhtml+xml". This can be achieved via serverside coding. You can change a document's mime type based on the useragent. IE7 will still blow in this respect as it will not support application/xhtml+xml and therefor will remain a quirks browser as far as I'm concerned for probally years to come.

I suggest doing a search for "xhtml application/xhtml+xml" for additional reading on the topic. Once I get in to the serverside development of coding my own site for the 27th version soon I'll be dealing with this issue on a large scale! :)

wizpl

8:21 pm on Nov 1, 2005 (gmt 0)

10+ Year Member



thanks, that was helpful. I guess that the answer for me is: if you don't need it, there'll be more problems then advantages :)

samuil

9:42 am on Nov 2, 2005 (gmt 0)

10+ Year Member



Well, not really. Switching to XHTML 1.1 won't be useful for you but if you send text/html header your page is not valid (no matter what validator will say - code is okay). XHTML document isn't valid if proper mime-type is not provided. Practical issues for using bad mime-type: Opera works in quirks mode when rendering your page. Problems with serving application/xhtml+xml: ie don't know how to handle this type, and offers saving to disk.
The best way of dealing with those problems is parsing HTTP accept-header. If it contains application/xhtml+xml you should send xhtml page with correct mime-type, in other cases - html 4.0 page with text/html. AFAIK it's the only way to stay compliant with rules and browsers.

pouljensen

2:00 am on Nov 3, 2005 (gmt 0)



No, not really.

[hixie.ch...]

samuil

7:42 pm on Nov 3, 2005 (gmt 0)

10+ Year Member



Well. You're nearly right. Understanding usage of word SHOULD is crucial here.

[w3.org...]
ftp://ftp.rfc-editor.org/in-notes/rfc2119.txt

User agent could badly render XHTML page served as text/html (it's also written in article you have linked to).

Okay. Using word invalid was not good choice - it is valid but it's unrecommended.
Anyway, parsing accept-header is the best way.

wizpl

8:10 pm on Nov 9, 2005 (gmt 0)

10+ Year Member



after reading more on this subject, I came to a conclusion that

XHTML 1.0 Strict served as text/html = HTML 4.01 Strict

so I decided to step down to HTML 4.01 Strict. Changing 35 pages to this format took 5 minutes, just replacing doctype, removing "xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"" from html tag and changing " />" to ">". And here I am back on earth, without the shiny tag of XHTML...

Now, will anyone convince me to spend another 5 minutes converting it back to XHTML? :))

drhowarddrfine

8:19 pm on Nov 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



XHTML 1.0 Strict served as text/html = HTML 4.01 Strict

Yep.

JAB Creations

11:12 pm on Nov 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If drhowarddrfine's post is correct and you should serve
XHTML 1.0 Strict as text/html then I would suggest the following...

We know IE doesn't support XHTML 1.1 (naturally though it will render it fine as text/html to the best of my knowledge) with a little serverside scripting (PHP and maybe ASP?) you can change the mimetype of the file being served based upon the useragent.

wizpl

1:05 am on Nov 10, 2005 (gmt 0)

10+ Year Member



sure it can be done with SSI (which is the cleanest way for me since I use it for other tasks), so should I exclude from "application/xhtml+xml" just IE, or also other browsers will stop working?

Is there a list somewhere?

encyclo

1:46 am on Nov 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For serving XHTML with the MIME type
application/xhtml+xml
you need to have a default of
text/html
and only serve
application/xhtml+xml
to user agents which specifically claim support - otherwise you will be blocking access to your site to a whole host of user agents which don't support
application/xhtml+xml
, bot least Googlebot and other search engine spiders.

I don't believe SSI is powerful enough to do the job, but you can use PHP to read the

HTTP_ACCEPT
string and serve the mime type appropriately.

Some more reading on this topic:

  • XHTML won't validate as strict [webmasterworld.com]
  • XHTML Strict - browser problems [webmasterworld.com]
  •