Jump to content

Browser Problem Ie Vs Safari & Mozilla


palanikumark
 Share

Recommended Posts

This code works fine in IE but mozilla and safari throws error.

<html><head><script src="sarissa.js" type="text/javascript" charset="utf-8"></script><script src="sarissa_ieemu_xpath.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript">function parseXML(){try //Internet Explorer  {  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");  xslDoc=new ActiveXObject("Microsoft.XMLDOM");  ie();  }catch(e)  {  try //Firefox, Mozilla, Opera, etc.  {	setXML();	setXSL();other();  }  catch(e)  {  alert(e.message);  return;  }}}function setXML(){ xmlHttp=new XMLHttpRequest();var url="sample.xml";xmlHttp.onreadystatechange=function() {if (xmlHttp.readyState==4){ xmlDoc=xmlHttp.responseXML;return;}}xmlHttp.open("GET",url,true);xmlHttp.send(null);}function setXSL(){ xmlHttp1=new XMLHttpRequest();var url="sample.xsl";xmlHttp1.onreadystatechange=function() {if (xmlHttp1.readyState==4){ xslDoc=xmlHttp1.responseXML;return;}}xmlHttp1.open("GET",url,true);xmlHttp1.send(null);}//document.write(xmlDoc.transformNode(xsl));function ie(){xmlDoc = Sarissa.getDomDocument();xmlDoc.async = false;xmlDoc.load("sample.xml");	// get the stylesheet document	xslDoc = Sarissa.getDomDocument();	xslDoc.async = false;	xslDoc.load("sample.xsl");	// instantiate the result document	var oResult = Sarissa.getDomDocument();	// transform and store the results to oResult	xmlDoc.transformNodeToObject(xslDoc, oResult);	// transform and store the results to a string sResult	var sResult = xmlDoc.transformNode(xslDoc);	//alert(sResult);	document.write(sResult);	}	function other(){	  var xmlDoc = Sarissa.getDomDocument();	// get the stylesheet document	var xslDoc = Sarissa.getDomDocument();	// instantiate the result document	var oResult = Sarissa.getDomDocument();	// transform and store the results to oResult	xmlDoc.transformNodeToObject(xslDoc, oResult);	// transform and store the results to a string sResult	var sResult = xmlDoc.transformNode(xslDoc);	document.write(sResult);	}</script></head><body onload="parseXML()"><h1>Sorting</h1></body></html>

Here is the xml file http://www.w3schools.com/xsl/cdcatalog.xml and xsl here http://www.w3schools.com/xsl/xsl_sort.asp

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...