Re: Client-side XSLT containing import/include statements does not work in Firefox
"Daniel Frechette" <daniel_@_treknowledge_._com>
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | TreKnowledge Inc. |
| Message-ID | <[email protected]> |
Thank you Axel.
The error was in my Web server. The MIME type was not defined properly.
Refer to the thread
http://groups.google.ca/group/netscape.public.mozilla.layout.xslt/browse_thread/thread/ff33827bd1e29542/028e79f6122b0c53?hl=en#028e79f6122b0c53
for more details.
Regards,
Daniel
For everyones benefit, here is the HTML page I wrote to test XSL
transformations. This script is especially helpful when you page fragments.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Firefox XSLT Viewer</title>
<style type="text/css" media="screen">
.s100 {color:#333;font-family:
verdana,geneva,arial,helvetica,sans-serif;font-size:0.85em;margin:0;padding:10px;}
.s110 {margin:0;padding-bottom:3px;}
.s120 {background-color:#F0ECE7;border:1px solid
#333;font-size:0.85em;margin-top:10px;padding:5px;}
</style>
<script type="text/javascript">
function ApplyStylesheet(xmlFile, xslFile) {
var xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.async = false;
xmlDoc.load(xmlFile);
var xslDoc = document.implementation.createDocument("", "", null);
xslDoc.async = false;
xslDoc.load(xslFile);
var html = null;
try {
var xsltProc = new XSLTProcessor();
xsltProc.importStylesheet(xslDoc);
var resultDoc = xsltProc.transformToDocument(xmlDoc);
var xmlSerial = new XMLSerializer;
html = xmlSerial.serializeToString(resultDoc);
} catch (e) {
// Do nothing
} finally {
document.getElementById("result").innerHTML = (html != null)
? html : "XSLT Failed!"
}
}
</script>
</head>
<body class="s100">
<div class="s110">XML File <input type="text" size="60" id="xmlFile"
value="http://your_domain/test.xml"/></div>
<div class="s110">XSL File <input type="text" size="60" id="xslFile"
value="http://your_domain/test.xsl"/></div>
<div class="s110"><input type="button" value="Apply Stylesheet"
onclick="javascript:ApplyStylesheet(document.getElementById('xmlFile').value,
document.getElementById('xslFile').value);"/></div>
<div class="s120" id="result">The results go here.</div>
</body>
</html>