Handle converting `@doc` into a string ourselves

Use `to_html` on every node, UNLESS it has a ‘selected’ attribute. In
that case, use `to_xhtml`.