12
votes

Is there a W3C document type available with both XHTML 1.0 transitional support and RDFa support?

I am aware of the XHTML+RDFa 1.0 (http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd) DTD but that is XHTML 1.1 which is not compatible with my current website. It seems that there is also a HTML4+RDFa 1.0 (http://www.w3.org/MarkUp/DTD/html4-rdfa-1.dtd) DTD available.

My main reason for not serving XHTML 1.1 is Internet Explorer ofcourse, although I could probably serve it as text/html for the IE users if there is no other way.

2

2 Answers

10
votes

I don't believe there is such a DTD, no.

HTML is becoming more and more fragmented and creating DTDs for every possible combination is not going to be practical. HTML5 is not SGML based and effectively gives up on DTDs. In future, validators are probably going to have to change so that they call in component collections like RDFa and ARIA, and indicate in their results which collections are required to allow each particular piece of mark-up to be conforming.

Unfortunately, we're really at about the transition point currently, so there's no clean solution to your problem. However, a certain amount of pragmatism will get you a long way.

Now, XHTML+RDFa 1.0 may be defined by DTD as an extension of XHTML 1.1, but it isn't actually XHTML 1.1, nor is it XHTML 1.0 transitional or strict, or indeed anything other than "XHTML+RDFa 1.0".

So you can take a pragmatic serving approach. Consider the HTML5 attitude to this. It says that anything you serve as text/html is an HTML serialization of the object model, regardless of any DOCTYPE that you declare. This is in practice what browsers do anyway.

Similarly, anything you serve with an XML content type such as application/xhtml+xml is an XML serialization. Those parts of the XML that have the xhtml namespace constitute XHTML.

So, in practice, you can serve your XHTML+RDFa 1.0 as text/html or application/xhtml+xml without any difficulty, provided that the mark-up meets the requirements for polyglot documents.

That leaves the validation. Leaving aside RDFa, is there any mark-up that you're using that's conformant XHTML 1.0 Transitional but not conformant XHTML 1.1? If so, do you care enough about perfect validation to either change these, or to back away from using RDFa? Presumably you're using RDFa for your users benefit, while validation is essentially a convenience tool for yourself.

I faced a similar situation recently, when I decided to add ARIA attributes to my XHTML 1.0 pages. I decided that Accessibility trumps Validity, and I would add the attributes and forget about ensuring my pages were 100% valid.

1
votes

In reality unless you are concerned with the DTD implementation there are almost no differences between the various XHTML versions and there's almost never a valid reason not to use XHTML 1.1. In what way is your website dependent upon 1.0 transitional? If you can get your site valid with 1.0 strict then moving from that to 1.1 shouldn't cause problems because essentially the only difference is the modularized DTD, which really has no drawbacks to it.

If you're still struggling with the philosophical problem of XHTML MIME I wouldn't worry because conceptually serving the wrong media type with the better organized 1.1 DTD is no more of a crime than with 1.0. The reason RDFa is implemented as it is is because adding the RDFa module to the XHTML 1.1 DTD only involves adding a few lines to the main module. Doing that to the 1.0 DTD would be harder and not as clean.

Some other things to consider are that the XHTML 1.1 second edition spec includes an XML schema implementation. Also, the latest XHTML+RDFa 1.1 working draft finally drops the (stupid) requirement for specifying a doctype altogether, so you could use schema-only validation. This would work out really well if you can figure out a way to use XML/XHTML mimetypes because no doctype declaration is required in order to get standards mode rendering on browsers which support it (all of them but IE8 and below).