Thinking another minute about this... you might need to add a wrapping xml element around the whole thing to avoid having two root elements (one from each rss feed). To do that you should be able to do something like:
Hi Doug, thanks for this. However, the feeds are not static, they come from a list of rss feeds that the user has selected.
I wonder if it's possible to create an xml doc in XSLT, importing nodes from GetXmlDocumentByUrl and storing the result in a variable... then it would be possible to do a xsl:sort
do you know if it's possible to store inline xml in a variable?
<xsl:variable name="rssFeeds">
<container>
<hello></hello>
</container>
</xsl:variable>
I cannot do this at the moment, i get 'To use a result tree fragment in a path expression, first convert it to a
node-set using the msxsl:node-set() function. at
System.Xml.Xsl.Runtime.XsltConvert.EnsureNodeSet...'
It will get a bit more tricky to do it all in xslt but it isn't impossible by any means.
Catch me up on what you've got so far and if there's anything left to resolve. I (or any of a large number of other folks in the community) are happy to help.
This seems to work OK, it was that I didn't use node-set in the correct place.
We have a system wide set of RSS feeds, and users select the ones they want. The RSS feeds are Nodes under Content like anything else and the when the user selects one to subscribe to, the content node id is set into a CSV property of the member profile (just a CSV list of node ids of rss feeds)
So for my next trick, I'm going to attempt to loop through the subscribed rss feeds' node ids in the member type and then pull the url from the content node, then use library:GetXmlDocumentByUrl to get the xml and import it
Hope there's some way to deal with CSV in XSLT :-)
Merge node sets
Hi there, I want to merge to rss feed resultsets, then order them... is this possible with xslt?
<xsl:variable name="rss1" select="umbraco.library:GetXmlDocumentByUrl('http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml')" /><xsl:variable name="rss2" select="umbraco.library:GetXmlDocumentByUrl('http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/uk_politics/rss.xml')" />Ideally I'd like to merge the results, order them by date and then output the first 30 items,
It's the merging bit that I'm struggling with - any suggestions?
thanks
Kris
Off the top of my head (which means I haven't tried this), can you create a union of the feeds with this?
<xsl:variable name="feeds" select="umbraco.library:GetXmlDocumentByUrl('someUrl1') | umbraco.library:GetXmlDocumentByUrl('someUrl2')" />Then you'd have a single variable of everything that you could <xsl:for-each> and <xsl:sort>.
cheers,
doug.
Thinking another minute about this... you might need to add a wrapping xml element around the whole thing to avoid having two root elements (one from each rss feed). To do that you should be able to do something like:
<xsl:variable name="feeds" select="concat('<feeds>', umbraco.library:GetXmlDocumentByUrl() | umbraco.library:GetXmlDocumentByUrl(), '</feeds>')" />Hope these little snippets of ideas help out.
cheers,
doug
Hi Doug, thanks for this. However, the feeds are not static, they come from a list of rss feeds that the user has selected.
I wonder if it's possible to create an xml doc in XSLT, importing nodes from GetXmlDocumentByUrl and storing the result in a variable... then it would be possible to do a xsl:sort
k
do you know if it's possible to store inline xml in a variable?
I cannot do this at the moment, i get 'To use a result tree fragment in a path expression, first convert it to a node-set using the msxsl:node-set() function. at System.Xml.Xsl.Runtime.XsltConvert.EnsureNodeSet...'
oh it's OK, that's my fault that didn't work!
Also might need to use the msxsl:node-set() around the whole thing.
cheers,
doug.
It will get a bit more tricky to do it all in xslt but it isn't impossible by any means.
Catch me up on what you've got so far and if there's anything left to resolve. I (or any of a large number of other folks in the community) are happy to help.
cheers,
doug.
Hi Doug, think I have worked it out...
This seems to work OK, it was that I didn't use node-set in the correct place.
We have a system wide set of RSS feeds, and users select the ones they want. The RSS feeds are Nodes under Content like anything else and the when the user selects one to subscribe to, the content node id is set into a CSV property of the member profile (just a CSV list of node ids of rss feeds)
So for my next trick, I'm going to attempt to loop through the subscribed rss feeds' node ids in the member type and then pull the url from the content node, then use library:GetXmlDocumentByUrl to get the xml and import it
Hope there's some way to deal with CSV in XSLT :-)
Kris
Looks like in theory, I can convert CSV to XML http://forum.umbraco.org/yaf_postst9763_Getting-a-unique-list-from-comma-separated-values-in-xslt.aspx
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.