From ce8f3295a9e4ef132f5353b70398aa7905981af3 Mon Sep 17 00:00:00 2001 From: Antonio Ospite <ao2@ao2.it> Date: Fri, 27 Feb 2015 13:29:32 +0100 Subject: [PATCH] rss_converter_howtoons.com.xsl: make the feed validate with feedvalidator.org Make the Howtoons.com 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. --- rss_converter_howtoons.com.xsl | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/rss_converter_howtoons.com.xsl b/rss_converter_howtoons.com.xsl index 4067065..41939f1 100644 --- a/rss_converter_howtoons.com.xsl +++ b/rss_converter_howtoons.com.xsl @@ -29,7 +29,8 @@ <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:output method="xml" indent="yes"/> @@ -38,13 +39,17 @@ </xsl:variable> <xsl:template match="//div[contains(@id, 'post-')]"> + <xsl:variable name="item-permalink" select=".//div[@class='post-headline']//a/@href"/> <item> <title> <xsl:value-of select="normalize-space(.//div[@class='post-headline']//a)"/> </title> <link> - <xsl:value-of select=".//div[@class='post-headline']//a/@href"/> + <xsl:value-of select="$item-permalink"/> </link> + <guid> + <xsl:value-of select="$item-permalink"/> + </guid> <pubDate> <xsl:variable name="date" select="substring-before(.//div[@class='post-byline'], ',')"/> <!-- date format is MM.DD.YY --> @@ -63,21 +68,29 @@ </xsl:template> <xsl:template match="/"> + <xsl:variable name="channel-title" select="//title"/> + <xsl:variable name="channel-link" select="$BaseURL"/> <rss version="2.0"> <xsl:attribute name="xml:base"><xsl:value-of select="$BaseURL" /></xsl:attribute> <channel> <generator>Tweeper</generator> <title> - <xsl:value-of select="//title"/> + <xsl:value-of select="$channel-title"/> </title> <link> - <xsl:value-of select="$BaseURL"/> + <xsl:value-of select="$channel-link"/> </link> <description> <xsl:text>The world's greatest D.I.Y. comic website! Tools of mass construction!</xsl:text> </description> <image> + <title> + <xsl:value-of select="$channel-title"/> + </title> + <link> + <xsl:value-of select="$channel-link"/> + </link> <url> <xsl:text>http://www.howtoons.com/wp-content/themes/atahualpa/images/header/tuck1000.png</xsl:text> </url> -- 2.1.4