Minimal XHTML 1.0 Document Tests

Introduction

This is a small collection of XHTML tests I have written to test how browsers treat minimal XHTML 1.0 documents.

Table of Contents

  1. Example from XHTML 1.0
  2. Example from XHTML 1.0 made self-contained
  3. Valid variants
  4. Combinations of variants as tests
    1. text/html without xml prolog
    2. text/xml without xml prolog
    3. text/html with xml prolog
    4. text/xml with xml prolog
  5. Local file testing
  6. Expected results

Example from XHTML 1.0

XHTML 1.0 has an example of a minimal XHTML 1.0 document. Here is that same document with only a few minor title and paragraph content changes: (posted here: Minimal XHTML 1.0 Document)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>Minimal XHTML 1.0 Document</title>
  </head>
  <body>
    <p>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a> 
    document.</p>
  </body>
</html>

Example from XHTML 1.0 made self-contained

This example cannot work "as-is" with validating processors due to the partial DOCTYPE reference. Or, rather, this example depends upon the server having the XHTML 1.0 Strict DTD (xhtml1-strict.dtd) available in a "DTD" directory which is in the same directory as the document itself. Due to this dependency, this example is less than minimal in this respect, in that it is not self-contained. Here is a self-contained version of this example which points to the W3C XHTML1 Strict DTD: (posted here: Minimal XHTML 1.0 Document with W3C DTD)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>Minimal XHTML 1.0 Document with W3C DTD</title>
  </head>
  <body>
    <p>This is a minimal <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a> 
    document with a W3C url for the DTD.</p>
  </body>
</html>

Valid variants

There are a few valid variants of this example that should also be tested:

Combinations of variants as tests

Here are all four possible combinations of the abovementioned two variants, from "most html-like" to "most xml-like". (The assumption is that the prolog is "closer" to the document than the mime-type and therefore may have greater impact upon how the browser decides to treat the document.)

  1. text/html without ?xml prolog: xhtmlwithoutprolog.html (note: valid XHTML 1.0 Strict)
  2. text/xml without ?xml prolog: xhtmlwithoutprolog.xml (note: valid XHTML 1.0 Strict)
  3. text/html with ?xml prolog: xhtmlwithprolog.html (note: valid XHTML 1.0 Strict)
  4. text/xml with ?xml prolog: xhtmlwithprolog.xml (note: valid XHTML 1.0 Strict)

Local file testing

Try downloading (using the given file names) the above four tests (1-4) to your client machine and viewing them locally in your browser. See if it treats local files differently from those that it receives from the web.

Expected results

All four test documents are valid XHTML 1.0 strict documents, and therefore should be handled as XHTML - not as plain XML. Each document has little bit of text, and one hyperlink to the XHTML 1.0 specification. The hyperlink should be functional and rendered in the browser's default style for HTML hyperlinks. Here is what each document should have looked like (margins chosen to match popular browser conventions - actual styling may vary):

  1. text/html without ?xml prolog:

    This is a minimal XHTML 1.0 document without ?xml prolog served as text/html.

  2. text/xml without ?xml prolog:

    This is a minimal XHTML 1.0 document without ?xml prolog served as text/xml.

  3. text/html with ?xml prolog:

    This is a minimal XHTML 1.0 document with ?xml prolog served as text/html.

  4. text/xml with ?xml prolog:

    This is a minimal XHTML 1.0 document with ?xml prolog served as text/xml.

Last updated by Tantek Çelik 20010723. Valid HTML 4.0 Strict! Valid CSS!