You are here

function xmlsitemap_output_xsl in XML sitemap 6

Same name and namespace in other branches
  1. 6.2 xmlsitemap.pages.inc \xmlsitemap_output_xsl()
  2. 7.2 xmlsitemap.pages.inc \xmlsitemap_output_xsl()

Output an XML transformation file for the sitemap XML.

1 string reference to 'xmlsitemap_output_xsl'
xmlsitemap_menu in ./xmlsitemap.module
Implementation of hook_menu().

File

./xmlsitemap.pages.inc, line 274
XML sitemap page callbacks.

Code

function xmlsitemap_output_xsl() {

  // Read the XSL content from the file.
  $module_path = drupal_get_path('module', 'xmlsitemap');
  $xsl_content = file_get_contents($module_path . '/gss/gss.xsl');

  // Make sure the strings in the XSL content are translated properly.
  $replacements = array(
    'Sitemap file' => t('Sitemap file'),
    'Number of sitemaps in this index' => t('Number of sitemaps in this index'),
    'Click on the table headers to change sorting.' => t('Click on the table headers to change sorting.'),
    'Sitemap URL' => t('Sitemap URL'),
    'Last modification date' => t('Last modification date'),
    'Number of URLs in this sitemap' => t('Number of URLs in this sitemap'),
    'URL location' => t('URL location'),
    'Change frequency' => t('Change frequency'),
    'Priority' => t('Priority'),
    '[jquery]' => base_path() . 'misc/jquery.js',
    '[xsl-js]' => base_path() . $module_path . '/gss/gss.js',
    '[xsl-css]' => base_path() . $module_path . '/gss/gss.css',
  );
  $xsl_content = strtr($xsl_content, $replacements);

  // Output the XSL content.
  drupal_set_header('Content-type: application/xml; charset=utf-8');
  drupal_set_header('X-Robots-Tag: noindex, follow');
  echo $xsl_content;
}