Maybe I should have a tag for “boring technical notes that I’m writing so others can Google them later”.
Anyway… if you’re converting a Docbook document to HTML, and want customized classes on elements (so you can hit them with CSS), first create a custom XSL style for the document (and use with xmlto -m).
Then suppose you have <code language="html"> in the Docbook and want that to have classes html and xml to hold on to in the resulting HTML. Add this:
<xsl:template match="code[@language = 'html']" mode="class.value">
html xml
</xsl:template>
The match can be any XSL matching pattern. The contents can also be a <xsl:value-of> if you want to do something more advanced.
Maybe it’s because I’m an XSL newb, but I haven’t seen this explained nicely anywhere else.