Note that the HTML and XHTML export are handled by different code paths. But this meta bug is apparently for both?
For instance bug #146264 is about XHTML export. (But as such, the sample document there exports incorrectly to HTML, too, but incorrectly in a different way.)