Netscape 7 and client side xml / xsl

Need technical advice on coding your web pages? Covers HTML, JavaScript, CSS, and some server side technologies. Also the issue of some webpages not displayed well.

Moderator: Don_HH2K

Netscape 7 and client side xml / xsl

Postby Stu » Thu 03 Oct, 2002 2:21 pm

Hi all,

I have trawled the web for an answer to my problem but have found nothing of use. So I am hoping that someone here can advise me.

My problem is with client side transformation of xml using xsl stylesheets.
Netscape 7 ( I am led to believe from the help pages ) now has support for this and has a switch option in the advanced set up.

I have produced my site and it works perfectly using Netscape 7 LOCALLY on my XP. However when viewing the site on the web all I get is the XML text (no transformation).
It works perfectly using IE6 both locally and on the web.

people have suggested that I need .htaccess to set up the MIME type for text/xml but this makes no difference. It is as though the xsl stylesheet is not sent to the client OR not found.

I have placed both file in the same directory.
My web site is http://stuart.port5.com

Any ideas welcome.
Thanks
Stu
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
User avatar
Stu
member
member
 
Posts: 35
Joined: Thu 03 Oct, 2002 2:06 pm
Location: Bristol uk

Postby Shark Daddy » Thu 03 Oct, 2002 3:25 pm

This is likely caused by something in the head, the XML statement, or MIME type. It could also actually be caused by the file extension.

Why exactly would you want to make a site out of XML and XSL? If it's just a normal website, HTML 4 and CSS are more than sufficient (until XHTML 2 is recommended) for the time being.

I can probably diagnose the problem in the XML if I can see the files, as I've had similar problems with Mozilla and IE when I put up XHTML on my site.
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2b) Gecko/20020921
Shark Daddy
Moderator
Moderator
 
Posts: 519
Joined: Wed 19 Jun, 2002 11:19 am
Location: Toronto, Canada

Postby Stu » Thu 03 Oct, 2002 4:34 pm

The index.xml head is:
Code: Select all
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="layout.xsl" type="text/xsl" ?>


the layout.xsl head is:
Code: Select all
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">


I am working on an XML / XSL site to see what all the fuss is about XML.
I am using the xsl file as a template (header/3 column/footer) page and 'including' various xml files (pages) into the the middle column.
With this method I can control the page layout with one file and the changing content with a smaller XML file, combining them client-side.

The site becomes easier to manage and quicker loading as once layout.xsl file is downloaded it is instantly accessible client side for further pages. Similar to PHP 'include' but client side.

If you visit the site using IE6 you can see the results (although it is far from complete). It also has a printer friendly version of each page using Javascript to transform the .xml (content) file with a different .xsl, again client side.

I have tried the following in .htaccess
AddType text/xml xml xsl
AddType text/xml-external-parsed-entity
AddType application/xml
AddType application/xml-dtd
AddType application/xml-external-parsed-entity

but without success.

It is odd that Netscape 7 transforms the .xml correctly when the file is loaded locally on my PC

HTML4 and CSS are no match for XML and XSL

The files can be viewed on my site. Just use view source for the .xml and
http://stuart.port5.com/layout.xsl for the stylesheet.
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
User avatar
Stu
member
member
 
Posts: 35
Joined: Thu 03 Oct, 2002 2:06 pm
Location: Bristol uk

One further point

Postby Stu » Fri 04 Oct, 2002 5:05 pm

One further point on this problem is that I have Apache / PHP / CGI and MySQL set up locally on my PC so that I can test my other web sites which are PHP / MySQL based.
When I use this method to view my .xml files using Netscape 7 they work perfectly.

The problem only shows itself when viewing the same files on the web.

Thanks for any help.
Stu
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0
In youth we learn, in age we understand
User avatar
Stu
member
member
 
Posts: 35
Joined: Thu 03 Oct, 2002 2:06 pm
Location: Bristol uk

Postby Stu » Sat 05 Oct, 2002 2:28 pm

I believe that I have found an answer to my problem.
So if anyone has similar experiences in the future I thought I'd share this knowledge :)

I have created an .htaccess file with the following lines
AddType text/xml .xml
AddType text/xml .xsl

and added the following as a header to the .xsl file
Code: Select all
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
<xsl:output media-type="text/xml" />


The only problem now is that Javascript does not work when included in .xsl using Netscape 7 if it contains the 'document.write' command. :(

Oh well one thing at a time .............
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0
In youth we learn, in age we understand
User avatar
Stu
member
member
 
Posts: 35
Joined: Thu 03 Oct, 2002 2:06 pm
Location: Bristol uk

Problem document.write code in xsl include file

Postby dhuguet » Tue 21 Jan, 2003 10:15 am

Hye

I've just encountered your new problem. :cry:

If you have an answer, please tell me

Thanks
Dad
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020826
dhuguet
new member
new member
 
Posts: 1
Joined: Tue 21 Jan, 2003 10:07 am
Location: Paris

Postby Stu » Tue 21 Jan, 2003 1:19 pm

Sorry but the answer is that Netscape/Mozilla does not support document.write when used in xsl

I now how two site that are xml based.

http://stuart.port5.com is xml/xsl/css
and
http://www.w3xml.co.uk is xml/css


Stu
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
In youth we learn, in age we understand
User avatar
Stu
member
member
 
Posts: 35
Joined: Thu 03 Oct, 2002 2:06 pm
Location: Bristol uk


Return to Web Design and Page Coding

Who is online

Registered users: Bing [Bot], Google [Bot]