Using IE 9.0 RC and attempting to translate XSL/XML (XSLT) fragment via javascript and innerHTML, but failing.
Using a known XSL and XML file combination which works in W3C – Safari, Firefox, Opera, Chrome, K-Melon etc etc. ActiveXOject – IE6.0, IE7.0, IE8.0
Using a Javascript onclick call to ‘load’ and translate XSLT via ActiveXObject (Microsoft) or DOM transformToFragment (W3C)
IE 9.0 still uses ActiveXObject to parse XSLT and has not moved to W3C in this area.
IE 9.0 RC has the option of using a HTTP mime Content-Type of application/xhtml+xml, which is great for XHTML strict.
[COLOR=”DarkRed”][B]HOWEVER,
[CODE]
// [ActiveXObject component for Microsoft]
var xslt = new ActiveXObject(“Msxml2.XSLTemplate”);
var xmlDoc = new ActiveXObject(“Msxml2.DOMDocument”);
var xslDoc = new ActiveXObject(“Msxml2.FreeThreadedDOMDocument”);
xmlDoc.load(“/xml/xmlDocument.xml”);
xslDoc.load(“/xsl/xslDocument.xsl”);
xslt.stylesheet = xslDoc;
var xslProc = xslt.createProcessor();
xslProc.input = xmlDoc;
xslProc.transform();
frag.innerHTML = xslProc.output;
If one reverts back to a HTTP mime Content-Type of text/html in the calling HTML document using IE 9.0 RC, the javascript innerHTML is fine and the XSLT fragment is parsed without problems.
Now the question. Is there a way to use innerHTML in IE 9.0 RC when the originating/calling HTML document has a Content-Type of application/xhtml+xml?
My XSL document has the follow output statement. I have tried XSL output method=”xml”, however this still produces the same innerHTML parsing error in Javascript using IE9.0 RC.
[CODE]<xsl:output method=”html”
media-type=”text/html”
doctype-public=”-//W3C//DTD XHTML 1.0 Strict//EN”
doctype-system=”http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”
cdata-section-elements=”style”
indent=”yes”
encoding=”UTF-8″ />
Parsing the XSL document with a Content-Type header of application/xhtml+xml using PHP works fine to generate an XHTML document in IE 9.0 RC using the following output statement:
[CODE]<xsl:output method=”xml”
media-type=”text/html”
doctype-public=”-//W3C//DTD XHTML 1.0 Strict//EN”
doctype-system=”http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”
cdata-section-elements=”style”
indent=”yes”
encoding=”UTF-8″ />
This is XSL/XML translatation and not Javascript(XSLT), which is where I’m having problems.
The problem I’m having is XSLT within Javascript when adding a fragment to an object using innerHTML in IE 9.0 RC.
If I manually enter the fragement into innerHTML using IE9.0 RC WITHOUT the xml and !DOCTYPE statements in the parsed ‘XHTML’, then innerHTML in IE 9.0 RC works fine.
[B]The problem as I see it is that IE9.0 RC can not pasre innerHTML when calling Javascript from an application/xhtml+xml HTML source document when the XMLResponce fragment is of an XHTML structure.
I know IE 9.0 is not released yet, but being a Release Client and having this problem means it’ll probably be a problem in IE 9.0 when it is released.
Anybody had this problem or have a workaround for it?
I can ‘trim’ the xml document statements out of the fragment and then add it to the object via innerHTML, but that’s like the old days were every IE version has to have a workaround.