Welcome to our free XML tutorial. This tutorial is based on Webucator's Introduction to XML Training course.

Contact Us or call 1-877-932-8228

What is XHTML

XHTML is the XML version of HTML. The major benefits of XHTML over HTML are:

  • Non-HTML aware user agents can read XHTML documents.
  • XHTML documents can easily be transformed into other document types with XSLT or other languages.


XHTML documents differ from HTML documents in the following ways.

  • Documents must be well-formed according to XML syntax rules.
  • Element and attribute names must be in lowercase letters.
  • Container elements must have end tags. For example, list items must be closed with a </li> tag.
  • Attribute values must be in single or double quotes.
  • Attributes may not be minimized. Attributes that have no defined value should use the attribute name for their value.
    <select name='flavor' multiple>
    <select name='flavor' multiple='multiple'>
  • Empty elements must be closed, either with a standard end tag or a shortcut close.
    <!--Also Valid-->
  • Script and Style elements contain PCDATA, meaning that they will be parsed as XML. Because these elements often contain special XML characters such as < and &, this can cause problems. To be safe, the content of script and style elements should be wrapped in CDATA sections as shown below.
    <script type="text/javascript">
    		//script content

For additional information on the differences between XHTML and HTML, see http://www.w3.org/TR/xhtml1/#diffs.


This tutorial is based on Webucator's Introduction to XML Training Course. We also offer many other XML Training courses. Sign up today to get help from a live instructor.