<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
	xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
	exclude-result-prefixes="sitemap image">

<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>XML Sitemap - {{SITE_NAME}}</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<style type="text/css">
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:14px;color:#333;background:#f1f1f1;margin:0;padding:20px}
.container{max-width:1200px;margin:0 auto;background:#fff;padding:30px;border-radius:4px;box-shadow:0 1px 3px rgba(0,0,0,.1)}
h1{color:#23282d;font-size:24px;font-weight:600;margin:0 0 10px}
.description{color:#666;margin-bottom:20px}
.stats{background:#f7f7f7;padding:15px;border-radius:4px;margin-bottom:20px}
table{width:100%;border-collapse:collapse;margin-top:20px}
th{background:#0073aa;color:#fff;padding:12px;text-align:left;font-weight:600}
td{padding:10px 12px;border-bottom:1px solid #eee}
tr:hover td{background:#f7f7f7}
a{color:#0073aa;text-decoration:none}
a:hover{text-decoration:underline}
.priority{text-align:center}
.images{color:#666;font-size:12px}
.brand{margin-top:20px;padding-top:20px;border-top:1px solid #eee;color:#666;font-size:12px}
	</style>
</head>
<body>
<div class="container">
	<h1>XML Sitemap</h1>
	<p class="description">This is the XML sitemap for <strong>{{SITE_NAME}}</strong>, generated by Metapilot Smart SEO.</p>

	<xsl:choose>
		<xsl:when test="sitemap:sitemapindex">
			<div class="stats">
				<strong>Sitemap Index:</strong> This index contains <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"/> sitemaps.
			</div>
			<table>
				<tr>
					<th>Sitemap URL</th>
					<th style="width:200px">Last Modified</th>
				</tr>
				<xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
					<tr>
						<td>
							<a href="{sitemap:loc}"><xsl:value-of select="sitemap:loc"/></a>
						</td>
						<td>
							<xsl:value-of select="sitemap:lastmod"/>
						</td>
					</tr>
				</xsl:for-each>
			</table>
		</xsl:when>
		<xsl:otherwise>
			<div class="stats">
				<strong>URL List:</strong> This sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs.
			</div>
			<table>
				<tr>
					<th>URL</th>
					<th style="width:120px">Priority</th>
					<th style="width:120px">Change Freq</th>
					<th style="width:200px">Last Modified</th>
				</tr>
				<xsl:for-each select="sitemap:urlset/sitemap:url">
					<tr>
						<td>
							<a href="{sitemap:loc}"><xsl:value-of select="sitemap:loc"/></a>
							<xsl:if test="count(image:image) &gt; 0">
								<div class="images">
									<xsl:value-of select="count(image:image)"/> image(s)
								</div>
							</xsl:if>
						</td>
						<td class="priority">
							<xsl:value-of select="sitemap:priority"/>
						</td>
						<td>
							<xsl:value-of select="sitemap:changefreq"/>
						</td>
						<td>
							<xsl:value-of select="sitemap:lastmod"/>
						</td>
					</tr>
				</xsl:for-each>
			</table>
		</xsl:otherwise>
	</xsl:choose>

	<p class="brand">Generated by Metapilot Smart SEO for WordPress</p>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
