diff --git a/xmlsitemap.generate.inc b/xmlsitemap.generate.inc
index c6b564a..da94aed 100644
--- a/xmlsitemap.generate.inc
+++ b/xmlsitemap.generate.inc
@@ -137,12 +137,14 @@ function xmlsitemap_generate_page(stdClass $sitemap, $page) {
 
 function xmlsitemap_generate_chunk(stdClass $sitemap, XMLSitemapWriter $writer, $chunk) {
   $lastmod_format = variable_get('xmlsitemap_lastmod_format', XMLSITEMAP_LASTMOD_MEDIUM);
+  $languages = language_list();
 
   $url_options = $sitemap->uri['options'];
   $url_options += array(
     'absolute' => TRUE,
     'base_url' => variable_get('xmlsitemap_base_url', $GLOBALS['base_url']),
-    'language' => language_default(),
+      // Get the language from the sitemap settings, if exists.
+    'language' => !empty($sitemap->context['language']) ? $languages[$sitemap->context['language']] : language_default(),
     'alias' => variable_get('xmlsitemap_prefetch_aliases', TRUE),
   );
 
diff --git a/xmlsitemap.xmlsitemap.inc b/xmlsitemap.xmlsitemap.inc
index 46ab406..725ca1e 100644
--- a/xmlsitemap.xmlsitemap.inc
+++ b/xmlsitemap.xmlsitemap.inc
@@ -57,7 +57,12 @@ class XMLSitemapWriter extends XMLWriter {
    * Add the XML stylesheet to the XML page.
    */
   public function writeXSL() {
-    $this->writePi('xml-stylesheet', 'type="text/xsl" href="' . url('sitemap.xsl') . '"');
+    $options = array();
+    if (!empty($sitemap->context['language'])) {
+      $languages = language_list();
+      $options = array('options' => array('language' => $languages[$sitemap->context['language']]));
+    }
+    $this->writePi('xml-stylesheet', 'type="text/xsl" href="' . url('sitemap.xsl', $options) . '"');
     $this->writeRaw(PHP_EOL);
   }
 
