From 8a6c65c179aa213368c9941da4dd47faf043b236 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Sun, 15 May 2016 15:52:10 +0200 Subject: [PATCH 1/1] rss_converter_facebook.com.xsl: fix getting the item description Hopefully this is a more stable way to get just the useful content of a story skipping the header and the footer. --- rss_converter_facebook.com.xsl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/rss_converter_facebook.com.xsl b/rss_converter_facebook.com.xsl index 347f1e4..984d12c 100644 --- a/rss_converter_facebook.com.xsl +++ b/rss_converter_facebook.com.xsl @@ -54,14 +54,16 @@ - + + + - <xsl:variable name="item-title" select="$item-content/p"/> + <xsl:variable name="item-title" select="$item-content//p"/> <xsl:variable name="title-length" select="140"/> <!-- ellipsize, inspired from http://stackoverflow.com/questions/13622338 --> <xsl:choose> @@ -86,9 +88,17 @@ <xsl:value-of select="php:functionString('Tweeper::epoch_to_gmdate', number($timestamp))"/> </pubDate> <description> + + <!-- + Get only the children starting from the one with class="userContent", + this way the content header is skipped + --> + <xsl:variable + name="usercontent-position" + select="count($item-content/div[contains(@class, 'userContent')]/preceding-sibling::*) + 1"/> + <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text> - <xsl:copy-of select="$item-content/node()"/> - <xsl:copy-of select=".//div[@class='mtm']/node()"/> + <xsl:copy-of select="$item-content/div[position() >= $usercontent-position]"/> <xsl:text disable-output-escaping="yes">]]></xsl:text> </description> </item> -- 2.1.4