Aggregate RSS from SharePoint
Aggregating RSS from SharePoint is actually fairly simple, you just need an XSLT stylesheet to style the XML to the HTML that you want.
- Add an XML Web Part (ships with SharePoint) to your page
- Once added, click the “open the tool pane in editor” link in the newly added web part.
- In the XML Link text box, enter the URL for the RSS feed. For instance, https://blogs.xmladvice.com/MainFeed.aspx.
- Click the XSL Editor button to open a new window to enter the XSLT markup in. Here is an example that mimics the look of ScottW's .Text main feed:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl=“https://www.w3.org/1999/XSL/Transform“>
<xsl:output method="html"/>
<xsl:template match="/">
<style>
#main
{
font-family:Trebuchet MS;
background-color : White;
border : 1px solid #666;
font-size : 0.85em;
}
a
{
color:blue;
text-decoration:none;
}
a:hover
{
color:brown;
text-decoration:underline;
}
#main h2
{
margin : 0px;
background-color : #B6C9E7;
padding : 3px;
border-bottom : 1px solid #666;
font-family : Verdana;
font-size : 0.8em;
text-transform: uppercase;
}
#main h3
{
font-family : Verdana;
background-color : #E5EEF7;
padding : 2px;
border-top : 1px solid #666;
border-bottom : 1px dashed #666;
padding-left : 10p
}
#main .byline
{
border-top: 1px dashed #666;
}
.postTitle a
{
color:black;
}
.postTitle a:hover
{
color:black;
text-decoration:none;
}
</style>
<xsl:apply-templates select="rss"/>
</xsl:template>
<xsl:template match="rss">
<div style="font-family:Tahoma" id="main">
<xsl:apply-templates select="channel"/>
</div>
</xsl:template>
<xsl:template match="channel">
<h1>
<xsl:value-of select="title"/>
</h1>
<h2>
<a href="{link}" target="_blank" title="{description}">
<xsl:value-of select="description"/>
</a>
</h2>
<xsl:apply-templates select="item"/>
</xsl:template>
<xsl:template match="item">
<h3 class="postTitle">
<a href="{link}" target="_blank" title="{title}">
<xsl:value-of select="title"/>
</a>
</h3>
<div>
<span>
<xsl:value-of select="description" disable-output-escaping="yes"/>
</span>
</div>
<div class="byline">
<span>
<xsl:text>Posted </xsl:text>
<xsl:value-of select="pubDate"/>
<xsl:text> @ </xsl:text>
<a href="{source/@url}" name="source">
<xsl:value-of select="source"/>
</a>
</span>
</div>
</xsl:template>
</xsl:stylesheet>
Comments
- Anonymous
March 05, 2004
or use a web part like feedreader :-) - Anonymous
March 05, 2004
Kirk Allen has provided an XSLT stylesheet to transform an RSS feed in a SharePoint XML Web Part ... - Anonymous
March 05, 2004
See http://playground.doesntexist.org for a couple of XSLT stylesheets released a couple of days ago doing exactly the same.