<?xml version="1.0" encoding="UTF-8"?>



<xsl:stylesheet version="2.0" 
                xmlns:html="http://www.w3.org/TR/REC-html40"
                xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
  <xsl:output method="html" version="1.0" encoding="iso-8859-1" indent="yes"/>
  
  <!-- Root template -->    
  <xsl:template match="/">
    <html>     
      <head>  
        <title>AutoQuoter Sitemap</title>
        <link href="http://www.google.com/webmasters/sitemaps/docs/sitemaps.css" type="text/css" rel="stylesheet"/>
        <link href="/Content/gss.css" type="text/css" rel="stylesheet"/>
        <script src="/Scripts/gss.js"></script>  
      </head>

      <!-- Store in $fileType if we are in a sitemap or in a siteindex -->
      <xsl:variable name="fileType">
        <xsl:choose>
		  <xsl:when test="//sitemap:url">sitemap</xsl:when>
		  <xsl:otherwise>siteindex</xsl:otherwise>
        </xsl:choose>      
      </xsl:variable>            

      <!-- Body -->
      <body onLoad="initXsl('table0','{$fileType}');">  
            
          <!-- Logo -->
        <a href="/aq/en/Home" id="logo">
            <img src="/aq/Images/logo.png" style="border: none;" alt="Logo"/>
        </a><br/>                      
          
        <!-- Text and table -->
        <h1 id="head1">Google Sitemap</h1>        
        <xsl:choose>
	      <xsl:when test="$fileType='sitemap'"><xsl:call-template name="sitemapTable"/></xsl:when>
	      <xsl:otherwise><xsl:call-template name="siteindexTable"/></xsl:otherwise>
  		</xsl:choose>
          
        <!-- Copyright notice
             &#x0020; means significant space character -->          
        <br/>
        <table class="copyright" id="table_copyright">
          <tr>
            <td>
              <p>Google Sitemaps: ©2005 <a href="http://www.google.com">Google</a>                                   
                 Google Sitemaps Stylesheets: ©2005 <a href="http://www.baccoubonneville.com">Baccou Bonneville</a><br/>
              Contributions: Johannes Müller, SOFTPlus <a href="http://gsitecrawler.com">GSiteCrawler</a> - Tobias Kluge, enarion.net <a href="http://enarion.net/google/phpsitemapng">phpSitemapNG</a></p>
            </td>
          </tr>
        </table>
      </body>
    </html>
  </xsl:template>     

  <!-- siteindexTable template -->
    <xsl:template name="siteindexTable">
        <h2>Number of sitemaps in this Google sitemap index: <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"></xsl:value-of></h2>          
        <div style="clear:both"></div>
        <p class="sml" style="clear:left;">Click on the table headers to change sorting.</p>            
        <table border="1" width="100%" class="data" id="table0">
            <tr class="header">
                <td>Sitemap URL</td>
                <td>Last modification date</td>
            </tr>
            <xsl:apply-templates select="sitemap:sitemapindex/sitemap:sitemap">
                <xsl:sort select="sitemap:lastmod" order="descending"/>              
            </xsl:apply-templates>  
        </table>            
    </xsl:template>  
  
  <!-- sitemapTable template -->  
    <xsl:template name="sitemapTable">
        <h2>Number of URLs in this Google Sitemap: <xsl:value-of select="count(sitemap:urlset/sitemap:url)"></xsl:value-of></h2>          
        <div style="clear:both"></div>
        <p class="sml">Click on the table headers to change sorting.</p>
        <table border="1" width="100%" class="data" id="table0">
	      <tr class="header">
	        <td>Sitemap URL</td>
		    <td>Last modification date</td>
		    <td>Change freq.</td>
		    <td>Priority</td>
	      </tr>
	      <xsl:apply-templates select="sitemap:urlset/sitemap:url">
	        <xsl:sort select="sitemap:priority" order="descending"/>              
	      </xsl:apply-templates>
	    </table>  
  </xsl:template>    
  
  <!-- sitemap:url template -->  
  <xsl:template match="sitemap:url">
    <tr>  
      <td>
        <xsl:variable name="sitemapURL"><xsl:value-of select="sitemap:loc"/></xsl:variable>  
        <a href="{$sitemapURL}" target="_blank" ref="nofollow"><xsl:value-of select="$sitemapURL"></xsl:value-of></a>
      </td>
      <td><xsl:value-of select="sitemap:lastmod"/></td>
      <td><xsl:value-of select="sitemap:changefreq"/></td>
      <td><xsl:value-of select="sitemap:priority"/></td>
    </tr>  
  </xsl:template>
  
  <!-- sitemap:sitemap template -->
  <xsl:template match="sitemap:sitemap">
    <tr>  
      <td>        
        <xsl:variable name="sitemapURL"><xsl:value-of select="sitemap:loc"/></xsl:variable>  
        <a href="{$sitemapURL}"><xsl:value-of select="$sitemapURL"></xsl:value-of></a>
      </td>
      <td><xsl:value-of select="sitemap:lastmod"/></td>
    </tr>  
  </xsl:template>  
  
</xsl:stylesheet>