Created
May 10, 2012 14:42
-
-
Save xpathr/2653558 to your computer and use it in GitHub Desktop.
Sitemap with Date Created by arsebandit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
| <!-- | |
| Sitemap page | |
| Info | |
| Version: 0.5 | |
| Date: 21-02-2011 | |
| Author: arse.bandit | |
| E-mail: info@supaweb.ru | |
| Website: supaweb.ru | |
| About | |
| This page generates sitemap xml based on pages with subpages and custom articles. | |
| Parameters | |
| All you need is to correct your paths in apply-templates in template "sitemap" and | |
| in template "entry" in url/loc section. | |
| In sitemap datasource of custom articles you need to select System Date in Parameter Output section in left bottom. | |
| Usage | |
| copy this file into your sitemap.xsl page | |
| --> | |
| <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/nav/page[not(types/type = 'XML')]" mode="sitemap" /> | |
| <xsl:call-template name="entry" mode="sitemap" > | |
| <xsl:with-param name="sitemapd" select="concat($ds-sitemap-portfolio, ', ')"/> | |
| <xsl:with-param name="i" select="1"/> | |
| </xsl:call-template> | |
| </urlset> | |
| </xsl:template> | |
| <xsl:template match="page" mode="sitemap"> | |
| <url> | |
| <loc> | |
| <xsl:if test="types/type='index'"><xsl:value-of select="$root"/>/</xsl:if> | |
| <xsl:if test="not(types/type)"><xsl:value-of select="$root"/>/<xsl:value-of select="@handle"/>/</xsl:if> | |
| </loc> | |
| </url> | |
| <xsl:if test="page"><xsl:apply-templates select="page" mode="submenu" /></xsl:if> | |
| </xsl:template> | |
| <xsl:template match="page" mode="submenu"> | |
| <url> | |
| <loc><xsl:value-of select="$root"/>/<xsl:value-of select="parent::node()/@handle"/>/<xsl:value-of select="@handle"/>/</loc> | |
| </url> | |
| </xsl:template> | |
| <xsl:template name="entry" mode="sitemap"> | |
| <xsl:param name="sitemapd" /> | |
| <xsl:param name="i"/> | |
| <xsl:if test="string-length(substring-after($sitemapd, ','))"> | |
| <url> | |
| <loc><xsl:value-of select="$root"/>/portfolio/<xsl:value-of select="data/sitemap-portfolio/entry[$i]/group/item/@handle"/>/<xsl:value-of select="data/sitemap-portfolio/entry[$i]/link/@handle"/>/</loc> | |
| <lastmod> | |
| <xsl:value-of select="substring-before($sitemapd, ',')"/> | |
| </lastmod> | |
| <priority>1</priority> | |
| </url> | |
| <xsl:call-template name="entry" mode="sitemap" > | |
| <xsl:with-param name="sitemapd" select="substring-after($sitemapd, ',')"/> | |
| <xsl:with-param name="i" select="$i+1"/> | |
| </xsl:call-template> | |
| </xsl:if> | |
| </xsl:template> | |
| </xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment