<?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:str="http://exslt.org/strings"
	xmlns:html="http://www.w3.org/1999/xhtml"
	xmlns="http://www.w3.org/2005/Atom"
	extension-element-prefixes="date str"
	exclude-result-prefixes="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:td[@class='sub']/html:table/html:tr[ count( html:td[@class='klein'] ) > 1 ]">
	<xsl:variable name="date">
		<xsl:variable name="component" select="str:tokenize( normalize-space( html:td[@class='klein'][1] ), '.' )" />
		<xsl:variable name="as-string">
			<xsl:choose>
				<xsl:when test="$component[3] &gt; 90">19</xsl:when>
				<xsl:otherwise>20</xsl:otherwise>
			</xsl:choose>
			<xsl:value-of select="concat( $component[3], '-', $component[2], '-', $component[1] )" />
		</xsl:variable>
		<xsl:value-of select="date:date( $as-string )" />
	</xsl:variable>
	<xsl:variable name="title" select="normalize-space( html:td[@class='klein'][2]/html:a/text() )" />
	<entry>
		<title><xsl:value-of select="$title" /></title>
		<link rel="enclosure" type="audio/x-pn-realaudio" href="{ substring-before( substring-after( html:td[@class='klein'][2]/html:a/@href, &quot;'&quot; ), &quot;'&quot; ) }" title="{ $title }"/>
		<id>tag:plasmasturm.org,2005:Scraped-Feed:Alpha-Centauri:<xsl:value-of select="$date" /></id>
		<updated><xsl:value-of select="$date" />T12:00:00Z</updated>
	</entry>
</xsl:template>

<xsl:variable name="source-url" select="'http://www.br-online.de/alpha/centauri/'" />

<xsl:template match="/">
	<feed>
		<title>Alpha Centauri</title>
		<icon>http://www.br-online.de/favicon.ico</icon>
		<id>urn:uuid:f226bd22-61e7-11da-9fcb-dd680b0526e0</id>
		<link href="{$source-url}"/>
		<link rel="self" href="http://plasmasturm.org/feeds/alpha-centauri/"/>
		<updated><xsl:value-of select="date:date-time()" /></updated>
		<author><name>BR Online</name></author>
		<xsl:apply-templates />
	</feed>
</xsl:template>

</xsl:stylesheet>
