[xsl] client side XSL using javascript in Mozilla

Subject: [xsl] client side XSL using javascript in Mozilla
From: Marc Trudel <marctrudel@xxxxxxxxx>
Date: Wed, 30 Aug 2006 18:13:24 -0700 (PDT)
Hi, I am trying to attach an xsl sheet to xml using
javascript in and html page. I am able to get it to
work in IE using Microsoft.XMLDOM but I can not get it
to work in Mozila browsers using the following script.

<html>

<script type="text/javascript">

var xslStylesheet;
var xsltProcessor = new XSLTProcessor();
var myDOM;

var xmlDoc;

function Init(){
	document.write("in here");
  // load the xslt file, example1.xsl
  var myXMLHTTPRequest = new XMLHttpRequest();
  myXMLHTTPRequest.open("GET", "oddset7.xsl", false);
  myXMLHTTPRequest.send(null);

  xslStylesheet = myXMLHTTPRequest.responseXML;
  xsltProcessor.importStylesheet(xslStylesheet);

  // load the xml file, example1.xml
  myXMLHTTPRequest = new XMLHttpRequest();
  myXMLHTTPRequest.open("GET", "matchups2.xml",
false);
  myXMLHTTPRequest.send(null);

  xmlDoc = myXMLHTTPRequest.responseXML;

  var fragment =
xsltProcessor.transformToFragment(xmlDoc, document);

  document.getElementById("example").innerHTML = "";

  myDOM = fragment;
 
document.getElementById("example").appendChild(fragment);
}
</script>

<body onLoad="Init();">

<div ="example"></div>

</body>
</html>

Both the XML and XSL document seem to be good. It
works  in IE and if I attach the xsl directly to the
xml. Thanks in advance for any advice.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Current Thread