rss_converter_twitter.com.xsl: set a fall-back channel title
authorAntonio Ospite <ao2@ao2.it>
Fri, 27 Nov 2015 12:46:55 +0000 (13:46 +0100)
committerAntonio Ospite <ao2@ao2.it>
Fri, 27 Nov 2015 12:46:55 +0000 (13:46 +0100)
When there is no screen-name, like for hashtag ans searches pages, use
the main page title as the RSS channel title.

rss_converter_twitter.com.xsl

index 3cded38..82d520c 100644 (file)
     </xsl:template>
 
     <xsl:template match="/">
-        <xsl:variable name="channel-title" select="concat('Twitter / ', $screen-name)"/>
+        <xsl:variable name="channel-title">
+            <xsl:choose>
+                <xsl:when test="$screen-name != ''">
+                    <xsl:value-of select="concat('Twitter / ', $screen-name)"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="concat('Twitter / ', normalize-space(//h1[1]))"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
         <xsl:variable name="channel-link" select="//link[@rel='canonical']/@href"/>
 
         <rss version="2.0">