Make the Twitter feed validate with http://feedvalidator.org and also
improve compatibility by providing a guid and by excluding the weird
xmlns:php namespace in the output.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl"
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl"
- xsl:extension-element-prefixes="php">
+ xsl:extension-element-prefixes="php"
+ exclude-result-prefixes="php">
<xsl:param name="generateEnclosure"/>
<xsl:param name="generateEnclosure"/>
<xsl:template match="//*[@data-item-type='tweet']">
<xsl:variable name="user-name" select=".//div[contains(@class, 'js-stream-tweet')]/@data-screen-name"/>
<xsl:variable name="tweet-text" select=".//p[contains(@class, 'js-tweet-text')]"/>
<xsl:template match="//*[@data-item-type='tweet']">
<xsl:variable name="user-name" select=".//div[contains(@class, 'js-stream-tweet')]/@data-screen-name"/>
<xsl:variable name="tweet-text" select=".//p[contains(@class, 'js-tweet-text')]"/>
+ <xsl:variable name="tweet-permalink" select="concat($twitterBaseURL, .//a[contains(@class, 'js-permalink')]/@href)"/>
<item>
<title>
<xsl:value-of select="concat($user-name, ': ', $tweet-text)"/>
</title>
<link>
<item>
<title>
<xsl:value-of select="concat($user-name, ': ', $tweet-text)"/>
</title>
<link>
- <xsl:value-of select="concat($twitterBaseURL, .//a[contains(@class, 'js-permalink')]/@href)"/>
+ <xsl:value-of select="$tweet-permalink"/>
+ <guid>
+ <xsl:value-of select="$tweet-permalink"/>
+ </guid>
<pubDate>
<xsl:variable name="timestamp" select=".//span[contains(@class, 'js-short-timestamp')]/@data-time"/>
<xsl:value-of select="php:functionString('Tweeper::epoch_to_gmdate', number($timestamp))"/>
<pubDate>
<xsl:variable name="timestamp" select=".//span[contains(@class, 'js-short-timestamp')]/@data-time"/>
<xsl:value-of select="php:functionString('Tweeper::epoch_to_gmdate', number($timestamp))"/>
</xsl:template>
<xsl:template match="/">
</xsl:template>
<xsl:template match="/">
+ <xsl:variable name="channel-title" select="concat('Twitter / ', $screen-name)"/>
+ <xsl:variable name="channel-link" select="//link[@rel='canonical']/@href"/>
<rss version="2.0">
<xsl:attribute name="xml:base"><xsl:value-of select="$twitterBaseURL" /></xsl:attribute>
<channel>
<generator>Tweeper</generator>
<title>
<rss version="2.0">
<xsl:attribute name="xml:base"><xsl:value-of select="$twitterBaseURL" /></xsl:attribute>
<channel>
<generator>Tweeper</generator>
<title>
- <xsl:text>Twitter / </xsl:text><xsl:value-of select="$screen-name"/>
+ <xsl:value-of select="$channel-title"/>
- <xsl:value-of select="//link[@rel='canonical']/@href"/>
+ <xsl:value-of select="$channel-link"/>
</link>
<description>
<xsl:value-of select="//meta[@name='description']/@content"/>
</description>
<image>
</link>
<description>
<xsl:value-of select="//meta[@name='description']/@content"/>
</description>
<image>
+ <title>
+ <xsl:value-of select="$channel-title"/>
+ </title>
+ <link>
+ <xsl:value-of select="$channel-link"/>
+ </link>
<url>
<xsl:value-of select="//a[contains(@class, 'profile-picture media-thumbnail')]/@href"/>
</url>
<url>
<xsl:value-of select="//a[contains(@class, 'profile-picture media-thumbnail')]/@href"/>
</url>