Search

In this dastardly RSS feed from spit Facebook, there is escaped html content within it's description node like so:

<description>Daftar issue nb 3 is out !&lt;br /&gt; a very nice initiative by Leo Burnett Jordan&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.facebook.com/photo.php?fbid=364831863597596&amp;amp;set=a.277739968973453.65413.277738368973613&amp;amp;type=1" id="" title="" target="" onclick="" style=""&gt;&lt;img class="img" src="https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash3/548169_364831863597596_312447032_s.jpg" alt="" /&gt;&lt;/a&gt;&lt;br/&gt;&lt;a href="http://www.facebook.com/media/set/?set=a.277739968973453.65413.277738368973613&amp;amp;type=3" id="" target="" style=""&gt;Wall Photos&lt;/a&gt;&lt;br/&gt;DAFTAR ISSUE 3 &amp;quot;TViolate&amp;quot; IS FINALLY OUT! Read the issue on http://daftar-tajreebi.com&lt;br /&gt; &lt;br /&gt; This comes of late since we were faced with some technical issues and then we revised our next issue&amp;#039;s theme according to the current events in Jordan!&lt;br /&gt; &lt;br /&gt; Do you sense the censors? Yes, we&amp;#039;re talking about it. It&amp;#039;s about time. Dish in your works for Daftar&amp;#039;s 4th Issue under the theme &amp;quot;over my dead censor&amp;quot; where we are tossing and turning thoughts, opinions, freedom of speech and most importantly censorship&lt;br /&gt; &lt;br /&gt; WRITERS &amp;amp; PHOTOGRAPHERS WELCOME TO SHARE THEIR SUBMISSIONS.&lt;br /&gt; &lt;br /&gt; Do with it whatever you please as long as we get good quality JPEGs / ai / TIFF / PNG / GIF / RTF to be part of the issue&lt;br /&gt; &lt;br /&gt; To submit the work for Issue 4 - over my dead censor:&lt;br /&gt; &amp;gt; Visit www.daftar-tajreebi.com&lt;br /&gt; &amp;gt; Go through the current issue (Read Issue 3)&lt;br /&gt; &amp;gt; Submit your stuff through the submissions page&lt;br /&gt; &amp;gt; In case it didn&amp;#039;t work, send your material to daftar.mag&amp;#064;gmail.com&lt;br /&gt; &lt;br /&gt; Our brilliant illustration for the 4th issue&amp;#039;s invitation is done by the ever so talented, Rami Afifi.</description>

This is a pain, and I need to output it as actual html using xslt templates. I tried the following, as suggested by a Stack Overflow answer, but to no avail:

<xsl:template match="*" mode="unescape">
    <xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:template>

I'm passing the description node in to it, and it does un-escape the special characters, but not output html.

I've even tried to run the output of that template through exslt:node-set() to get nodes back from it, but that too doesn't work.

Has anyone actually done this before? Can anyone help? I've been Googling and racking my brains for hours on this.

I've tried this just using disable-output-escaping="yes" works for me. This is what I get back:

Escaped Result Content Screenshot

I chucked your example content into a static DS, and did a direct selection:

<xsl:value-of select="/data/static/description" disable-output-escaping="yes" />
Attachments:
escaped-content.png

@designermonkey: FB's RSS feeds are complete crap.

  • Often they are invalid XML (which means that you will have to to really bad stuff like string operations in order to make them parseable).
  • They change without notice, which will break everything every once in a while.

I suggest to use the (JSON) Graph API. It works much better.

So it looks like what I'm trying to achieve is impossible. A string is a string, a node is a node, you can't change them.

What I needed to do was create a node tree out of the un-escaped output, and then pass that through Rowan's truncate utility. Not possible.

Will have to parse the RSS feed via a PHP script first to have 'actual' xml.

Michael, I havent got the time available on the project to add the oAuth stuff needed for the Graph API. I also have deleted my Facebook, so couldn't develop it anyway.

I hate Facebook.

I've made a little proxy script to pull all that I need from the rss feed and output it as xml so it is parsed correctly. Problem is that the Dynamic Datasource is ignoring any CDATA tags in the source, and escaping all the html again.

I think by the looks of it that the problem lies within the Dynamic Datasource code somewhere. I would expect my feed to be exactly as it is passed in, not modified before output.

Can anyone confirm this?

Dunno if I'm barking up the wrong node tree but when parsing a kml on a live site I had to double up on cdata tags but not on my local site. Something weird about the xslt part of the php install on that hosting company. It was closing the tag early which was naughty. Two nested cdata tags became one proper tag when I tried that. Had to do the inline escape on the closing tag of one with the ampersand Lt semicolon.

I know its not right but it worked.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details