| 
                                                                            
                                                                                Chunda
                                                                            - 
                                                                                7/29/2008 12:04:18 PM
                                                                            
                                                                         
                                                                        RE:Webpart for external RSS display 
                                                                            Thanks,
 I made a small webpart that can be used for this purpose over the weekend. See below:
 
 RSSFeed.ascx:
 
 %@ Control Language="VB" AutoEventWireup="false" CodeFile="RSSFeed.ascx.vb" Inherits="CMSWebParts_MyWebParts_RSSFeed" %>
 
 <asp:Label ID="RssFeed" runat="server">
 </asp:Label>
 
 RSSFeed.ascx.vb:
 
 Imports CMS.PortalControls
 Imports CMS.GlobalHelper
 Imports CMS.TreeEngine
 Imports CMS.CMSHelper
 Imports CMS.ExtendedControls
 Imports System.Xml
 Imports System.Xml.Xsl
 
 ' Control to allow and RSS feed to be displayed and transformed
 '
 ' PAH 27/07/2008 First version
 '
 
 Partial Class CMSWebParts_MyWebParts_RSSFeed
 Inherits CMSAbstractWebPart
 
 Private Sub OutputRSS(ByVal RSSUrl As String, ByVal TransformUrl As String)
 Dim _xmlDocument As XmlDocument
 Dim _xmlOutput As XmlDocument
 Dim _xmlReader As XmlReader
 Dim _xslTransform As XslTransform
 
 Try
 _xmlDocument = New XmlDocument()
 _xmlOutput = New XmlDocument()
 _xslTransform = New XslTransform()
 
 _xmlDocument.Load(RSSUrl)
 _xslTransform.Load(TransformUrl)
 
 _xmlReader = _xslTransform.Transform(_xmlDocument, New XsltArgumentList())
 _xmlOutput.Load(_xmlReader)
 
 RssFeed.Text = _xmlOutput.OuterXml
 Catch
 RssFeed.Text = "<p>Feed is currently unavailble.</p>"
 End Try
 End Sub
 
 ' Read RSS, transform and output result when placeholder control is rendered
 Protected Sub RssFeed_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RssFeed.PreRender
 OutputRSS(CType(PartInstance.GetValue("RssUrl"), String), CType(PartInstance.GetValue("TransformUrl"), String))
 End Sub
 End Class
 
 Web part just uses the two properties RssUrl and TranformUrl and applies the XSLT transform to the feed to convert the data. A bit of googling founds some XSLT examples to format the RSS feeds as required.
 
 If you can see any issues with this let me know.
 
 Maybe for the next release it might be a useful webpart to consider.
 
 Thanks
 Paul
 
                                                                            
                                                                         
 
                                                                            
                                                                            
                                                                            
                                                                            
                                                                            
                                                                         
                                                                            
                                                                            
                                                                            
                                                                            
                                                                         
                                                                         |