SIA-R6<html> document elements have matching lang and xml:lang attributes

Accessibility requirements

This rule tests conformance of the following accessibility requirements:


This rule checks that for document elements with both a lang and xml:lang attribute, the primary language subtags of the attributes match.


This rule applies to every document element if it is an <html> element in the HTML namespace that:


  1. The primary language subtags, if any exist, of the lang and xml:lang attributes are equal.

    HTML requires that the lang and xml:lang attributes match exactly. There is however no known accessibility issue of having mismatching extended language subtags, hence this is permitted by this rule.


This rule makes the following assumption:

  • The lang attribute is being used to conform to WCAG. As such, this rule doesn't test if the attribute is needed to conform to WCAG.

Accessibility support

This rule has the following accessibility support concerns:



This <html> element has matching lang and xml:lang attributes:

<html lang="en" xml:lang="en"></html>

This <html> element has both a lang and xml:lang attribute with matching primary language subtags. This rule does not check the extended language subtags, nor the validity of the values.

<html lang="en-GB" xml:lang="en-XYZ"></html>


This <html> element has non-matching primary language subtags for the lang and xml:lang attributes:

<html lang="en" xml:lang="fr"></html>


This <html> element has a lang attribute that is only ASCII whitespace, hence has no valid primary language subtag. The rule does therefore not apply:

<html lang=" " xml:lang="en"></html>

This rule only checks <html> elements, hence this element is not applicable:

<svg xmlns="" lang="en" xml:lang="en"></svg>


This document includes material copied from or derived from Copyright © 2021 W3C® (MIT, ERCIM, Keio, Beihang).