Dec 11, 2011

RSS Feeds WebPart

In this post we will see how to create RSS feeds web part for SharePoint. it is very easy and we will learn it in the following steps.
1. Add a XML web part to a share point page where you want to add the RSS Feeds web part.
2. Edit the properties of the web part.
3. In the XSL editor place the code (given below).
4. In the XML link give the proper RSS feeds URL.
5. Click Save.
6. This will display the RSS feeds from the URL linked in the web part.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsl">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<div>
<xsl:apply-templates select="rss/channel"/>
</div>
</xsl:template>
<xsl:template match="rss/channel">
<xsl:variable name="link" select="link"/>
<xsl:variable name="description" select="description"/>
<ul><xsl:apply-templates select="item"/></ul>
</xsl:template>
<xsl:template match="item">
<xsl:variable name="item_link" select="link"/>
<xsl:variable name="item_title" select="description"/>
<xsl:if test="position() &lt; 6">
<li>
 <a href="{$item_link}" title="{$item_title}"><xsl:value-of select="title"/></a>
 </li>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

0 comments:

Post a Comment

Dear Readers,

I LOVE to hear from you! Your feedback is always appreciated. I will try to reply to your query as soon as possible.

1. Make sure to click the "Notify me" check box at the right side to be notified of follow up comments and replies.
2. Please Do Not Spam - Spam comments will be deleted immediately upon review.