Embed the full HTML content of the tweet in the description field
authorAntonio Ospite <ospite@studenti.unina.it>
Sat, 6 Jul 2013 23:22:47 +0000 (01:22 +0200)
committerAntonio Ospite <ospite@studenti.unina.it>
Sun, 7 Jul 2013 09:05:39 +0000 (11:05 +0200)
Use CDATA to embed the exact copy of an element; it is neat and we get
click-able links in the feed reader for free.

twitter_user_timeline2rss.xsl

index b70cd07..6d72ceb 100644 (file)
 
     <xsl:variable name="screen-name" select="//div[@class='profile-card-inner']/@data-screen-name"/>
 
-    <!-- TODO: make URLs hyperlinked (http://www.dpawson.co.uk/xsl/rev2/regex2.html) -->
-    <xsl:template name="tweet" match="//p[@class='js-tweet-text tweet-text']">
-        <xsl:value-of select="$screen-name"/>: <xsl:value-of select=".//p[@class='js-tweet-text tweet-text']"/>
-    </xsl:template>
-
     <xsl:template match="//div[@id='timeline']//ol[@id='stream-items-id']//li[@data-item-type='tweet']">
+        <xsl:variable name="tweet-text" select=".//p[@class='js-tweet-text tweet-text']"/>
         <item>
             <title>
-                <xsl:call-template name="tweet"/>
+                <xsl:value-of select="concat($screen-name, ': ')"/>
+                <xsl:value-of select="$tweet-text"/>
             </title>
             <link>
                 <xsl:value-of select="$twitterBaseURL"/><xsl:value-of select=".//a[@class='details with-icn js-details']/@href"/>
                 <xsl:value-of select="php:functionString('formatDate', .//small[@class='time']//span/@data-time)"/>
             </pubDate>
             <description>
-                <xsl:call-template name="tweet"/>
+                <xsl:value-of select="concat($screen-name, ': ')"/>
+                <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
+                <xsl:copy-of select="$tweet-text/node()"/>
+                <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
             </description>
         </item>
     </xsl:template>