Hello,

I have domain.it and domain.com, where domain.it is the default site and domain.com the translated one.

When i create a multilanguage sitemap, everything works fine, except if i tick the "add a stylesheet" option.

The domain.com sitemap opened in the browser displays an error, with firefox ranting about the impossibility to open the stylesheet, but the source code is (almost) fine...
The problem is that it tries to add the stylesheet from the .it domain, like this:

<?xml-stylesheet type="text/xsl" href="http://www.domain.it/sitemap.xsl"?>

Using domain.com solves the issue.

It should be an easy thing, and i can try to fix it if you dont have time.. just point me to the right functions to save some time =)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xamount’s picture

I can confirm that this bug happens to me as well. Same exact scenario. Subscribing.

Dave Reid’s picture

entuland’s picture

Hello,
this happened to me too in a multi-domain installation, using version 6.x-2.0-rc1.

In that version the issue seems to be in the file xmlsitemap/xmlsitemap.xmlsitemap.inc, line 65, inside of this function:

  public function writeXSL() {
    $this->writePi('xml-stylesheet', 'type="text/xsl" href="' . url('sitemap.xsl') . '"');
    $this->writeRaw(PHP_EOL);
  }

The call to url('sitemap.xsl') systematically outputs "http://domain.it/sitemap.xsl", whereas depending on the sitemap I needed stuff like "http://domain.de/sitemap.xsl", "http://domain.co.uk/sitemap.xsl" and so forth.

I changed that line to this:

$this->writePi('xml-stylesheet', 'type="text/xsl" href="' . url('sitemap.xsl', array("language" => $this->sitemap->context["language"])) . '"');

I thought it would end up with the full URLs mentioned above, but it simply outputted "/sitemap.xsl" which works quite well in any case for all of my domains.

I don't know if this fix is acceptable and if it applies also to the 7.x branch, in any case I wanted to share.

Thanks a lot for a very useful module despite of this minor glitch.

darthf1’s picture

Version: 7.x-2.0-beta3 » 7.x-2.0-rc1
Priority: Minor » Normal

This bug still occurs for me in 7.x-2.0-rc1

darthf1’s picture

Assigned: Sifro » Unassigned
Anonymous’s picture

Version: 7.x-2.0-rc1 » 7.x-2.x-dev

Can someone turn the #3 change into a proper patch to get the test bot attention?

Dzhebarov’s picture

I confirm that the #3 change works for me in 7.x-2.x-dev

darthf1’s picture

Status: Active » Reviewed & tested by the community

I confirm that the #3 change works for me in 7.x-2.x-dev

Anonymous’s picture

Status: Reviewed & tested by the community » Active

No patches attached. Resetting status to active.

I understand #3 gives a solution but that solution isn't a formal patch so the Reviewed and tested status isn't correct.

jasom’s picture

After #3 (I changed line 60 in xmlsitemap/xmlsitemap.xmlsitemap.inc to $this->writePi('xml-stylesheet', 'type="text/xsl" href="' . url('sitemap.xsl', array("language" => $this->sitemap->context["language"])) . '"'); ) and I still see message:

Error loading stylesheet: An unknown error has occurred (805303f4)
http://www.site.com/sitemap.xsl

It shold be "site.cz" not "site.com". I have 7.x-2.0-rc2.

matglas86’s picture

Status: Active » Needs review
FileSize
561 bytes

I had the same problem. The sitemap value has all values needed for the options in url(). So here is the patch.

Anonymous’s picture

Assigned: Unassigned » Dave Reid
Status: Needs review » Reviewed & tested by the community

Looks good to me.

jasom’s picture

I applied patch, updated cached files, rebuilt links, fixed .htaccess redirect to www version, cleared caches and it WORKED! Thank you.

Czech version on site.cz/sitemap.xml si working again, but I don't understand why I have "Page not found" message on site.com/sitemap.xml (default language sitemap).

Update:
Even "page not found" error was removed by #14 on #1104746: sitemap.xml not found (Error 404). Dave or Earnie, please, take a look at #14 and #15.

Drupal has great comunity.

yce’s picture

#11 Thanks! It worked for me for 7.x-2.0-rc2 version.

Dave Reid’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Committed #11 to 7.x-2.x. Thanks and sorry for the wait.
http://drupalcode.org/project/xmlsitemap.git/commit/8bf0985

Dave Reid’s picture

Looks like it applied to 6.x-2.x as well, so I backported it as well.
http://drupalcode.org/project/xmlsitemap.git/commit/aa208a7

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Chris Burge’s picture

This commit causes issues with HTTP/HTTPS sites as is described in #2244449: Use Protocol-less URL for XSL File.