473,387 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

XSL transformation with Javascript in Mozilla browser

Hello,

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
  1. function init(XSLPage)
  2.     {
  3.  
  4.         // branch for native XMLHttpRequest object
  5.         if (window.XMLHttpRequest)
  6.         {
  7.  
  8.             var xmlDoc;
  9.  
  10.             var testTransform;
  11.  
  12.             var processor;
  13.  
  14.             var xslStylesheet;
  15.             var xsltProcessor = new XSLTProcessor();
  16.  
  17.             // load the xslt file
  18.             var myXMLHTTPRequest = new XMLHttpRequest();
  19.             myXMLHTTPRequest.open("GET", XSLPage, false);
  20.             myXMLHTTPRequest.send(null);
  21.  
  22.             // get the XML document and import it
  23.             xslStylesheet = myXMLHTTPRequest.responseXML;
  24.             xsltProcessor.importStylesheet(xslStylesheet);
  25.  
  26.             // load the xml file
  27.             myXMLHTTPRequest = new XMLHttpRequest();
  28.             myXMLHTTPRequest.open("GET", "ReleaseNotesIndex.xml", false);
  29.             myXMLHTTPRequest.send(null);
  30.  
  31.             var xmlSource = myXMLHTTPRequest.responseXML;
  32.  
  33.             var resultDocument = xsltProcessor.transformToFragment(xmlSource, document);
  34.  
  35.             document.getElementById('target').appendChild(resultDocument);
  36.  
  37.         }
  38.         else if (window.ActiveXObject)
  39.         {
  40.             // load XML source document
  41.             var source = new ActiveXObject("Msxml2.DOMDocument.4.0");
  42.             source.async = false;
  43.             source.load("ReleaseNotesIndex.xml");
  44.  
  45.             // load XSLT stylesheet document
  46.             var stylesheet = new ActiveXObject("Msxml2.DOMDocument.4.0");
  47.             stylesheet.async = false;
  48.             stylesheet.load(XSLPage);
  49.  
  50.             // transform the source using the XSLT stylesheet
  51.             target.innerHTML = source.transformNode(stylesheet);
  52.  
  53.         }
May 10 '06 #1
1 5114
acoder
16,027 Expert Mod 8TB
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.
Here you go: http://developer.mozilla.org/en/docs/XSLTProcessor.
Apr 24 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: abhimanyu singh | last post by:
i m facing a serious probs now a days............ its seems easy but for me i found it difficult......... i want to do transformation usig xsl and xml(adding parameter). for IE its working fine...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.