Welcome to Office Zealot Sign in | Join | Help

michael reinhart

Men are from Earth, women are from Earth. Deal with it.
Do it Yourself RSS Aggregator in Windows SharePoint Services

A reader asked me about an entry I wrote a while ago that talks about how to use the built in XML Web Part in SharePoint to display an RSS feed.  Since an upgrade here on OfficeZealot, the resource file links don't work, so I thought I'd update the article.  The method remains the same, I'm just providing the XSL code here.  Here is what you need to do to make it work:

- Add an XML Web Part to a page.
- Edit the XML Web Parts properties
- In the XML Link field, enter the URL of the RSS feed.
- In the XSL Link field, enter the URL of an XSL file that you've written to transform the feed, or alternatively, in the “XSL Editor“, enter the following XSL code (here's what it should look like after you're done):

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="/">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
  <tr>
    <td class="tablebg"><table border="0" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF">
        <tr>
          <td><img src="images/spcacer.gif" width="163" height="1" /></td>
        </tr>
        <tr valign="middle">
          <td><h2>Recent Articles</h2>
          </td>
        </tr>
 <xsl:for-each select="rss/channel/item">
        <tr>
          <td><a href="{link}"><xsl:value-of select="title"/></a></td>
        </tr>
 </xsl:for-each>
        <tr>
          <td><a href="/allarticles.aspx">More...</a></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</xsl:template>
</xsl:stylesheet>

Posted: Tuesday, January 18, 2005 5:49 PM by reinhart

Comments

Anonymous said:

I can't get any RSS to work in my sharepoint site. I tried this, and all I get is "The Web Part has timed out" I'm behind a company firewall (novell border manager), when I test the feed link, the xml file is displayed, but when I link it to the web part - doesn't work.

Any ideas?

You can email me rocky.rapson@af-group.com
# February 4, 2005 9:14 AM

Anonymous said:

Try making an adjustment in the Web.config file for the site, located by default at local_drive:\Inetpub\wwwroot\Web.config. Increase the value of the Timeout attribute for WebPartWorkItem from the default 5000 milliseconds to a higher value—try 15000 or more.

For more details visit the following link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_SP2003_ta/html/sharepoint_amazonwebparts.asp
# February 6, 2005 9:31 PM

Anonymous said:

In relation to your firewall, where are the following things?:

- your SharePoint server
- the RSS feed

Michael
# February 7, 2005 3:19 PM

Anonymous said:

I noticed the above goes to

http://www.w3.org/1999/XSL/Transform

Is it possible to have it running something local and not having to go out here to translate it for my sharepoint server./

RCollins@peds.uab.edu
# July 31, 2005 2:29 PM

Anonymous said:

You can try this XSL to render RSS Feed in a nice format.

Just put a XML Web part, set the RSS Feed source link, and the following XSL and that's all.

====== Begin of XSL =======

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="rss/channel"><style media="all" lang="en" type="text/css">
.ChannelTitle
{
font-family: Verdana;
font-size: 11pt;
font-weight: bold;
width: 500px;
text-align: center;
}
.ArticleEntry
{
border-bottom: 1px dotted lightgrey;
}
.ArticleTitle
{
font-family: Verdana;
font-size: 9pt;
font-weight: bold;
padding-left: 5px;
padding-top: 5px;
padding-bottom: 5px;
}
.ArticleHeader
{
font-family: Verdana;
font-size: 7pt;
padding-left: 5px;
padding-bottom: 2px;
}
.ArticleHeader A:visited
{
text-decoration: none;
}
.ArticleHeader A:link
{
text-decoration: none;
}
.ArticleHeader A:hover
{
text-decoration: underline;
}
.ArticleDescription
{
color: #000000;
font-family: Verdana;
font-size: 9pt;
padding-left: 5px;
padding-top: 5px;
padding-bottom: 5px;
padding-right: 5px;
}
</style><xsl:apply-templates select="item"/></xsl:template><xsl:template match="title">
<div class="ChannelTitle">
<xsl:value-of select="text()"/>
</div>
<br/>
</xsl:template>
<xsl:template match="item"><div class="ArticleEntry"><div class="ArticleTitle"><xsl:value-of select="title"/></div><div class="ArticleHeader"><xsl:value-of select="pubDate"/> - <a href="{link}">View Article</a></div><div class="ArticleDescription"><xsl:value-of disable-output-escaping="yes" select="description"/></div></div><br/></xsl:template></xsl:stylesheet>


====== End of XSL =======

I would like to invite you to see my RSS Feed Aggregator & blog tool:

http://rssfeederdotnet.sourceforge.net/

Also this article which explains RSS, ATOM extensively:
http://www.codeproject.com/smartclient/rssfeeder.asp
# August 12, 2005 4:18 AM

Anonymous said:

That was easy. Created it successfully in 5 minutes!
# April 11, 2006 3:19 PM

Anonymous said:

I've tried to install this RSS feed into our WSS site but have received a nothing but errors.

The first one is that it reports that a "semi colon character was expected".

Various sources on the internet suggest I change the "&" in the URL to "&amp;". I have done this however a new error is reported; "a string literal was expected but no opening quote character was found.

I have copied and pasted your XSL code from above.

I have also tried a shorter URL string but the same errors are reported.

Any ideas how to fix this?

Thanks!
# May 12, 2006 10:51 PM

Anonymous said:

Worked great. I like both code items. I'm now trying to work on an compromise, as I like the "Title" only as in the original post, but I like the style of the code in comments.

I do have the error on "time out". For now, I have copied an RSS.xml file to my server for development and test. For integration, I'll work the problems with accessing through proxy and timeout. If I get an answer (and remember), I'll come back and post a comment. My first step will be to try altering web.config.
# June 12, 2006 4:12 PM

Anonymous said:

I installed this on our corporate intranet very quickly but I'm having a problem. I'm linking to the Google news site and I can view the results from within Frontpage but when I open the page in the brower, a message saying the "web part has timed out" appears.

Any ideas how to fix this?

Thanks.
# August 10, 2006 10:19 PM

SharePoint, SharePoint and stuff said:

Artikelserie zum Records Center RecCenter Part 1 - Using the MOSS Records Center RecCenter Part 2 - Records

# May 2, 2007 5:17 AM

SharePoint, SharePoint and stuff said:

Artikelserie zum Records Center RecCenter Part 1 - Using the MOSS Records Center RecCenter Part 2 - Records

# May 2, 2007 5:19 AM
Anonymous comments are disabled