As XslTransform is now obsolete, I now use XslCompiledTransform to transform my XML and XSLT documents. When transforming I want an XmlDocument returned so that I can further manipulate the output, to achieve this I use XMLWriter but for some unknown and baffling reason XMLWriter does not respect the ouput method of the XSL document and will ALWAYS give you XML and by XML I mean closing self closing tags etc. which is no good when you’re outputting HTML with textarea, link and script elements. I hate to do it but the only way to be confident of correct output was to parse the output string and replace these elements using a beefy regular expression. Does anyone else know how to force XHTML or even HTML output when using XMLWriter and XslCompiledTransform. I’ve given up looking.