xslt transformation working fine with IIS server but not with Apache
[email protected] (Eve)
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
Hello :
I have a problem that goes far beyond my very little knowledge about
servers, DOMs and all that stuff. The problem is that I'm not able to
apply an xslt file to an xml file on our Web server which is a
Apache/1.3.20 (Win32). The xml file is loaded, the xslt file is loaded
but no transformation occurs. However, the same code works fine on a
local web server wich is a IIS Web server. I have read the faq
regarding that question on :
http://www.mozilla.org/projects/xslt/faq.html (Why isn't my stylesheet
applied?). As suggested, I have installed liveHTTPHeader.
Here is the liveHTTPHeader's part regarding xslt file (EYB.xslt) :
----------------------------------------------------------
http://www.caij.qc.ca/html/EYB_TEST/DocumentsXML/EYB.xslt
GET /html/EYB_TEST/DocumentsXML/EYB.xslt HTTP/1.1
Host: www.caij.qc.ca
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7)
Gecko/20040803 Firefox/0.9.3
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
HTTP/1.x 200 OK
Date: Wed, 22 Sep 2004 17:49:11 GMT
Server: Apache/1.3.20 (Win32)
Last-Modified: Thu, 16 Sep 2004 21:54:19 GMT
Etag: "0-39a0-414a0b8b"
Accept-Ranges: bytes
Content-Length: 14752
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/plain
----------------------------------------------------------
And here is the header in the eyb.xslt file :
----------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output version="1.0" encoding="utf-8"
omit-xml-declaration="no" indent="no" />
-------------------------------------------------
Finally the javascript itself that process the objects :
-------------------------------------------------
function Init()
{
var browserName=navigator.appName;
var isbnNS="<!--WEB2_DISPLAY :020$a-->";
var fichierXMLns='http://www.caij.qc.ca/html/EYB_TEST/DocumentsXML/'+isbnNS+'.xml';
var fichierXSLns = "http://www.caij.qc.ca/html/EYB_TEST/DocumentsXML/EYB.xslt";
if (browserName == "Netscape")
{
var oXML = document.implementation.createDocument("", "", null);
var oXSL = document.implementation.createDocument("", "", null);
var xmlLoaded = false;
var xslLoaded = false;
function loadlistener(e)
{
if (e.currentTarget == oXML)
xmlLoaded = true;
if (e.currentTarget == oXSL)
xslLoaded = true;
if (!xmlLoaded || !xslLoaded)
return;
var xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(oXSL);
var fragment = xsltProcessor.transformToFragment(oXML,document);
document.getElementById('EYB').innerHTML = "";
document.getElementById('EYB').appendChild(fragment);
}
oXML.addEventListener("load", loadlistener, false);
oXSL.addEventListener("load", loadlistener, false);
oXML.load(fichierXMLns);
oXSL.load(fichierXSLns);
}
}
-------------------------------------------------
If I refer to the faq mentionned above, the problem might have
something to do with the «Content-Type: text/plain» in the http header
sent by the server. If it's the case, is there a way to set the server
in order to send «text/xml» instead of the «text/plain» ?
Any hints/helps will be welcome.
Thanks