Originally Posted by Toxaris
Please refrain from using Calibre to create ePUB. It is a very good Library program but is not very good in ePUB conversion. It generates a lot of (redundant) code and sometimes breaks fine code creating unexpected results.
It would be better to create your own ePUB from the source documents or with a tool like Sigil. Sigil will also convert your HTML to XHTML.
If you know what you are doing, you can convert with Calibre and then fix up the resulting ePub such that you'd never know Calibre was involved. It's not that hard to do.