# 3. 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].

## 3.1. Document Conformance

In this document, the use of the word 'schema' refers to any definition of the syntax of XHTML 2, regardless of the definition language used.

### 3.1.1. Strictly Conforming Documents

A strictly conforming XHTML 2.0 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 B - XHTML 2.0 RELAX NG Definition, Appendix D - XHTML 2.0 Schema and Appendix F - XHTML 2.0 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 2.0 namespace [XMLNS]. The namespace URI for XHTML 2.0 is defined to be `http://www.w3.org/2002/06/xhtml2/`.

   The start tag may also contain an xsi:schemaLocation attribute that associates this namespace with the XML Schema at the URI `http://www.w3.org/MarkUp/SCHEMA/xhtml2.xsd`.

   Sample root element

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

4. There should 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 F using its Public Identifier. The system identifier may be modified appropriately.

       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 2.0//EN"
           "http://www.w3.org/MarkUp/DTD/xhtml2.dtd">

Example of an XHTML 2.0 document

    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/css"
                        href="http://www.w3.org/MarkUp/style/xhtml2.css"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 2.0//EN"
        "http://www.w3.org/MarkUp/DTD/xhtml2.dtd">
    <html xmlns="http://www.w3.org/2002/06/xhtml2/" xml:lang="en"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.w3.org/2002/06/xhtml2/
                              http://www.w3.org/MarkUp/SCHEMA/xhtml2.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.

## 3.2. XHTML 2 User Agent Conformance

A conforming user agent must meet all of the following criteria, as well as other requirements found throughout this specification:

1. The user agent must parse and evaluate an XHTML 2 document for well-formedness. If the user agent claims to be a validating user agent, it must also validate documents against a referenced schema according to [XML].

2. When the user agent claims to support facilities defined within this specification or required by this specification through normative reference, it must do so in ways consistent with the facilities' definition.

3. A user agent must only recognize attributes of type `ID` (e.g., the `id` or `xml:id` attribute on most XHTML 2 elements) as fragment identifiers.

4. If a user agent encounters an element it does not recognize, it must continue to process the content of that element. If this "unrecognized" element uses recognized attributes, those attributes must be processed with their usual semantics.

5. If a user agent encounters an attribute it does not recognize, it must ignore the entire attribute specification (i.e., the attribute and its value).

6. If a user agent encounters an attribute value it doesn't recognize, it must use the default attribute value.

7. When rendering content, user agents that encounter characters or character entity references that are recognized but not renderable should display the document in such a way that it is obvious to the user that normal rendering has not taken place.

8. White space must be handled according to the rules of [XML]. All XHTML 2 elements preserve whitespace.

   The user agent must use the definition from CSS for processing white space characters [CSS3-TEXT].

9. In the absence of a style-sheet, including user agents that do not process style sheets, the default visual presentation should be as if the user agent used the CSS style sheet specified in Appendix H.

Note that this specification does not generally specify the behavior of conforming implementations when presented with non-conforming documents. This is either defined by an underlying specification (e.g., [XML]) or left to the implementor.

## 3.3. Issues

On introducing a fallback attribute PR #7723
State: Open
Resolution: None
User: None

Notes:

[XHTML 2] Conforming documents and meta properties PR #7777
State: Open
Resolution: None
User: None

Notes:

Fw: [XHTML 2] Section 3.1.1 PR #7791
State: Open
Resolution: None
User: None

Notes:

Comments on XHTML 2.0 document conformance requirements PR #7804
State: Open
Resolution: None
User: None

Notes:

Change XHTML 2.0 namespace to http://www.w3.org/1999/xhtml PR #7808
State: Open
Resolution: None
User: None

Notes:

Namespace versioning problem in XHTML 2 PR #7818
State: Open
Resolution: None
User: None

Notes:

Referance XML 1.1 and example with XML 1.1 declaration PR #7819
State: Open
Resolution: None
User: None

Notes: