WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Language declaration when using XHTML+RDFa 1.0

for

From: Jukka K. Korpela
Date: Jul 31, 2013 12:05AM


2013-07-31 2:08, Steve Green wrote:

> One of our clients has asked us to test a website where the doctype
> is XHTML+RDFa 1.0. There was no language declaration in the <html>
> element but the W3C online HTML validator does not permit the
> lang="en" attribute that we would usually use.

XHTML+RDFa 1.0 does not allow the lang attribute, and the validator just
reports this.

> I have tried to understand the XHTML+RDFa 1.0 specification but it's
> heavy going.

It is based on XHTML 1.1, with element-level metadata features as per
RDFa added into it.

> The validator does allow xml:lang="en", so is this
> sufficient or do we need something more?

The lang attribute might be somewhat more widely recognized then
xml:lang, by relevant software. This is at least the idea behind the
XHTML 1.0 rule that allows both to be used.

XHTML 1.1 is largely a theoretical exercise: developed from XHTML 1.0
Strict (which in turn is little more/less than HTML 4.01 Strict in XML
clothes) by describing it in terms of XHTML modularization, with some
poorly documented changed.

XHTML+RDDa 1.0 removed the lang attribute. It was taken back in
XHTML+RDFa 1.1, which exists as W3C Recommendation:
http://www.w3.org/TR/2012/REC-xhtml-rdfa-20120607/
and as "W3C Proposed Edited Recommendation":
http://www.w3.org/TR/xhtml-rdfa/

So using an XHTML+RDFa 1.1 doctype you could use xml:lang="en"
lang="en", as in XHTML 1.0.

Using the lang attribute with the XHTML+RDFa 1.0 doctype is formally
invalid but does not really hurt anyone. Browsers couldn't care less.
Even when processing an XHTML document as truly XHTML (by XML rules),
when served with an XML media type, they reject the document on the
basis of well-formedness errors only, not on the grounds of using an
attribute not allowed by the document type definition.

> I think this is the first website we have tested in more than 10
> years that has this doctype. Is it common and why would anyone use
> it?

It is not used much, and there is little if any reason to use it. It's
the kind of thing that some people take into use as they wanted to
comply with the "latest version" of something at some time.

Yucca