Added ability to specify encoding and XHTML output