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.
218: 	function processXSL(xmlFile, xslFile)
219: 	{
220:		xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
221:		xmlDoc.async = false;
222:		xmlDoc.load(xmlFile);

Open in new window

LVL 10
Who is Participating?
Geert BormansConnect With a Mentor Information ArchitectCommented:
no, it is not a patch, it is an update, but it can be installed alongside msxml3 (what was delivered with IE)

If you are making a special install for this, you could as well choose msxml6 and change your code to
xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");
Geert BormansInformation ArchitectCommented:
two possibilities for this problem
- 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.DOMDocument");
aman0711Author Commented:
Hi Gertone,
                        Where can I download msxml4? is it some kind of patch?
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

aman0711Author Commented:
ok, will try it right now and get back to you

aman0711Author Commented:
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.DOMDocument.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?
Geert BormansInformation ArchitectCommented:
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
aman0711Author Commented:
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:

	xslTpl = new ActiveXObject("Msxml2.XSLTemplate.6.0");
	xslTpl.stylesheet = xslDoc;
	xslProc = xslTpl.createProcessor();
	xslProc.input = xmlDoc;

Open in new window

Geert BormansInformation ArchitectCommented:
> 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
aman0711Author Commented:
Ok... somewhere I read , stylesheet and html file should be in the same folder for XSLT.
Geert BormansInformation ArchitectCommented:
no, they should not necessarily be in the same folder,
but they need to be on the same server
aman0711Author Commented:
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?
Geert BormansInformation ArchitectCommented:
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
aman0711Author Commented:
no problem... you helped so much thanks :)
aman0711Author Commented:
Geert BormansInformation ArchitectCommented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.