Scenario:
RSS Aggregator web part
Points( +/- ):
+ Full XSLT support
+ Data caching support
- Need to edit every time you want to add a new RSS url
- Untested for maximum limit
RSSAggregator.webpart:
<webParts>DataSource section in above it
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.WebPartPages.DataFormWebPart, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="DataSourcesString" type="string">
<%@ Register TagPrefix="sharepoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><sharepoint:AggregateDataSource runat="server" SeparateRoot="" RootName="" RowsName="" ID="merged1"><Sources>
<sharepoint:XmlUrlDataSource runat="server" HttpMethod="GET" SelectCommand="http://feeds.feedburner.com/sandeepnahta" AuthType="None" XPath=""></sharepoint:XmlUrlDataSource>
<sharepoint:XmlUrlDataSource runat="server" HttpMethod="GET" SelectCommand="http://codename-srini.blogspot.com/feeds/posts/default?alt=rss" AuthType="None" XPath=""></sharepoint:XmlUrlDataSource>
</Sources>
<Aggregate>
<concat name="data source"><datasource name="sandeepnahta" id="0" Type="SPXml"/><datasource name="default" id="1" Type="SPXml"/></concat></Aggregate>
</sharepoint:AggregateDataSource>
</property>
<property name="ParameterBindings" type="string">
<ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>
<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
<ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>
</property>
<property name="Xsl" type="string">
<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:agg="http://schemas.microsoft.com/sharepoint/aggregatesource" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:atom10="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xmlns:media="http://search.yahoo.com/mrss/" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:output method="html" indent="no"/>
<xsl:decimal-format NaN=""/>
<xsl:param name="dvt_apos">'</xsl:param>
<xsl:variable name="dvt_1_automode">0</xsl:variable>
<xsl:template match="/">
<xsl:call-template name="dvt_1"/>
</xsl:template>
<xsl:template name="dvt_1">
<xsl:variable name="dvt_StyleName">Table</xsl:variable>
<xsl:variable name="Rows" select="/dsQueryResponse/rss/channel"/>
<table border="0" width="100%" cellpadding="2" cellspacing="0">
<tr valign="top">
<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
<th class="ms-vh" width="1%" nowrap="nowrap"></th>
</xsl:if>
</tr>
<xsl:call-template name="dvt_1.body">
<xsl:with-param name="Rows" select="$Rows"/>
</xsl:call-template>
</table>
</xsl:template>
<xsl:template name="dvt_1.body">
<xsl:param name="Rows"/>
<xsl:for-each select="$Rows">
<xsl:call-template name="dvt_1.rowview"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="dvt_1.rowview">
<tr>
<xsl:if test="position() mod 2 = 1">
<xsl:attribute name="class">ms-alternating</xsl:attribute>
</xsl:if>
<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
<td class="ms-vb" width="1%" nowrap="nowrap">
<span ddwrt:amkeyfield="" ddwrt:amkeyvalue="string($XPath)" ddwrt:ammode="view"></span>
</td>
</xsl:if>
<td class="ms-vb">
<strong><xsl:value-of select="title" /></strong>
<xsl:call-template name="dvt_2" />
</td>
</tr>
</xsl:template>
<xsl:variable name="dvt_2_automode">0</xsl:variable>
<xsl:template name="dvt_2">
<xsl:variable name="dvt_StyleName">RepForm3</xsl:variable>
<xsl:variable name="Rows" select="item" />
<table border="0" width="100%">
<xsl:call-template name="dvt_2.body">
<xsl:with-param name="Rows" select="$Rows" />
</xsl:call-template>
</table>
</xsl:template>
<xsl:template name="dvt_2.body">
<xsl:param name="Rows" />
<xsl:for-each select="$Rows">
<xsl:call-template name="dvt_2.rowview" />
</xsl:for-each>
</xsl:template>
<xsl:template name="dvt_2.rowview">
<tr>
<td>
<table border="0" cellspacing="0" width="100%">
<tr>
<td width="2%" class="ms-vb">
<img alt="rect" src="http://spvm/_layouts/images/rect.gif" />
</td>
<td width="95%" class="ms-vb">
<a href="{link}"><xsl:value-of select="title" /></a></td>
</tr>
<xsl:if test="$dvt_2_automode = '1'" ddwrt:cf_ignore="1">
<tr>
<td colspan="99" class="ms-vb">
<span ddwrt:amkeyfield="" ddwrt:amkeyvalue="string($XPath)" ddwrt:ammode="view"></span>
</td>
</tr>
</xsl:if>
</table>
</td>
</tr></xsl:template>
</xsl:stylesheet>
</property>
<property name="DataFields" type="string">atom:id;lastBuildDate;title;description;link;managingEditor;generator;openSearch:totalResults;openSearch:startIndex;openSearch:itemsPerPage;atom10:link/@rel,atom10:link/rel;atom10:link/@href,atom10:link/href;atom10:link/@type,atom10:link/type;</property>
<property name="Title" type="string">RSS Aggregator</property>
</properties>
</data>
</webPart>
</webParts>
This is the section need to be modified to add more RSS Urls. Below you can see i have used two RSS Urls, replace them with the ones you need.
<property name="DataSourcesString" type="string" >
<%@ Register TagPrefix="sharepoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><sharepoint:AggregateDataSource runat="server" SeparateRoot="" RootName="" RowsName="" ID="merged1"><Sources>
<sharepoint:XmlUrlDataSource runat="server" HttpMethod="GET" SelectCommand="http://feeds.feedburner.com/sandeepnahta" AuthType="None" XPath=""></sharepoint:XmlUrlDataSource>
<sharepoint:XmlUrlDataSource runat="server" HttpMethod="GET" SelectCommand="http://codename-srini.blogspot.com/feeds/posts/default?alt=rss" AuthType="None" XPath=""></sharepoint:XmlUrlDataSource>
</Sources>
<Aggregate>
<concat name="data source"><datasource name="sandeepnahta" id="0" Type="SPXml"/><datasource name="default" id="1" Type="SPXml"/></concat></Aggregate>
</sharepoint:AggregateDataSource>
</property >
0 comments:
Post a Comment