<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
	version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:date="http://exslt.org/dates-and-times"
	xmlns:func="http://exslt.org/functions"
	xmlns:ex="tag:plasmasturm.org,2004:EXSLT-Functions"
	xmlns:html="http://www.w3.org/1999/xhtml"
	xmlns="http://www.w3.org/2005/Atom"
	extension-element-prefixes="date func ex"
	exclude-result-prefixes="date func html ex"
>
<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:include href="exslt-extras.xslt" />

<xsl:template match="html:p[@class='quote']">
	<entry>
		<title><xsl:value-of select="html:a/html:b/node()" /></title>
		<link href="http://bash.org/{ html:a[@title='Permanent link to this quote.']/@href }"/>
		<id>tag:bash.org,2004:<xsl:value-of select="substring-after( html:a/html:b/node(), '#' )" /></id>
		<updated><xsl:value-of select="date:date-time()" /></updated>
		<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><tt>
			<xsl:for-each select="following-sibling::html:p[@class='qt'][1]/text()">
				<xsl:copy-of select="ex:multiple-spaces-to-nbsp( normalize-space( . ) )" />
				<xsl:if test="position() &lt; last()"><br/></xsl:if>
			</xsl:for-each>
		</tt></div></content>
	</entry>
</xsl:template>

<xsl:variable name="source-url" select="'http://bash.org/?latest'" />

<xsl:template match="/">
	<feed>
		<title>bash.org</title>
		<id>tag:bash.org,2004:Latest-Entries</id>
		<logo>http://bash.org/images/logo.png</logo>
		<link href="{$source-url}"/>
		<link rel="self" href="http://plasmasturm.org/feeds/bash-org-latest/"/>
		<updated><xsl:value-of select="date:date-time()" /></updated>
		<author><name>bash.org</name></author>
		<xsl:apply-templates />
	</feed>
</xsl:template>

</xsl:stylesheet>
