xhtml compatibility

Fixes #2255