<?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="UTF-8" indent="yes"/>
    <xsl:template match="/">
        <html xmlns="http://www.w3.org/1999/xhtml" lang="vi">
            <head>
                <title>XML Sitemap — Hello Doctor (hellodoctors.vn)</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, sans-serif; font-size: 14px; color: #1e293b; background: #f8fafc; margin: 0; padding: 30px 20px; }
                    .container { max-width: 1080px; margin: 0 auto; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 28px; box-shadow: 0 4px 12px rgba(0,0,0,0.04); }
                    h1 { font-size: 22px; color: #0f766e; margin: 0 0 8px 0; }
                    p.desc { color: #475569; margin: 0 0 20px 0; line-height: 1.6; }
                    table { width: 100%; border-collapse: collapse; margin-top: 12px; }
                    th { background: #0f766e; color: #ffffff; text-align: left; padding: 10px 14px; font-size: 13px; }
                    td { padding: 10px 14px; border-bottom: 1px solid #e2e8f0; font-size: 13.5px; }
                    tr:hover td { background: #f0fdfa; }
                    a { color: #0369a1; text-decoration: none; font-weight: 500; }
                    a:hover { text-decoration: underline; }
                </style>
            </head>
            <body>
                <div class="container">
                    <h1>XML Sitemap — Hệ thống Phòng khám Chuyên khoa Hello Doctor</h1>
                    <p class="desc">
                        Chuẩn giao thức Sitemaps.org 0.9 chính thức của <strong><a href="https://hellodoctors.vn">https://hellodoctors.vn</a></strong> phục vụ Googlebot, Bingbot, OAI-SearchBot và các hệ thống chỉ mục y khoa.
                        Xem thêm tài liệu xác thực kỹ thuật tại <a href="https://hellodoctors.vn/chinh-sach-minh-bach-chuyen-mon-y-khoa.html#xac-minh-robots-sitemap-schema">Chính sách Minh bạch Chuyên môn Y khoa &amp; Xác thực Kỹ thuật</a>.
                    </p>
                    <xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) &gt; 0">
                        <p class="desc"><strong>Số lượng Sitemap thành phần:</strong> <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"/></p>
                        <table>
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>URL Sitemap Thành Phần (loc)</th>
                                    <th>Cập nhật gần nhất (lastmod)</th>
                                </tr>
                            </thead>
                            <tbody>
                                <xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
                                    <tr>
                                        <td><xsl:value-of select="position()"/></td>
                                        <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>
                            </tbody>
                        </table>
                    </xsl:if>
                    <xsl:if test="count(sitemap:urlset/sitemap:url) &gt; 0">
                        <p class="desc"><strong>Tổng số URL trong Sitemap này:</strong> <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/></p>
                        <table>
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>URL Trang Đích (loc)</th>
                                    <th>Tần suất (changefreq)</th>
                                    <th>Độ ưu tiên (priority)</th>
                                    <th>Cập nhật (lastmod)</th>
                                </tr>
                            </thead>
                            <tbody>
                                <xsl:for-each select="sitemap:urlset/sitemap:url">
                                    <tr>
                                        <td><xsl:value-of select="position()"/></td>
                                        <td><a href="{sitemap:loc}"><xsl:value-of select="sitemap:loc"/></a></td>
                                        <td><xsl:value-of select="sitemap:changefreq"/></td>
                                        <td><xsl:value-of select="sitemap:priority"/></td>
                                        <td><xsl:value-of select="sitemap:lastmod"/></td>
                                    </tr>
                                </xsl:for-each>
                            </tbody>
                        </table>
                    </xsl:if>
                </div>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>
