<?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:ex="tag:plasmasturm.org,2004:EXSLT-Functions"
	xmlns="http://www.w3.org/2005/Atom"
	extension-element-prefixes="date str ex"
	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:variable name="source-url" select="'http://www.theperlreview.com/Interviews/'"/>

<xsl:template match="/html:html/html:body/html:div[@id='main-copy']/html:ul/html:li/html:a">
	<xsl:variable name="filename" select="str:tokenize( @href, '.' )[1]"/>
	<xsl:variable name="date-from-url" select="substring( $filename, string-length( $filename ) - 7 )"/>
	<xsl:variable name="iso-date" select="concat( substring( $date-from-url, 1, 4 ), '-', substring( $date-from-url, 5, 2 ), '-', substring( $date-from-url, 7, 2 ) )"/>
	<entry>
		<id><xsl:value-of select="concat( $source-url, @href )"/></id>
		<title><xsl:value-of select="."/></title>
		<link href="{ concat( $source-url, @href ) }"/>
		<updated><xsl:value-of select="$iso-date" />T12:00:00Z</updated>
	</entry>
</xsl:template>

<xsl:template match="/">
	<feed>
		<title><xsl:value-of select="//html:head/html:title" /></title>
		<id>urn:uuid:fa3eda2a-842f-11da-9fcb-dd680b0526e0</id>
		<link href="{ $source-url }"/>
		<link rel="self" href="http://plasmasturm.org/feeds/tpr-interview/"/>
		<updated><xsl:value-of select="date:date-time()" /></updated>
		<author><name>brian d foy</name></author>
		<xsl:apply-templates/>
	</feed>
</xsl:template>

</xsl:stylesheet>
