[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/xmlsitemap/xsl/ -> xmlsitemap.xsl (source)

   1  <?xml version="1.0" encoding="UTF-8"?>
   2  
   3  <!-- Google Sitmaps Stylesheets (GSStylesheets)
   4       Project Home: http://sourceforge.net/projects/gstoolbox
   5       Copyright (c) 2005 Baccou Bonneville SARL (http://www.baccoubonneville.com)
   6       License http://www.gnu.org/copyleft/lesser.html GNU/LGPL -->
   7  
   8  <xsl:stylesheet version="2.0"
   9      xmlns:html="http://www.w3.org/TR/REC-html40"
  10      xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
  11      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  12    <xsl:output method="html" version="1.0" encoding="utf-8" indent="yes"/>
  13    <!-- Root template -->
  14    <xsl:template match="/">
  15      <html>
  16        <head>
  17          <title>Sitemap file</title>
  18          <script type="text/javascript" src="[jquery]"></script>
  19          <script type="text/javascript" src="[jquery-tablesort]"></script>
  20          <script type="text/javascript" src="[xsl-js]"></script>
  21          <link href="[xsl-css]" type="text/css" rel="stylesheet"/>
  22        </head>
  23  
  24        <!-- Store in $fileType if we are in a sitemap or in a siteindex -->
  25        <xsl:variable name="fileType">
  26          <xsl:choose>
  27            <xsl:when test="//sitemap:url">sitemap</xsl:when>
  28            <xsl:otherwise>siteindex</xsl:otherwise>
  29          </xsl:choose>
  30        </xsl:variable>
  31  
  32        <body>
  33          <h1>Sitemap file</h1>
  34          <xsl:choose>
  35            <xsl:when test="$fileType='sitemap'"><xsl:call-template name="sitemapTable"/></xsl:when>
  36            <xsl:otherwise><xsl:call-template name="siteindexTable"/></xsl:otherwise>
  37          </xsl:choose>
  38  
  39          <div id="footer">
  40            <p>Generated by the <a href="http://drupal.org/project/xmlsitemap">Drupal XML sitemap module</a>.</p>
  41          </div>
  42        </body>
  43      </html>
  44    </xsl:template>
  45  
  46    <!-- siteindexTable template -->
  47    <xsl:template name="siteindexTable">
  48      <div id="information">
  49        <p>Number of sitemaps in this index: <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"></xsl:value-of></p>
  50      </div>
  51      <table class="tablesorter siteindex">
  52        <thead>
  53          <tr>
  54            <th>Sitemap URL</th>
  55            <th>Last modification date</th>
  56          </tr>
  57        </thead>
  58        <tbody>
  59          <xsl:apply-templates select="sitemap:sitemapindex/sitemap:sitemap">
  60            <xsl:sort select="sitemap:lastmod" order="descending"/>
  61          </xsl:apply-templates>
  62        </tbody>
  63      </table>
  64    </xsl:template>
  65  
  66    <!-- sitemapTable template -->
  67    <xsl:template name="sitemapTable">
  68      <div id="information">
  69        <p>Number of URLs in this sitemap: <xsl:value-of select="count(sitemap:urlset/sitemap:url)"></xsl:value-of></p>
  70      </div>
  71      <table class="tablesorter sitemap">
  72        <thead>
  73          <tr>
  74            <th>URL location</th>
  75            <th>Last modification date</th>
  76            <th>Change frequency</th>
  77            <th>Priority</th>
  78          </tr>
  79        </thead>
  80        <tbody>
  81          <xsl:apply-templates select="sitemap:urlset/sitemap:url">
  82            <xsl:sort select="sitemap:priority" order="descending"/>
  83          </xsl:apply-templates>
  84        </tbody>
  85      </table>
  86    </xsl:template>
  87  
  88    <!-- sitemap:url template -->
  89    <xsl:template match="sitemap:url">
  90      <tr>
  91        <td>
  92          <xsl:variable name="sitemapURL"><xsl:value-of select="sitemap:loc"/></xsl:variable>
  93          <a href="{$sitemapURL}" ref="nofollow"><xsl:value-of select="$sitemapURL"></xsl:value-of></a>
  94        </td>
  95        <td><xsl:value-of select="sitemap:lastmod"/></td>
  96        <td><xsl:value-of select="sitemap:changefreq"/></td>
  97        <td>
  98          <xsl:choose>
  99            <!-- If priority is not defined, show the default value of 0.5 -->
 100            <xsl:when test="sitemap:priority">
 101              <xsl:value-of select="sitemap:priority"/>
 102            </xsl:when>
 103            <xsl:otherwise>0.5</xsl:otherwise>
 104          </xsl:choose>
 105        </td>
 106      </tr>
 107    </xsl:template>
 108  
 109    <!-- sitemap:sitemap template -->
 110    <xsl:template match="sitemap:sitemap">
 111      <tr>
 112        <td>
 113          <xsl:variable name="sitemapURL"><xsl:value-of select="sitemap:loc"/></xsl:variable>
 114          <a href="{$sitemapURL}"><xsl:value-of select="$sitemapURL"></xsl:value-of></a>
 115        </td>
 116        <td><xsl:value-of select="sitemap:lastmod"/></td>
 117      </tr>
 118    </xsl:template>
 119  </xsl:stylesheet>


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7