<?xml version="1.0" encoding="utf-8"?>
<!-- Written by Aristotle Pagaltzis -->
<!-- This code is in the public domain -->
<xsl:stylesheet
	version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:date="http://exslt.org/dates-and-times"
	xmlns:html="http://www.w3.org/1999/xhtml"
	xmlns="http://www.w3.org/2005/Atom"
	extension-element-prefixes="date"
	exclude-result-prefixes="date html"
>
<xsl:output method="xml" indent="no" encoding="utf-8" />
<xsl:strip-space elements="*" />

<xsl:template match="node()|@*">
	<xsl:apply-templates select="node()|@*"/>
</xsl:template>

<xsl:template match="html:tr[html:td/@class='newsdate']">
	<xsl:variable name="notice" select="following-sibling::html:tr[1]/html:td[2]"/>
	<xsl:variable name="date" select="translate( html:td[1], '[]', '' )"/>
	<entry>
		<title><xsl:value-of select="html:td[2]/html:a" /><xsl:text> </xsl:text><xsl:value-of select="substring-before( $notice/text()[1], ')' )" />) — <xsl:value-of select="substring( html:td[2]/text()[2], 4 )" /></title>
		<id>tag:plasmasturm.org,2005:Scraped-Feed:Vim-Script-<xsl:value-of select="concat(
			substring-after( html:td[2]/html:a/@href, 'script_id=' ),
			':', 
			date:seconds( $date )
		)" /></id>
		<link href="http://www.vim.org/scripts/{ html:td[2]/html:a/@href }"/>
		<author><name><xsl:value-of select="$notice/html:i" /></name></author>
		<updated><xsl:value-of select="$date" />T12:00:00Z</updated>
		<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
			<p>
				<xsl:variable name="comment" select="substring-after( $notice/text()[1], ') ' )" />
				<xsl:value-of select="substring( $comment, 1, string-length( $comment ) - 3 )" />
			</p>
		</div></content>
	</entry>
</xsl:template>

<xsl:variable name="source-url" select="'http://www.vim.org/scripts/'" />

<xsl:template match="/">
	<feed>
		<title>vim online: scripts</title>
		<id>tag:vim.org,2000:Scripts</id>
		<link href="{$source-url}"/>
		<link rel="self" href="http://plasmasturm.org/feeds/vimscripts/"/>
		<updated><xsl:value-of select="date:date-time()" /></updated>
		<xsl:apply-templates />
	</feed>
</xsl:template>

</xsl:stylesheet>
