Hello peeps, always having struggled in this area I wonder if anyone can help me with a function I'm trying to perform.
I'm looking to display a list of Facebook page updates on my page. Looking around the forum I've cobbled together the following, which is reading a Feedburner feed of my FB page. Trouble is I cannot grab and display the "entry" node, which when looking at the XML source is present. The only kind of display I can get is if I select the value of all nodes using the * wildcard (included as a test in my XSLT).
<!-- macroparameter with the url of the xmlfeed --> <xsl:variable name="url" select="/macro/url" /> <!-- macroparameter with the number of posts from the xmlfeed to display--> <xsl:variable name="noOfPosts" select="/macro/noOfPosts" />
<xsl:template match="/"> <xsl:if test="$url != ''"> <!-- fetch xmlsource from url - we are unable to use select=document($url) but umbraco has a static function library available in xsl where there exists a method of fetching a xmldocument given an url --> <xsl:variable name="feedxml" select="umbraco.library:GetXmlDocumentByUrl($url)" />
<!-- test to see that I'm getting content from feed --> <xsl:value-of select="$feedxml//*" />
Hi Barney, The best way to debug and check the XML ouput you are retrieving is to ouput the value of your variable storing the XML in a similar way to that you already have done.
Use a copy-of inside a textarea will ouput the XML you are getting.
Hi Barn, Yep I just took a look at the remote XML you are receiving and you are spot on that its to do with namespaces. If you look at the remote XML the first namespace is the RSS Atom namespace which is used for the entry nodes but you can see they have not used a namespace prefix so thats why you are unable to select it with just 'entry'
In your XSLT file at the top add underneath the other namespaces the following:
xmlns:atom="http://www.w3.org/2005/Atom"
And now you will be able to select the entry node like so:
Reading external feedburner xml
Hello peeps, always having struggled in this area I wonder if anyone can help me with a function I'm trying to perform.
I'm looking to display a list of Facebook page updates on my page. Looking around the forum I've cobbled together the following, which is reading a Feedburner feed of my FB page. Trouble is I cannot grab and display the "entry" node, which when looking at the XML source is present. The only kind of display I can get is if I select the value of all nodes using the * wildcard (included as a test in my XSLT).
This is the feed URL: http://feeds.feedburner.com/OfficialSouthEssexCollegesFacebookWall
Here's the present XSLT:
I think I'm out of my depth here so any help would be gratefully received.
Cheers,
Barney
Hi Barney,
The best way to debug and check the XML ouput you are retrieving is to ouput the value of your variable storing the XML in a similar way to that you already have done.
Use a copy-of inside a textarea will ouput the XML you are getting.
This will help to figure out what elements you can select for your loop.
Warren
Hi Wazza,
Ok I've done this and the XML is coming through in the format I was expecting.
Any idea why am I unable to select the <entry> nodes? I feel like all my selectors are correct?
Here's the XML I am receiving: http://dl.dropbox.com/u/20259407/XMLFile.xml
I'm wondering if I'm missing something with name spaces?
Confused.
Thanks as ever mate,
Barney
Hi Barn,
Yep I just took a look at the remote XML you are receiving and you are spot on that its to do with namespaces.
If you look at the remote XML the first namespace is the RSS Atom namespace which is used for the entry nodes but you can see they have not used a namespace prefix so thats why you are unable to select it with just 'entry'
In your XSLT file at the top add underneath the other namespaces the following:
And now you will be able to select the entry node like so:
Ooops forgot to update the value-of select inside the anchor tag to atom:title
That done the ticket!
Thanks mate :)
is working on a reply...