<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
    xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<head>
    <title>XML Sitemap — AliothPress</title>
    <style>
        body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; margin: 40px; color: #2d3748; background: #f7fafc; }
        h1 { font-size: 24px; margin-bottom: 8px; }
        p.info { color: #718096; font-size: 14px; margin-bottom: 24px; }
        table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
        th { background: #2d3748; color: white; text-align: left; padding: 12px 16px; font-size: 13px; font-weight: 600; }
        td { padding: 10px 16px; border-bottom: 1px solid #e2e8f0; font-size: 13px; }
        tr:hover td { background: #f0f4ff; }
        a { color: #667eea; text-decoration: none; }
        a:hover { text-decoration: underline; }
        .lang-badge { display: inline-block; padding: 2px 8px; background: #ebf4ff; color: #3182ce; border-radius: 4px; font-size: 11px; margin: 1px; }
        .count { color: #718096; font-size: 14px; }
    </style>
</head>
<body>
    <h1>🗺️ XML Sitemap</h1>
    <p class="info">
        This sitemap is auto-generated by AliothPress.
        <span class="count">Total URLs: <strong><xsl:value-of select="count(sitemap:urlset/sitemap:url)"/></strong></span>
    </p>
    <table>
        <tr>
            <th>URL</th>
            <th>Languages</th>
            <th>Last Modified</th>
            <th>Priority</th>
        </tr>
        <xsl:for-each select="sitemap:urlset/sitemap:url">
        <tr>
            <td><a href="{sitemap:loc}"><xsl:value-of select="sitemap:loc"/></a></td>
            <td>
                <xsl:for-each select="xhtml:link[@rel='alternate']">
                    <xsl:if test="@hreflang != 'x-default'">
                        <span class="lang-badge"><xsl:value-of select="@hreflang"/></span>
                    </xsl:if>
                </xsl:for-each>
            </td>
            <td><xsl:value-of select="sitemap:lastmod"/></td>
            <td><xsl:value-of select="sitemap:priority"/></td>
        </tr>
        </xsl:for-each>
    </table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
