xsl-list
[Top] [All Lists]

[xsl] Parameters to XSL from Javascript

2009-05-15 13:36:50

Hi,
      I have been working on getting my XSL to be generated through javascript 
and I got it to work for firefox and IE. But the problem is I was able to pass 
a parameter for the firefox section but not the IE. I looked up how to do it 
for IE but it doesn't seem to work. Please let me know if you see any problems 
with it. Heres my code....

function loadXMLDoc(fname)
{
  var xmlDoc;
  // code for IE
  if (window.ActiveXObject)
  {
    xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  }
  // code for Mozilla, Firefox, Opera, etc.
  else if (document.implementation
  && document.implementation.createDocument)
  {
    xmlDoc=document.implementation.createDocument("","",null);
   }
  else
  {
    alert('Your browser cannot handle this script');
  }
xmlDoc.async=false;
xmlDoc.load(fname);
return(xmlDoc);
}

function displayResult()
{

xml=loadXMLDoc("test.xml");
xsl=loadXMLDoc("test.xsl");
// code for IE

if (window.ActiveXObject)
  {
        var xsltCompiled = new ActiveXObject("Microsoft.XMLDOM");
        xsltCompiled.stylesheet = xsl.documentElement;

        var xsltProc = xsltCompiled.createProcessor();

        xsltProc.input = xml;
        xsltProc.addParameter('item',itm);
                                                                            
        xsltProc.transform();
}




      

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>