XML Rendering Problem

J

jamie.ly

Hi,

I am transforming an xml page using an xsl stylesheet. The results
look fine when tested on my local machine using Firefox 1.0.7 and IE
6.0.29, but after I upload the pages to my server and check them
remotely, the page fails to render in Firefox (it works fine in IE).
Any idea what is going on?

In firefox, it looks like the contents of the xml page are just getting
spit out, and no attempt is made to render it (as if it is not
recognized as XML).

xml page:
http://angelforge.com/jamie/resume/resume.xml

xsl:
http://angelforge.com/jamie/resume/resume.xsl

css:
http://angelforge.com/jamie/resume/resume.css

js:
http://angelforge.com/jamie/resume/resumeFunctions.js
 
D

David Dorward

In firefox, it looks like the contents of the xml page are just getting
spit out, and no attempt is made to render it (as if it is not
recognized as XML).
http://angelforge.com/jamie/resume/resume.xml

200 OK
Connection: close
Date: Thu, 16 Feb 2006 21:01:46 GMT
Accept-Ranges: bytes
ETag: "66c0c7-172d-43f4d9ad"
Server: Apache/1.3.34 (Unix) mod_throttle/3.1.2 mod_auth_passthrough/1.8
mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.11 FrontPage/5.0.2.2635
mod_ssl/2.8.25 OpenSSL/0.9.7a
Content-Length: 5933
Content-Type: text/html <<<=============================================!!
Last-Modified: Thu, 16 Feb 2006 19:59:41 GMT
Client-Date: Thu, 16 Feb 2006 21:00:20 GMT
Client-Peer: 64.20.42.162:80
Client-Response-Num: 1

Your server is claiming that your XML is HTML and browsers are attempting to
treat it as such.
 
P

Peter Flynn

David said:
200 OK
Connection: close
Date: Thu, 16 Feb 2006 21:01:46 GMT
Accept-Ranges: bytes
ETag: "66c0c7-172d-43f4d9ad"
Server: Apache/1.3.34 (Unix) mod_throttle/3.1.2 mod_auth_passthrough/1.8
mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.11 FrontPage/5.0.2.2635
mod_ssl/2.8.25 OpenSSL/0.9.7a
Content-Length: 5933
Content-Type: text/html <<<=============================================!!
Last-Modified: Thu, 16 Feb 2006 19:59:41 GMT
Client-Date: Thu, 16 Feb 2006 21:00:20 GMT
Client-Peer: 64.20.42.162:80
Client-Response-Num: 1

Your server is claiming that your XML is HTML and browsers are attempting to
treat it as such.

As David points out, if you want the browser to treat it as XML, you
gotta say so (FAQ: http://xml.silmaril.ie/developers/serversoftware/)

But it gets worse: if you serve it as XML, using XSLT to render it as
HTML, the browser still treats it as XML, so you can't use Javascript
because there is no HTML for it to hang its claws on. If you open the
XML document in a browser and then do a View|Source all you will see
is the XML: even though it has been rendered as HTML, that affects
only the positioning and formatting -- the underlying code is still
HTML, so the Javascript is inoperative.

Unless, of course, someone would like to explain how to do it (I've
been asking people to contribute this to the XML FAQ but there have
been no takers so far, which is why I'm assuming it doesn't work. I
would *love* to be proved wrong -- I'm not a Javascript person.)

///Peter
 
J

Joe Kesselman

I am not so sure about Firefox.

The click-an-item is definitely not working in ffox.

Be careful about displaying that you don't know how to write portable
code and/or aren't willing to test for portability; some potential
employers will indeed hold that against you.
 
A

Andy Dingley

Joe said:
Be careful about displaying that you don't know how to write portable
code and/or aren't willing to test for portability; some potential
employers will indeed hold that against you.

You know employers smart enough to _notice_ ?!

Where do I send my CV? :cool:
 
J

jamie.ly

The really weird thing is that the scripts work fine when tested
locally. Does anyone know why firefox would treat local versus remote
xml/js differently?
 
M

Martin Honnen

The really weird thing is that the scripts work fine when tested
locally. Does anyone know why firefox would treat local versus remote
xml/js differently?

I don't know why it would work locally but at least for Mozilla your
XSLT generates an XHTML document parsed/treated as text/xml and XHTML is
case-sensitive so your event handlers need to be e.g.
onclick
onload
and not
onClick
onLoad
 
J

Joseph Kesselman

(BTW, I happen to know that DataPower -- known for their XML/web-service
accelerators, and now part of IBM -- is looking for a few good people.)
 
P

Peter Flynn

If you look at the page I posted in IE 6.0.29, you will see that my
javascript works fine: http://angelforge.com/jamie/resume/resume.xml
(for example, click on Microsoft Excel, or the Cancel button at the top
right). I am not so sure about Firefox.

But I don't use IE anywhere in this office. I'll try to find someone who
does and have a look. In Firefox it looks like this:
http://silmaril.ie/screenshots/jamie.png

Are you sure you used real Javascript and not Microsoft J-Script?

///Peter
 
P

Peter Flynn

Andy Dingley said:
You know employers smart enough to _notice_ ?!

Unfortunately employers neither know nor care. It's a curiosity of
modern life that most companies are making so much off the customers
who *can* see their web site that they can actually afford to ignore
those who can't. A generation ago, American companies in particular
would have bust a gut to make sure they were getting the business.

(And anyone who can trace the story I quoted when I blogged about
this last year is welcome to mail me. See the footnote to
http://silmaril.ie/cgi-bin/blog?older#nations)
Where do I send my CV? :cool:

Let me know when you find out :)

///Peter
 
P

Peter Flynn

The really weird thing is that the scripts work fine when tested
locally. Does anyone know why firefox would treat local versus remote
xml/js differently?

Possibly because the served document comes with a MIME media type and
the one off disk doesn't.

///Peter
 
S

Skeets

Jamie,

1. your resume has "societ" instead of "society". update that before
someone sees it.

2. also, your student assocation website looks pretty nice, but the
horizontal nav breaks in ff 1.5 - the last list item is put on a second
row and it looks ugly.

3. a visitor to ecaasu.org won't easily know what ECAASU stands for.
this likely isn't a problem for most visitors, but i'd recommend
spelling out the name for the title instead of the acronym. i did see
it on the bottom of the page in very small print, but i had to make an
effort to search for it.

not trying to flame, just trying to offer constructive ideas for
possible improvement.

best of luck.
 
S

Skeets

i was going to say, "i heard none of those three companies are hiring
right now." -lol-

some clown recruiter was recently asking for 3 years php5 experience...
uh, okay, mr recruiter. -lol-
 
J

jamie.ly

This helped out a lot Peter. For now, I am using the extension xxml
with a application/xml mime-type to serve up my xml file, because the
mime for the xml extension is set to text/html and I am having a hard
time getting my host to change it.

I got my JS working in firefox, but my new problem is that I cannot get
html to render in the little comment window to the right.

http://www.angelforge.com/jamie/resume/resume.xxml#

The debug button at the bottom of the page will fill the neighboring
textarea with the inner html of the comment window. The html looks
fine, but its just not rendering. This probably also has something to
do with the Mime-type and I'll probably have to let it go as is. This
was meant to be just a quick little example, and it's getting to be a
chore.

Thanks for all your help!
 
P

Peter Flynn

This helped out a lot Peter. For now, I am using the extension xxml
with a application/xml mime-type to serve up my xml file, because the
mime for the xml extension is set to text/html and I am having a hard
time getting my host to change it.

I got my JS working in firefox, but my new problem is that I cannot get
html to render in the little comment window to the right.

http://www.angelforge.com/jamie/resume/resume.xxml#

Aaah. Now I can see it. Cool.
The debug button at the bottom of the page will fill the neighboring
textarea with the inner html of the comment window. The html looks
fine, but its just not rendering. This probably also has something to
do with the Mime-type and I'll probably have to let it go as is. This
was meant to be just a quick little example, and it's getting to be a
chore.

Relying on browsers to do the parsing and transformation is still a
risky business, as support is very patchy. All the applications I
work with have made the conscious decision to go for server-side
transformation, which is extremely reliable now. But you do need to
be running your own server setup to do this effectively.

///Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,001
Messages
2,570,255
Members
46,852
Latest member
CarlaDowle

Latest Threads

Top