xref: /webtrees/resources/views/modules/sitemap/sitemap-xsl.phtml (revision 68136c4f6e10efb8b69e797562a7efe2d96fde70)
1<<?php /* Beware short open tags in PHP <8.0 */ ?>?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.min.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>URL</th>
26                                    <th>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>URL</th>
54                                    <th>Priority</th>
55                                    <th>Updated</th>
56                                </tr>
57                            </thead>
58                            <tbody>
59                                <xsl:for-each select="sitemap:urlset/sitemap:url">
60                                    <tr>
61                                        <td>
62                                            <xsl:variable name="itemURL">
63                                                <xsl:value-of select="sitemap:loc"/>
64                                            </xsl:variable>
65                                            <a href="{$itemURL}">
66                                                <xsl:value-of select="sitemap:loc"/>
67                                            </a>
68                                        </td>
69                                        <td>
70                                            <xsl:value-of select="sitemap:priority"/>
71                                        </td>
72                                        <td>
73                                            <xsl:value-of select="sitemap:lastmod"/>
74                                        </td>
75                                    </tr>
76                                </xsl:for-each>
77                            </tbody>
78                        </table>
79                    </xsl:if>
80                </div>
81            </body>
82        </html>
83    </xsl:template>
84</xsl:stylesheet>
85