As recommended by W3C following steps can be followed for migration of HTML to XHTML (XHTML 1.0 documents):
Include xml:lang and lang attributes on elements assigning language.
Use empty-element syntax on elements specified as empty in HTML.
Include an extra space in empty-element tags:
Include close tags for elements that can have content but are empty:
Do not include XML declaration.
Carefully following W3C’s guidelines on compatibility, a user agent (web browser) should be able to interpret documents with equal ease as HTML or XHTML.
To understand the subtle differences between HTML and XHTML, consider the transformation of a valid and well-formed XHTML 1.0 document into a valid HTML 4.01 document. To make this translation requires the following steps:
The language for an element should be specified with a lang attribute rather than the XHTML xml:lang attribute. XHTML uses XML’s built in language-defining functionality attribute.
Remove the XML namespace (xmlns=URI). HTML has no facilities for namespaces.
Change the document type declaration from XHTML 1.0 to HTML 4.01.
If present, remove the XML declaration. (Typically this is: <?xml version="1.0" encoding="utf-8"?>).
Ensure that the document’s MIME type is set to text/html. For both HTML and XHTML, this comes from the HTTP Content-Type header sent by the server.
Change the XML empty-element syntax to an HTML style empty element (
to
).