xref: /webtrees/resources/views/modules/sitemap/sitemap-xsl.phtml (revision c82761e34f1c58f6aa906b2ff55fa73a937de867)
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="2.0"
3xmlns:html="http://www.w3.org/TR/REC-html40"
4xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
5xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
6xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
7    <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
8    <xsl:template match="/">
9        <html xmlns="http://www.w3.org/1999/xhtml">
10            <head>
11                <title>XML Sitemap</title>
12                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
13                <link rel="stylesheet" href="<?= asset('css/vendor.css') ?>" />
14            </head>
15            <body>
16                <div class="container">
17                    <h1>XML Sitemap</h1>
18                    <xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) &gt; 0">
19                        <p class="expl">
20                            This XML Sitemap Index file contains <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"/> sitemaps.
21                        </p>
22                        <table class="table table-sm table-bordered table-striped table-hover">
23                            <thead>
24                                <tr>
25                                    <th class="w-75">URL</th>
26                                    <th class="w-25">Updated</th>
27                                </tr>
28                            </thead>
29                            <tbody>
30                                <xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
31                                    <xsl:variable name="sitemapURL">
32                                        <xsl:value-of select="sitemap:loc"/>
33                                    </xsl:variable>
34                                    <tr>
35                                        <td>
36                                            <a href="{$sitemapURL}"><xsl:value-of select="sitemap:loc"/></a>
37                                        </td>
38                                        <td>
39                                            <xsl:value-of select="sitemap:lastmod"/>
40                                        </td>
41                                    </tr>
42                                </xsl:for-each>
43                            </tbody>
44                        </table>
45                    </xsl:if>
46                    <xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) &lt; 1">
47                        <p class="expl">
48                            This XML Sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs.
49                        </p>
50                        <table class="table table-sm table-bordered table-striped table-hover">
51                            <thead>
52                                <tr>
53                                    <th class="w-75">URL</th>
54                                    <th class="w-25">Updated</th>
55                                </tr>
56                            </thead>
57                            <tbody>
58                                <xsl:for-each select="sitemap:urlset/sitemap:url">
59                                    <tr>
60                                        <td>
61                                            <xsl:variable name="itemURL">
62                                                <xsl:value-of select="sitemap:loc"/>
63                                            </xsl:variable>
64                                            <a href="{$itemURL}">
65                                                <xsl:value-of select="sitemap:loc"/>
66                                            </a>
67                                        </td>
68                                        <td>
69                                            <xsl:value-of select="sitemap:lastmod"/>
70                                        </td>
71                                    </tr>
72                                </xsl:for-each>
73                            </tbody>
74                        </table>
75                    </xsl:if>
76                </div>
77            </body>
78        </html>
79    </xsl:template>
80</xsl:stylesheet>
81