Error loading stylesheet: An XSLT stylesheet does not have an XML mimetype

adler96

Member
Messages
117
Reaction score
2
Points
18
Hi!

I have a php file which produces xml. This xml file refers to an external xsl file. This xsl file includes an xsl stylesheet which is generated dynamically from a php file.

I am getting the following error (only in Firefox, the rest are working fine):

Error loading stylesheet: An XSLT stylesheet does not have an XML mimetype:

http://www.nightearth.com/common.php?get_translation_templates

That's it, the mime type of the php file is not being set correctly, even though at the beginning of my file I am including the lines:

<?
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
header("Content-type: text/xml");
?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:eek:utput method="html" encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />

So, basically what I need is that this php file will be evaluated, and at the same time it will be interpreted as an xsl stylesheet.

This code was working perfectly in other hostings, but for some reason it is not working fine here. I have tried modifying the .htaccess file, as suggested in different searches in Internet, but no result.

Any ideas?
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
You're outputting the start of the body before printing the Content-type header. Headers must be printed first. Read up on HTTP for the reason why.
 
Last edited:

adler96

Member
Messages
117
Reaction score
2
Points
18
That was it, thanks a lot! It makes total sense.

I don't understand how could this work in the other hosting.

Nevertheless, it is working now. Thanks! :)

PS: Sorry for the double post. An error occurred while posting, so I posted the message again, but in the end both succeeded.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Most likely, the other host had output buffering enabled.

As for the double post, I thought it might be unintentional. vBulletin has the occasional hiccup. I appreciate that you know not to double post.
 
Last edited:
Top