It should be added a tag to create the tag according if it's for XHTML or not. This would be for XHTML:
<html xmlns="http://www.w3.org/1999/xhtml"
dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}"
xml:lang="{{ LANGUAGE_CODE }}" lang="{{ LANGUAGE_CODE }}">