I have a web page that loads up an xml and an xsl page with javascript and displays it. When the user clicks on a link the table is re-sorted according to date or name, etc. I use the same function and everything works fine in IE. With Mozilla I just can't get the page to redisplay. The problem seems to be the way FireFox works with the XML DOM. I use an append child statement to load everything up initially which works great but I just can't get rid of that node down the line.
I've tried doing a replaceNode and a removeChild and then doing appendChild again but nothing seems to work. Here is my code for loading up the xml and xsl. If anyone could take a look or just give me a good reference for working with XML, XSL and FireFox I'd appreciate it greatly.
Thanks,
Dave
Expand|Select|Wrap|Line Numbers
- function init(XSLPage)
- {
- // branch for native XMLHttpRequest object
- if (window.XMLHttpRequest)
- {
- var xmlDoc;
- var testTransform;
- var processor;
- var xslStylesheet;
- var xsltProcessor = new XSLTProcessor();
- // load the xslt file
- var myXMLHTTPRequest = new XMLHttpRequest();
- myXMLHTTPRequest.open("GET", XSLPage, false);
- myXMLHTTPRequest.send(null);
- // get the XML document and import it
- xslStylesheet = myXMLHTTPRequest.responseXML;
- xsltProcessor.importStylesheet(xslStylesheet);
- // load the xml file
- myXMLHTTPRequest = new XMLHttpRequest();
- myXMLHTTPRequest.open("GET", "ReleaseNotesIndex.xml", false);
- myXMLHTTPRequest.send(null);
- var xmlSource = myXMLHTTPRequest.responseXML;
- var resultDocument = xsltProcessor.transformToFragment(xmlSource, document);
- document.getElementById('target').appendChild(resultDocument);
- }
- else if (window.ActiveXObject)
- {
- // load XML source document
- var source = new ActiveXObject("Msxml2.DOMDocument.4.0");
- source.async = false;
- source.load("ReleaseNotesIndex.xml");
- // load XSLT stylesheet document
- var stylesheet = new ActiveXObject("Msxml2.DOMDocument.4.0");
- stylesheet.async = false;
- stylesheet.load(XSLPage);
- // transform the source using the XSLT stylesheet
- target.innerHTML = source.transformNode(stylesheet);
- }