Launch browser with specific XML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tekenbeet
    New Member
    • Mar 2008
    • 1

    #1

    Launch browser with specific XML

    I receive XML data-files. Now I want to show it in my browser(IE) using my own xslt . I think I'm almost there, but now I'm stuck. I can't figure-out how to pass the XML-filename to the HTML-file, so please help.

    To load the XML I use this script, but here the XML is hardcoded. How do I make it variable?
    Final note... the HTML is loaded from a vb-macro.

    Thanks in advance

    <html>
    <head>
    <script>
    function loadXMLDoc(fnam e)
    {
    var xmlDoc;
    // code for IE
    if (window.ActiveX Object)
    {
    xmlDoc=new ActiveXObject(" Microsoft.XMLDO M");
    }
    // code for Mozilla, Firefox, Opera, etc.
    // else if (document.imple mentation && document.implem entation.create Document)
    // {
    // xmlDoc=document .implementation .createDocument ("","",null) ;
    // }
    else
    {
    alert('Your browser cannot handle this script');
    }
    xmlDoc.async=fa lse;
    xmlDoc.load(fna me);
    return(xmlDoc);
    }

    function displayResult()
    {
    xml=loadXMLDoc( "08G050911.xml");
    xsl=loadXMLDoc( "bwGMLKlic10.xs lt");

    // code for IE
    if (window.ActiveX Object)
    {
    ex=xml.transfor mNode(xsl);
    document.getEle mentById("examp le").innerHTML= ex;
    }
    // code for Mozilla, Firefox, Opera, etc.
    else if (document.imple mentation && document.implem entation.create Document)
    {
    xsltProcessor=n ew XSLTProcessor() ;
    xsltProcessor.i mportStylesheet (xsl);
    resultDocument = xsltProcessor.t ransformToFragm ent(xml,documen t);
    document.getEle mentById("examp le").appendChil d(resultDocumen t);
    }
    }
    </script>
    </head>
    <body onload="display Result()">
    <div id="example" />
    </body>
    </html>
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    Why not get the parameter from a url using javascript?

    Comment

    Working...