3. Conformance Definition


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. Conforming Documents

A 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 prose throughout this document, and also to the machine-checkable constraints expressed in the schema in Appendix B - XHTML 2.0 RELAX NG 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 [XMLNS]. The namespace URI for XHTML is defined to be http://www.w3.org/1999/xhtml.

    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="<xmlns>" xml:lang="en"
  4. There MAY 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"

Example of an XHTML 2.0 document

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="<xmlns />" xml:lang="en">
    <title>Virtual Library</title>
    <p>Moved to <a href="http://example.org/">example.org</a>.</p>

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.