Solving problem: google xml sitemap plugin Error loading stylesheet: An unknown error has occurred (805303f4)

If you use Google XML sitemap plugins you could get sometimes – depending on used theme and/or plugins – something like:

Error loading stylesheet: An unknown error has occurred (805303f4)

when you will try to see your sitemap at http://yourdomain.com/sitemap.xml

To solve this problem you have to go to Plugins submenu on WordPress admin panel and edit Google XML Sitemap file:

plugins/google-sitemap-generator/sitemap-core.php

Find there public function:

//===============

public function GetDefaultStyle() {
$p = $this->GetPluginPath();
if(file_exists($p . “sitemap.xsl”)) {
$url = $this->GetPluginUrl();
//If called over the admin area using HTTPS, the stylesheet would also be https url, even if the blog frontend is not.
if(substr(get_bloginfo(‘url’), 0, 5) != “https” && substr($url, 0, 5) == “https”) $url = “http” . substr($url, 5);
return $url . ‘sitemap.xsl’;
}
return ”;
}

//==========

and replace with:

public function GetDefaultStyle() {
$p = $this->GetPluginPath();
if(file_exists($p . “sitemap.xsl”)) {
return ‘/wp-content/plugins/google-sitemap-generator/sitemap.xsl’;
}
return ”;
}

and reactivate the plugin. It should help. The solution is described here:

http://rosamundwo.com/2011/solved-google-xml-sitemap-stylesheet-error/

with other possible option where .htaccess file involved.