server-side version of dombuilder that generates HTML