...

View Full Version : Firefox does not show my XML/XSLT output



Lauwerier
10-01-2008, 04:28 PM
Probably this is a FAQ, but I am not able to find the answer:
Firefox does not show my XML/XSLT output
I have just been succesful in creating HTML-forms from PHP-script using XML/XSLT under Windows/IExplorer. My test page is www.lauwerier.nl/PHPJules/test.xml

My HTML-forms but do not show in my current Firefox-environment (neither FF2/WindowsXP nor FF3/KubuntuLinux).

Under FF3 using ViewPageSource (Paginabron bekijken in Dutch) I see the XML-page I expected to be correct. Using a right-click and choosing "View Transformed XML Source" I get the HTML-code I expected (I use XSL Result 1.56 as add-on to get the option "View Transformed XML Source").

Why does my Firefox-browser does not show the interpreted Transformed XML Source ? I suspect that something needs to be done in the header or mime-type, but I cannot find the correct clue.

Alex Vincent
10-01-2008, 09:29 PM
Your html element has no namespace. It's not XHTML, therefore.

I'm looking for
xmlns="http://www.w3.org/1999/xhtml" here:
http://www.lauwerier.nl/PHPJules/20080925_plaats_wijzig_formulier.xsl

Lauwerier
10-01-2008, 10:02 PM
Thanks,

I just changed <html> to <html xmlns="http://www.w3.org/1999/xhtml"> in my XSL which solves my problem.
:thumbsup::)

Lauwerier
10-02-2008, 11:12 PM
@Alex: It seems I still have not solved it all. Please compare the page source of http://www.lauwerier.nl/PHPJules/20081002_plaats_wijzigen.php?plaats_nr=3 with the page source of http://www.lauwerier.nl/PHPJules/test2.xml
What is the difference ? They both use the same XSL !
Please help again.

Alex Vincent
10-03-2008, 07:11 AM
Not enough to go on here, I'm afraid. Might be one's being served as text/html from your web server, and the other as application/xml. That's a very uneducated guess, though.

Lauwerier
10-03-2008, 11:00 PM
Solution seems to be:
Adding the following lines to my PHP-script:

header('Content-Type: text/xml, charset=utf-8');
header('Content-Disposition: inline; filename=mijndummy.xml');

The second seems to be required for IExplorer. The reason is given in a post I found on http://nl3.php.net/header:

dracolytch at yahoo dot com
10-May-2007 06:00
You may find that you want to process a PHP file, and have the browser treat the output as an XML file. Unfortunately, most browsers will only do this if the file extension is ".xml"

In those situations where you can't/don't want to change your apache config to put XML files through the PHP processor, you can use the header function to change the output to something the browser will recognise as XML:

header('Content-Type: text/xml');
header('Content-Disposition: inline; filename=sample.xml');

(The inline portion helps ensure the browser renders the page itself, instead of prompting the user to download the page)
:thumbsup::)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum