aman0711
asked on
Jsp Page with XSLT coming up blank in certain browsers
Hi Experts,
We made a jsp page which displays certain data. We used XSLT for this. The problem we are facing is, We cant see anything on page on certain systems (I am saying systems because its working fine on IE6 and 7 but not on my colleagues comp using the same browser)
The error we are seeing on browsers where nothing is getting displayed is:
error:Automation server can't create object
and Its pointing to Line 220 of the code, I have that piece of code below.
We made a jsp page which displays certain data. We used XSLT for this. The problem we are facing is, We cant see anything on page on certain systems (I am saying systems because its working fine on IE6 and 7 but not on my colleagues comp using the same browser)
The error we are seeing on browsers where nothing is getting displayed is:
error:Automation server can't create object
and Its pointing to Line 220 of the code, I have that piece of code below.
218: function processXSL(xmlFile, xslFile)
219: {
220: xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
221: xmlDoc.async = false;
222: xmlDoc.load(xmlFile);
ASKER
Hi Gertone,
Where can I download msxml4? is it some kind of patch?
Where can I download msxml4? is it some kind of patch?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok, will try it right now and get back to you
ASKER
Hey Gertone,
that was brilliant :-)
First I tried to install msxml6, but got the error saying, we already have a latest version. Then as suggested by you, I used:
xmlDoc = new ActiveXObject("Msxml2.DOMD ocument.6. 0");
and it worked perfectly.
Though it still doesnt work on FireFox but thats not the requirement.
Why exactly this happens? Conflict of versions?
that was brilliant :-)
First I tried to install msxml6, but got the error saying, we already have a latest version. Then as suggested by you, I used:
xmlDoc = new ActiveXObject("Msxml2.DOMD
and it worked perfectly.
Though it still doesnt work on FireFox but thats not the requirement.
Why exactly this happens? Conflict of versions?
No, you can use the different versions of msxml next to each other.
That is to not have conflicts with different browsers.
I believe msxml3 is installed with most browsers
msxml4 has been there for a very long time as a seperate install
msxml5 was part of msoffice only
and msxml6 is installed with IE7 and later
Most likely the machines that broke your code are more recent and have msxml6 installed with there pretty recent IE
You can specify witch version of the active X object you use,
or don't specify it and then the browser will pick the version
There is code on EE that picks the most recent available on your machine, that is pretty interesting to incorporate
This will not work on FireFox, since ActiveX objects is IE only
If you want to get this to work on FireFoxn, you need to add a browser independent touch to the code
(you can also find that on EE)
or use an XML JS library that makes the browser dependent layer abstract to the programmer
I often use Sarissa library for that
That is to not have conflicts with different browsers.
I believe msxml3 is installed with most browsers
msxml4 has been there for a very long time as a seperate install
msxml5 was part of msoffice only
and msxml6 is installed with IE7 and later
Most likely the machines that broke your code are more recent and have msxml6 installed with there pretty recent IE
You can specify witch version of the active X object you use,
or don't specify it and then the browser will pick the version
There is code on EE that picks the most recent available on your machine, that is pretty interesting to incorporate
This will not work on FireFox, since ActiveX objects is IE only
If you want to get this to work on FireFoxn, you need to add a browser independent touch to the code
(you can also find that on EE)
or use an XML JS library that makes the browser dependent layer abstract to the programmer
I often use Sarissa library for that
ASKER
That was very useful and informative explanation for a rookie like me :-)
Just now we tried to open the same page on our boss's machine and got a new error :(
The exact error code is :
The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be well formed XML document.
Throwing the error on following lines:
Just now we tried to open the same page on our boss's machine and got a new error :(
The exact error code is :
The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be well formed XML document.
Throwing the error on following lines:
xslTpl = new ActiveXObject("Msxml2.XSLTemplate.6.0");
xslTpl.stylesheet = xslDoc;
xslProc = xslTpl.createProcessor();
xslProc.input = xmlDoc;
> The stylesheet does not contain a document element
That means that loading of the XSLT was unsuccesful
maybe the XSLT was not at the expected location or there is a validation error in teh XSLT
That means that loading of the XSLT was unsuccesful
maybe the XSLT was not at the expected location or there is a validation error in teh XSLT
ASKER
Ok... somewhere I read , stylesheet and html file should be in the same folder for XSLT.
no, they should not necessarily be in the same folder,
but they need to be on the same server
but they need to be on the same server
ASKER
Hmmm... ok. Thanks for all your help. It was great :-)
The only thing I dont understand is, if the same stylesheet are getting renedered fine on our browsers, why is it giving problem on my boss's machine?
The only thing I dont understand is, if the same stylesheet are getting renedered fine on our browsers, why is it giving problem on my boss's machine?
I don't understand that either
- could be a security setting
- could be that you made an error in copying the stylesheet
more I don't know, sorry
- could be a security setting
- could be that you made an error in copying the stylesheet
more I don't know, sorry
ASKER
no problem... you helped so much thanks :)
ASKER
Thanks
welcome
- browser does not allow activeX controls to be loaded, change the security settings then
- more likely, msxml4 is not installed. msxml4 does not come with any browser, so you need to install seperately
see what happens when you change line 220 into
xmlDoc = new ActiveXObject("Msxml2.DOMD