Xml fixes

Fixes enough XML stuff to get HTML and TXT generation working again.