|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<xsl:stylesheet |
| 3 | + version="3.0" |
| 4 | + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 5 | + xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" |
| 6 | + > |
| 7 | + <xsl:output method="html" indent="yes" encoding="UTF-8"/> |
| 8 | + <xsl:template match="/"> |
| 9 | +<xsl:message>Powered by <a href="https://www.sitemap.style/">Sitemap Style</a></xsl:message> |
| 10 | + |
| 11 | +<!-- get the hostname from the first url/loc --> |
| 12 | +<xsl:variable name="hostname" select="substring-before(substring-after(/sitemap:urlset/sitemap:url[1]/sitemap:loc, '://'), '/')" /> |
| 13 | + |
| 14 | + <html> |
| 15 | + <head> |
| 16 | + <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| 17 | + <meta name="referrer" content="unsafe-url" /> |
| 18 | + <title>Sitemap for <xsl:value-of select="$hostname"/></title> |
| 19 | + <link rel="stylesheet" href="https://www.sitemap.style/css/water.min.css" /> |
| 20 | + <script> |
| 21 | + window.addEventListener('load', function() { |
| 22 | + var viewPara = document.getElementById("viewpara"); |
| 23 | + viewPara.style.display = "block"; |
| 24 | + var viewLink = document.getElementById("viewlink"); |
| 25 | + viewLink.href = `https://sitemap-viewer.fileformat.info/view.html?url=${encodeURIComponent(window.location.href)}`; |
| 26 | + }); |
| 27 | + </script> |
| 28 | + </head> |
| 29 | + <body> |
| 30 | + <h1>Pages on <xsl:value-of select="$hostname"/></h1> |
| 31 | + |
| 32 | + <p id="viewpara" style="display:none;"> |
| 33 | + <a id="viewlink" href="">View as a tree</a> |
| 34 | + </p> |
| 35 | + |
| 36 | + <ul> |
| 37 | + <xsl:for-each select="sitemap:urlset/sitemap:url"> |
| 38 | + <xsl:variable name="sitemap_loc"><xsl:value-of select="sitemap:loc"/></xsl:variable> |
| 39 | + <xsl:variable name="sitemap_lastmod"><xsl:value-of select="sitemap:lastmod"/></xsl:variable> |
| 40 | + <li> |
| 41 | + <a href="{$sitemap_loc}"><xsl:value-of select="sitemap:loc" /></a> |
| 42 | + <xsl:if test="$sitemap_lastmod!=''"> |
| 43 | + (<xsl:value-of select="sitemap:lastmod" />) |
| 44 | + </xsl:if> |
| 45 | + </li> |
| 46 | + </xsl:for-each> |
| 47 | + </ul> |
| 48 | + <p><xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> pages</p> |
| 49 | + <p><small>Powered by <a href="https://www.sitemap.style/"><img referrerpolicy="origin" src="https://www.sitemap.style/favicon.svg" style="height:1em;padding-right:0.25em;vertical-align:middle;" />Sitemap.Style</a></small></p> |
| 50 | + </body> |
| 51 | + </html> |
| 52 | + </xsl:template> |
| 53 | +</xsl:stylesheet> |
0 commit comments