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

R

Robert Mark Bram

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
:)
 
M

Martin Honnen

Robert said:
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.
 
R

Robert Mark Bram

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
:)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top