XSLT in Firefox and IE6.0
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
I was trying to get my xsl file to work in Firefox, which I did, but
now it seems it doesn't work at all in IE6.0. I thought 6.0 used the
same standard as Firefox?
below is the js used to load the page:
<script type="text/javascript">
var isIE;
var isNav;
isIE = (navigator.appName == "Microsoft Internet Explorer");
isNav = (navigator.appName == "Netscape");
if (isIE)
{
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("StatsReport_allstats.xml")
// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("NodeStats2.xsl")
// Transform
document.write(xml.transformNode(xsl))
}
if (isNav)
{
//for mozilla/netscape
var processor = new XSLTProcessor();
var xslt = document.implementation.createDocument("", "", null);
xslt.async = false;
xslt.load("NodeStats2.xsl");
processor.importStylesheet(xslt);
var src_doc = document.implementation.createDocument("","", null);
src_doc.async = false;
src_doc.load("StatsReport_allstats.xml");
var result = processor.transformToDocument(src_doc);
var xmls = new XMLSerializer();
var output = xmls.serializeToString(result);
document.write(output);
alert("done");
}
</script>
I stuck a few alerts into the IE code, so I know the transform is
what's failing.
This is my stylesheet tag in my xsl:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns1="schema:StatsReportSchema.xml">
6.0 sp2 would load fine with the working draft:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">
To have this work in both IE and Firefox do I have to duplicate my code
for both versions of xsl (that would be the only workaround I can think
of)? It still seems like really this ought to work for both, if they
both support the same versions. Do I need an IE update? Or is there
no way to have the same xsl stuff work for both and I really do just
need to duplicate everything for both browsers?