Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

6 views
Skip to first unread message

Robert Mark Bram

unread,
Feb 12, 2008, 12:36:24 AM2/12/08
to
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
:)

Martin Honnen

unread,
Feb 12, 2008, 7:24:54 AM2/12/08
to
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/

Robert Mark Bram

unread,
Feb 12, 2008, 5:38:27 PM2/12/08
to
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

unread,
Feb 12, 2008, 9:19:11 PM2/12/08
to

Robert Mark Bram

unread,
Feb 12, 2008, 9:19:26 PM2/12/08
to
0 new messages