XML error in Firefox. Trying to render HTML
[email protected] 29 Aug 2006 11:04:00 -0700
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
Hello, I'm trying to work with XML to have it rendered in both IE and
Firefox. The code I found online uses one HTML file, which renders all
XML files fine in IE 6+, but errors out in FF. Here's a sample of my
code, and I'm wondering if anyone can help provide the solution, and
get this working in Firefox!
The Firefox error is:
Error: ActiveXObject is not defined
Source File: functions.js
Line: 42
Thanks in advance!
function RenderDocument( pathToXml, pathToXsl )
{
var xslt = new ActiveXObject("Msxml2.XSLTemplate"); //
Firefox error
var xslDoc = new
ActiveXObject("Msxml2.FreeThreadedDOMDocument");
var xslProc;
// load xsl
xslDoc.async = false;
xslDoc.resolveExternals = false;
xslDoc.load( pathToXsl );
xslt.stylesheet = xslDoc;
// load xml
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
xmlDoc.async = false;
xmlDoc.resolveExternals = false;
xmlDoc.preserveWhiteSpace = true;
xmlDoc.load( pathToXml );
if(xmlDoc.documentElement == null)
{
//alert ("Could not load XML file " +
pathToXml);
location.replace("unknown.html");
}
// processor
xslProc = xslt.createProcessor();
xslProc.input = xmlDoc;
// add params
if(args.sort)
{
xslProc.addParameter("sort", args.sort);
}
xslProc.addParameter("xmlFilePath", pathToXml);
// transform
xslProc.transform();
document.write( xslProc.output );
}