|
Grimoire /
SiteMaps
<?xml version="1.0" encoding="UTF-8"?>
<!--
<DOCTYPE ???? [
<!ENTITY dc "http://purl.org/dc/schemas/2000/06/19-dces.dtd"
]>
-->
<?xml-stylesheet type="text/xsl" href="test.xsl"?> <!-- This has to be within the SAME DOMAIN. -->
<urlset
xmlns = "http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:dc = "http://purl.org/dc/elements/1.1/"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://www.sitemaps.org/schemas/sitemap/0.9"
url = "http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" >
<url>
<loc>http://localhost/</loc>
<dc:title>My Home Page</dc:title>
<dc:description>The main site - For all new users. Information and help.</dc:description>
<lastmod>2006-09-23T10:36:37+00:00</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>http://localhost/page.php</loc>
<dc:title>Another Page</dc:title>
<lastmod>2006-09-23T10:36:37+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
</urlset>
<?xml version="1.0" encoding="UTF-8"?>
<xsl stylesheet
version = "1.0"
xmlns = "http://www.w3.org/1999/xhtml"
xmlns:map = "http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
xmlns:dc = "http://purl.org/dc/elements/1.1/"
exclude-result-prefixes="map dc" >
<xsl:output
method = "xml"
version = "1.1"
doctype-public = "-//W3C//DTD XHTML Basic 1.1//EN"
doctype-system = "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd"
encoding = "UTF-8"
indent = "yes"
media-type = "application/xhtml+xml"/>
<xsl:template match="/">
<html>
<head>
<title>XML Sitemap</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<link rel="start" href="/" title="Home Page" type="text/html" />
<link rel="index" href="/sitemap.xml" title="Site Map" type="application/xhtml+xml" />
<link rel="stylesheet" href="http://manx.biz/xml/sitemap.css" type="text/css" />
</head>
<body>
<h2>My Site Map</h2>
<ul>
<xsl:for-each select="map:urlset/map:url">
<xsl:sort select="dc:title"/>
<li>
<a>
<xsl:attribute name="href"> <!-- or use attribute-set? -->
<xsl:value-of select="map:loc"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="string(dc:title)">
<xsl:value-of select="dc:title"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="map:loc"/>
</xsl:otherwise>
</xsl:choose>
</a><br />
<xsl:value-of select="dc:description"/>
</li>
</xsl:for-each>
</ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
At the moment, the SiteMap is a simple list, alphabetically sorted by page title. However, most sites tend to use a logical layout, grouping similar navigationally-related pages together in a subdirectory. Perhaps it would be nice to present the SiteMap in a similarly organised way ... <...snip...> <div>
<div title="directory-1">
<div title="subdir-a">
<p><a href="http://localhost/index.php">Page Title</a> Page Description.</p>
</div>
</div>
<div title="directory-2">
</div>
<div title="directory-3">
</div>
</div>
|