Forum Moderators: open

Message Too Old, No Replies

XHTML strict site needs to take a step back

         

Asia_Expat

2:00 pm on Mar 9, 2008 (gmt 0)

10+ Year Member



A few years ago I had very limited programming skills. I chose a template that was written in XHTML 1.1 and I really had no idea about the significance of that... it just looked right and did what I needed it to do.
Over the years, I have customised it, tweaked it, bent it, forced it... eventually, I started naming pages yaddayadda.xhtml and use a php include to serve text/html to IE6 etc.
Over time, it's become clear to me that I will probably never be able to serve the correct MIME type because for one thing, every page has a forum feed and as soon as someone posts with an '&' the whole site would break.

I think I need to reverse this decision to go with XHTML and I'm not sure the best way to approach this. Would it be as simple as changing the declaration to XHTML 1.0 and safely serving text/html forever? If so, would it be OK to continue with the .xhtml extensions?

Rewriting the whole site into html would be a total nightmare. I need some suggestions as to the best course of action... thanks.

[edited by: Asia_Expat at 2:01 pm (utc) on Mar. 9, 2008]

cmarshall

2:29 pm on Mar 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I used to use XHTML 1.1 served application/xhtml+xml (if the accept indicated it would work). It did send a couple of older browsers into Quirks Mode.

For a lot of reasons (stated on this site, actually, but I'm too ADD to go looking for them), it was explained that it's not actually that useful. As you pointed out, it needs to be served correctly. I haven't had much problem with it, and actually like the fact that bad code served as application/xhtml+xml would result in a browser barf. Forces me to write good code.

What I do these days is use XHTML 1.0 Strict served as text/html. It is every bit as anal as XHTML 1.1, but no browser I've ever tested against has had a problem with it being served as text/html. I know, I know, the theory says don't do that, but the facts on the ground knock the theory into a cocked hat.

I use XHTML, because I like being able to validate at 30,000 feet with <oXygen/>, and I like writing code that is cleaner than it needs to be.

Some people go all nuts about the evils of XHTML, just as some people go nuts over the evils of <table> elements and AJAX. It's absolutely amazing how many words they'll dump into a diatribe against it.

I've found that there is never a "One, True Way." We use whatever tools we need to accomplish a given task, and getting hung up at the Kool-Aid barrel has its drawbacks.

In any case, HTML 5 will have two variants: XML and Non-XML. There's nothing wrong at all with non-XML (HTML 4.01 Strict and HTML 5); just as there is nothing wrong with using XHTML 1.0 Strict. It's really a matter of personal style. I've yet to encounter a browser that has a problem with it; and I test the living daylights out of my sites.

Just my $0.02.