XSLTProcessor in Edge browser inserts xmlns="http://www.w3.org/1999/xhtml" in XML document on elements <form>, <table> and <button> even though default namespace of XML document is not XHTML.
Javascript:
var processor = new XSLTProcessor()
processor.importStylesheet(xsl);
var el = processor.transformToDocument(xml);
Both 'xsl' and 'xml' objects are XML documents loaded via XMLHTTPRequest.responseXML.
XML passed into transformation:
<dataset>
<form>
<group>
<button></button>
</group>
</form>
</dataset>
XML returned from transformation as 'el':
<dataset>
<form xmlns="http://www.w3.org/1999/xhtml">
<group xmlns="">
<button xmlns="http://www.w3.org/1999/xhtml"></button>
</group>
</form>
</dataset>
XSL:
<?xml version='1.0'?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:template match="@* | * | comment()" priority="-2">
<xsl:copy>
<xsl:apply-templates select="@* | * | text() | comment()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Subsequent transformations on this XML fail as these nodes have an incorrect namespace.
This transformation logic works correctly in Internet Explorer, and Firefox and Chrome.