Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

XSL Transforms - IE5.X

I'm trying to do XSL transforms in IE5.x and get the error where the
Microsoft.XMLDOM object returns the XSL in the transform. (using the 1999
Namespace).

I have opted to go for the following solution listed below. Hopefully,
this will work. If it fails, then an install of any msxml parser should
work,
no matter if in replace or side by side mode.

I will use this as an include file and thus I will only ever need to change
it
in one place if I need to try and cater for future versions etc.

Any thoughts on this ? good idea ? bad idea ?

<script language="JavaScript">

function GetXMLObject() {

var XMLDoc = "<?xml version=\"1.0\"?><IMR>XML</IMR>";
var domDoc;

try{
domDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
domDoc.async=false;
if (domDoc.loadXML(XMLDoc))
return (domDoc);
}
catch (e){
}

try{
domDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
domDoc.async=false;
if (domDoc.loadXML(XMLDoc))
return (domDoc);
}
catch (e){
}

try{
domDoc = new ActiveXObject("Msxml2.DOMDocument.2.6");
domDoc.async=false;
if (domDoc.loadXML(XMLDoc))
return (domDoc);
}
catch (e){
}

try {
domDoc = new ActiveXObject("Msxml2.DOMDocument");
domDoc.async=false;
if (domDoc.loadXML(XMLDoc))
return (domDoc);
}
catch (e){
}

try {
domDoc = new ActiveXObject("Microsoft.XMLDOM");
domDoc.async=false;
if (domDoc.loadXML(XMLDoc))
return (domDoc);
}
catch (e){
}
}
</script>
[1675 byte] By [Murray Foxcroft] at [2007-11-9 15:23:20]