I have a xsl file that is saved as whatever.php. the style sheet is called by <?xml-stylesheet type="text/xsl" href="whatever.php"?>
I get an error on firefox that it does not have the correct mime type.
I save the xsl file under php because I need to use php in the code to execute certain functions. What is the correct mime type for firefox?

Recommended Answers

All 2 Replies

Here are a few 'possible' solutions. I haven't tested them, but they should work in my opinion.

1) Set the headers for PHP file to xml. Most browsers don't parse XML files if they have unknown extensions.

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

2) Try using mod rewrite so that you call whatever.xml instead of whatever.php

commented: thanks +1

I'll have to try that, I actually just ended up parsing it with javascript so I could make it into an ajax app. thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.