tweeper.php: make it clearer that getUrlContents is a static method
[tweeper.git] / rss_converter_howtoons.com.xsl
index 4067065..403b9ac 100644 (file)
@@ -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"/>
 
     </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 -->
@@ -52,7 +57,7 @@
                 <xsl:variable name="day" select="substring($date, 4, 2)"/>
                 <xsl:variable name="year" select="substring($date, 7, 2)"/>
                 <xsl:variable name="iso-date" select="concat('20', $year, '-', $month, '-', $day)"/>
-                <xsl:value-of select="php:functionString('Tweeper::str_to_gmdate', $iso-date)"/>
+                <xsl:value-of select="php:functionString('Tweeper::strToRssDate', $iso-date)"/>
             </pubDate>
             <description>
                 <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
     </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>