I'm thinking that the problem is with the default namespace (xmlns="http://backend.userland.com/rss2") ... which you'll need to declare in your XSLT - you can give it whatever prefix you like.
Because the RSS has a namespace associated with it at root level, all references to the XML elements will need to reference that namespace. So if you've declared the namespace (as I posted earlier), you'll need to do this...
<xsl:if test="count($feedContent) > 0">
<xsl:for-each select="$feedContent//rss2:item">
Never gets here
</xsl:for-each>
<xsl:if>
Literally prefixing all the elements you need with "rss2:"
I've a very similar issue when trying to parse a feed containing a specific namespace. obs
I've added the namespace in the XSLT and the feed works fine for standard namespace elements such as title and pubdate but as soon as I try to access obs:moredetail I get absolutely nothing.
I've spent a good few hours on this and I'm tearing my hair out.
I can even dump the full XML to a textarea and see the feed but can not access the obs namespace items
Reading feed with broken namespace....
I'm trying to read the following feed http://bit.ly/a68pDu with umbraco.library:GetXmlDocumentByUrl
However the namespace specified in the doc does not seem to be working and therefore the GetXmlDocumentByUrl call fails.
I've not got a response from the sites developers about getting it fixed so need a workaround.
Any ideas?
Thanks, Rich
Hi Rich,
I have just tried to load in the RSS using GetXmlDocumentByUrl and it works fine. However I did a simple quick-n-dirty output:
I'm thinking that the problem is with the default namespace (xmlns="http://backend.userland.com/rss2") ... which you'll need to declare in your XSLT - you can give it whatever prefix you like.
Then you'll need to reference the XML with the namespace prefix. i.e. <xsl:value-of select="rss2:title" />
I can show more examples if you need?
Cheers, Lee.
Hey Lee,
Thanks for looking into it, you're right, the feed does read in however I cannot iterate through the items
Which I assumed was due to the namespace, how would I iterate through the loop using your example?
Many thanks
Rich
Hi Rich,
Because the RSS has a namespace associated with it at root level, all references to the XML elements will need to reference that namespace. So if you've declared the namespace (as I posted earlier), you'll need to do this...
Literally prefixing all the elements you need with "rss2:"
Cheers, Lee.
Lee, you're a genius!
So was the namespace thing a red herring?
The only issue now is trying to read the following value:
As the following causes an error
<xsl:value-of select="rss2:ttrRiderRanking:name"/>
Cheers
Rich
Hi Rich,
Not the "trrRiderRanking" is its own namespace, so will need to be treated separately. Add it to the namespace declarations too.
Then reference any of those elements with the namespace prefix:
Cheers, Lee.
Cheers Lee, you're a star.
Rich
I've a very similar issue when trying to parse a feed containing a specific namespace. obs
I've added the namespace in the XSLT and the feed works fine for standard namespace elements such as title and pubdate but as soon as I try to access obs:moredetail I get absolutely nothing.
I've spent a good few hours on this and I'm tearing my hair out.
I can even dump the full XML to a textarea and see the feed but can not access the obs namespace items
Any thoughts?
DC
Typical. As soon as I post on here I figured it out. The namespace urn was incorrect. I took it from the docs though which were wrong!
is working on a reply...