XHTML 1.1 - Conformance Definition

# 2. Conformance Definition

Contents

This section is normative.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

## 2.1. Document Conformance

This version of XHTML provides a definition of strictly conforming XHTML documents, which are restricted to elements and attributes from the XHTML namespace.

### 2.1.1. Strictly Conforming Documents

A strictly conforming XHTML 1.1 document is a document that requires only the facilities described as mandatory in this specification. Such a document MUST meet all the following criteria:

1. The document MUST conform to the constraints expressed in the schemas in Appendix D - XHTML 1.1 Schema and Appendix C - XHTML 1.1 Document Type Definition.

2. The local part of the root element of the document MUST be `html`.

3. The start tag of the root element of the document MUST explicitly contain an `xmlns` declaration for the XHTML namespace [XMLNAMES]. The namespace URI for XHTML is defined to be `http://www.w3.org/1999/xhtml`.

   The start tag MAY also contain the declaration of the XML Schema Instance Namespace and an XML Schema Instance `schemaLocation` attribute [XMLSCHEMA]. Such an attribute would associate the XHTML namespace `http://www.w3.org/1999/xhtml` with the XML Schema at the URI `http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd`.

   Sample root element

       <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.w3.org/1999/xhtml
                                 http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"
       >

4. There MUST be a DOCTYPE declaration in the document prior to the root element. If present, the PUBLIC identifier included in the DOCTYPE declaration MUST reference the DTD found in Appendix A using its Formal Public Identifier. The SYSTEM identifier MAY be modified as appropriate.

       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
           "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

5. The start tag MAY also contain a `version` attribute that declares the version of XHTML in use. The version of this version of XHTML is `-//W3C//DTD XHTML 1.1//EN`.

Example of an XHTML 1.1 document

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html version="-//W3C//DTD XHTML 1.1//EN"
          xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.w3.org/1999/xhtml
                              http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"
    >
      <head>
        <title>Virtual Library</title>
      </head>
      <body>
        <p>Moved to <a href="http://example.org/">example.org</a>.</p>
      </body>
    </html>

Note that in this example, the XML declaration is included. An XML declaration like the one above is not required in all XML documents. XHTML document authors SHOULD use XML declarations in all their documents. XHTML document authors MUST use an XML declaration when the character encoding of the document is other than the default UTF-8 or UTF-16 and no encoding is specified by a higher-level protocol.

XHTML 1.1 documents SHOULD be labeled with the Internet Media Type "application/xhtml+xml" as defined in [RFC3236]. For further information on using media types with XHTML, see the informative note [XHTMLMIME].

## 2.2. User Agent Conformance

A conforming user agent MUST meet all user agent conformance requirements defined in [XHTMLMOD].