+ Reply to Thread
Results 1 to 3 of 3

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

  1. #1
    adler96 is offline x10Hosting Member adler96 is an unknown quantity at this point
    Join Date
    Oct 2011
    Posts
    6

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

    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...tion_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:output 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?

  2. #2
    essellar's Avatar
    essellar is offline Community Advocate essellar has a spectacular aura about
    Join Date
    Feb 2010
    Location
    Toronto, Ontario, CA
    Posts
    1,153

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

    You are starting to send data (the echo statement) before setting the MIME-type header. If you put the header() statement first, you should fix the problem.

    Note, though, that you may have some trouble with the MIME type in any case -- some user agents may be okay with "text/html", while others may demand "application/xml" (and others, notably IE, reject the notion of "application/xml" altogether on some sort of religious basis nobody has been able to make sense of).
    “Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
    "It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)

  3. #3
    adler96 is offline x10Hosting Member adler96 is an unknown quantity at this point
    Join Date
    Oct 2011
    Posts
    6

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

    That was it! Thanks a lot!

    The solution makes total sense.

    I know the proper mime type should be "application/xml", but I had to revert back to "text/xml" because of incompatibilites with Internet Explorer.


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

+ Reply to Thread

Similar Threads

  1. Stylesheet doesnt come :(
    By quackcoder78 in forum Free Hosting
    Replies: 2
    Last Post: 06-26-2011, 10:50 PM
  2. Using a .php file as a stylesheet
    By shant93 in forum Programming Help
    Replies: 27
    Last Post: 01-08-2011, 03:30 PM
  3. Stylesheet exploded
    By as4s1n in forum Programming Help
    Replies: 2
    Last Post: 03-07-2010, 03:01 AM
  4. CSS Stylesheet
    By sa4amz in forum Free Hosting
    Replies: 1
    Last Post: 10-05-2008, 02:52 PM
  5. Help: stylesheet not updating
    By cashguy in forum Scripts & 3rd Party Apps
    Replies: 3
    Last Post: 09-19-2007, 01:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers