Xml fixes

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