LT-14451 Make xhtml output use valid CSS classes

In particular, the use of # in class names for custom views was
causing Firefox (at least) not to see the style definitions.

I've tried to test the more important paths through the new code,
but covering them all would be a large project, since there appear
to be no existing tests of this export. And the most likely mistake
I've made is not in the changed code at all, but missing somewhere
the new call should be made. Another reason not to put a lot of time
into making tests for this code is that we hope to replace it soon.

Change-Id: Ic04223d82ae7e42f560984edabc7dd69d502d7a6