XSLT rendering in Firefox - works from Apache, but not from WAS

Discussion in 'XML' started by Robert Mark Bram, Feb 12, 2008.

  1. Hi All,

    I have a page that uses XSLT to render some XML as HTML inline. The
    page works when deployed to Apache and viewed through Firefox. The
    SAME code deployed to WAS does not work when viewed through Firefox!

    Here is my HTML:

    <html><head>
    <script type="text/javascript" >
    function loadXMLDoc(fileName) {
    var xmlDoc;
    xmlDoc = document.implementation.createDocument("", "", null);
    xmlDoc.async = false;
    xmlDoc.load(fileName);
    return(xmlDoc);
    }

    function displayResult() {
    xml = loadXMLDoc("test.xml");
    xsl = loadXMLDoc("treeviewReduced.xslt");
    xsltProcessor = new XSLTProcessor();
    xsltProcessor.importStylesheet(xsl);
    resultDocument = xsltProcessor.transformToFragment(xml,document);
    document.getElementById("theDiv").appendChild(resultDocument);
    }
    </script>
    </head><body onload="displayResult();">
    <div id="theDiv" ><p>The DIV</p></div>
    </body></html>


    I have deployed it to my Apache at this address:
    - http://localhost/test.html
    This works on Firefox - I see the xml rendered as HTML.

    I have deployed it to my IBM WAS at this address:
    - http://localhost:9080/docPublisher/robindex.jsp
    This does NOT work on Firefox - There is no HTML rendered in place.

    In both instances (WAS and Apache), test.xml and treeviewReduced.xslt
    exist in the same directory as the jsp/html. I can replace "test.html"
    and "robindex.jsp" with both xml file names and see the xml
    documents.

    In both instances (WAS and Apache), the IE version of this code works
    - using the same relative xml file names.

    In the case of the HTML file, I can double click on it and have it
    come up correctly in Firefox.

    I don't think this is a problem with Firefox or my JavaScript, but I
    am at a complete loss to understand why this is happening. Any
    assistance would be appreciated!

    Rob
    :)
     
    Robert Mark Bram, Feb 12, 2008
    #1
    1. Advertising

  2. Robert Mark Bram wrote:

    > function loadXMLDoc(fileName) {
    > var xmlDoc;
    > xmlDoc = document.implementation.createDocument("", "", null);
    > xmlDoc.async = false;
    > xmlDoc.load(fileName);
    > return(xmlDoc);
    > }
    >
    > function displayResult() {
    > xml = loadXMLDoc("test.xml");
    > xsl = loadXMLDoc("treeviewReduced.xslt");
    > xsltProcessor = new XSLTProcessor();


    Make sure your web server serves those files (test.xml,
    treeviewReduced.xslt) with an XML MIME type (application/xml or
    text/xml). Otherwise Mozilla does not load them with the load method.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Feb 12, 2008
    #2
    1. Advertising

  3. Yes!!!

    > Make sure your web server serves those files (test.xml,
    > treeviewReduced.xslt) with an XML MIME type (application/xml or
    > text/xml). Otherwise Mozilla does not load them with the load method.


    Thank you Martin - this was it. I saved treeviewReduced.xslt as
    treeviewReduced.xml instead and it works!

    Rob
    :)
     
    Robert Mark Bram, Feb 12, 2008
    #3
  4. Robert Mark Bram, Feb 13, 2008
    #4
  5. Robert Mark Bram, Feb 13, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Dalberg
    Replies:
    29
    Views:
    4,156
    kchayka
    Nov 3, 2004
  2. Replies:
    0
    Views:
    476
  3. F. GEIGER
    Replies:
    3
    Views:
    816
    F. GEIGER
    Aug 6, 2004
  4. Replies:
    3
    Views:
    1,530
  5. Peter Laman
    Replies:
    5
    Views:
    852
Loading...

Share This Page