What we should opt ? XHTML or HTML 5 ?
These links should help:
http://wiki.whatwg.org/wiki/HTML_vs._XHTML
http://stackoverflow.com/questions/256953/html-5-versus-xhtml-1-0-transitional
If you've already written your website, then don't bother changing it. If you haven't written it already, then just use HTML5 (DOCTYPE html). The main difference is that you get additional features with HTML5 (although you don't necessarily need to use them), while XHTML forces you to format your HTML in an XML-compatible way (although you can format your HTML5 code in an XML-compatible manner, also). It is a common misperception that using an XHTML doctype and adding an XML declaration to your XHTML code (e.g. <?xml version="1.0" encoding="utf-8"?>
) is sufficient to make it XHTML. In fact, this is not the case... it will only be interpreted as XHTML if it is returned using the appropriate content-type.
Advantages to HTML5
- More features (canvas, localstore, etc.)
- More lenient (doesn't have to be 100% XML)
- Predictable failure (behaves in well-defined ways when improperly formatted)
Advantages to XHTML
- More strict (forces you to use 100% XML)
Disadvantages to XHTML
- Fewer features
- More strict (if it's not 100% XML, it will break)
- May not actually be XHTML (if you forgot to use the correct content-type)
XML strictness
The only advantage I can think of for XHTML is that it forces you to make the document fully XML-compatible. However, you can still make HTML5 100% XML-compatible, it just doesn't force you to do that. If you want to be stringent with yourself, just run it through an XML parser/validator yourself, and you can get the same level of stringency while at the same time using HTML5.
The question presents a false dichotomy. HTML5 will have both HTML and XML (XHTML) serializations. So there are really two questions: HTML4 vs HTML5 and XHTML vs HTML. Additionally, XHTML can be served with the text/html mime type, where it mostly behaves like HTML.
For the first question, HTML5 isn't complete yet, but you may be able to use some features now. Use whatever constructs are supported in enough of your targeted browsers to be worthwhile and use graceful degradation/ progressive enhancement to support the rest.
For the second question, I prefer HTML to XHTML and I explain my reasoning here. For the actual differences, I would refer to the link SaC provided for the differences in version 5 and this document for the difference between HTML4/XHTML1.0.