0

I have a HTML file which Uses XSL and XML. It works perfectly in IE (What a Surprise) but it does not work in Chrome and Firefox. The JavaScript in the code works only in IE. Can anybody help me solving this issue? I have given the JavaScript below

<BODY onload="view()" topmargin="10" leftmargin="5" rightmargin="5" bottommargin="10" marginwidth="0">
<div ID="divResults">
</div>
<script language="javascript">
    var xmlDOM, xslDOM;
    function view() {
        xslDOM = XSLStyle.XMLDocument;
        xmlDOM = REPORT.XMLDocument;
        document.getElementById("divResults").innerHTML = xmlDOM.transformNode(xslDOM);
    }
    function dsble_Help() {
        return false;
    }
    document.onhelp = dsble_Help
</script>

REPORT ID :

<XML ID="REPORT">
<REPORT>
    <HD>
        <RPTID>NAE100RX</RPTID>
        <RUNDT>04/29/2013</RUNDT>
        <RUNTM>17.24.13</RUNTM>
        <ASOFDT>04/29/2013</ASOFDT>
        <HD1>CREATE TRIGGERS EXCEPTION REPORT</HD1>
        <HD2>FOR 04/29/2013</HD2>
        <HD3></HD3>
    </HD> 
    <XPAGE>
        <RPAGE>1</RPAGE>
        <AE100XCNT>0</AE100XCNT>
        <EXDATA></EXDATA>
    </XPAGE>
</REPORT>

3
  • 1
    Any errors in the JavaScript console? What are XSLStyle.XMLDocument and REPORT.XMLDocument? Where do they come from? Commented May 9, 2013 at 21:08
  • Can you please add in what way it fails? Commented May 9, 2013 at 21:08
  • REPORT and XSLStyle are the Corresponding XML and XSL embedded in HTML Commented May 9, 2013 at 23:37

1 Answer 1

4

From your XML example, you seem to be using an IE only feature - XML data islands.

This cannot be made to work with other browsers.

You will need to use standardized techniques in order to do so in the other browsers.

Sign up to request clarification or add additional context in comments.

2 Comments

Oded, I was able to follow your link and was able to create XMLDcoument but still XML and XSL are not converted to HTML. Here is code I used, var p = new DOMParser() var xmldoc = p.parseFromString(document.getElementById("REPORT").innerHTML, 'text/xml') var xsldoc = p.parseFromString(document.getElementById("XSLStyle").innerHTML, 'text/xml') xsltProcessor = new XSLTProcessor(); xsltProcessor.importStylesheet(xsldoc); resultDocument = xsltProcessor.transformToFragment(xmldoc, document); document.getElementById("htmlBody").appendChild(resultDocument);
@user2367884 - Any JavaScript errors in the console? Do you see values in xmldoc and xsldoc when debugging through?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.