Skip to content

Instantly share code, notes, and snippets.

@carsten
Created May 4, 2009 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carsten/106555 to your computer and use it in GitHub Desktop.
Save carsten/106555 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="no" />
<xsl:template match="/">
<xsl:call-template name="sitemap" />
</xsl:template>
<xsl:template name="sitemap">
<urlset>
<xsl:attribute name="xmlns">http://www.sitemaps.org/schemas/sitemap/0.9</xsl:attribute>
<xsl:apply-templates select="/data/navigation/page[not(types/type = 'hidden') and not(types/type = 'admin')]" mode="sitemap" />
</urlset>
</xsl:template>
<xsl:template match="page" mode="sitemap">
<xsl:param name="root" select="$root" />
<url>
<loc><xsl:value-of select="concat($root, '/', @handle, '/')" /></loc>
</url>
<xsl:apply-templates select="page[not(types/type = 'hidden') and not(types/type = 'admin')]" mode="sitemap">
<xsl:with-param name="root" select="concat($root, '/', @handle)" />
</xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment