Web Accessibility Web Usability

Unusable and inaccessible pure XML documents

Diperbarui 30 Agustus 2010 oleh Dani Iswara

Pure (X)HTML documents served as application/xhtml+xml are not fully usable nor accessible. Especially for old and nonstandard user agents/Web browsers and assistive technology. The problem is lang (language) attribute.

Semantic meaning

Language attribute has semantic meaning. You may check my old posts (most of them are in bahasa Indonesia) in Dani Iswara .com:

Foreign languages texts/content should be marked-up using, such as:

  • xml-lang="id" ("id" refer to Indonesian) if a document is served as pure XML.
  • lang="id" if a document is served as text/html.

Doctype switching and language attribute

One document may serve as bilingual with the help of lang declaration in doctype. The other solution is using lang attribute in the content itself, especially for terms in foreign languages.

There is a well-known technique called doctype switching or server negotiation. Similar to mobile version detection of Web pages. In server level, Web pages may sent as application/xhtml+xml to the capable user agents, and as text/html to the other and old user agents (e.g. Internet Explorer).

But, doctype switching is not working as easy as it could be for bilingual documents. The reason is, it is impossible to use xml-lang="id" and lang="id" in the same time for different languages in different type of documents. This markup, xml-lang="id", can be suitable for modern user agents with XML rendering capability. But not for old user agents.

Bilingual content using doctype switching is not usable for Web authors and not accessible for aural agent users. Better to have a different page version of bilingual content. Or stick with one language or one content type. If using only one content type, lang or xml-lang attribute can be used properly.

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

Situs ini menggunakan Akismet untuk mengurangi spam. Pelajari bagaimana data komentar Anda diproses.