A good solution to display RSS Feeds using XML Web part, so there was no need for some third-party Web Parts. Also there was no need to write any additional code.
- Go to page you need to add the RSS Feed, Open this page in edit view and add new Web Part called XML Web Part.
- If Web Part is added to page then open it’s settings window.
- On the field XML Link insert your blog feed URL. Check out if link is correct and content is receivable by clicking the link titled as Test Link.
- Push button titled as [XSL Editor].
- XSL editing window is opened and now insert XSL code given below. When inserted click [OK].
- You should see the RSS feed as bulleted list.
- Save the edited page.
XSL you need is here. Take it using copy and paste.
With the below code, you will get limited items 5 with Published Date in Green color.
<?xml version="1.0" encoding="UTF-8"?>With the below code, you will get limited items 5 with Published Date in Green color.
<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"/>
<!--venugopalreddy.india@gmail.com-->
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<!--venugopalreddy.india@gmail.com-->
<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"/>
<xsl:variable name="pubDate" select="pubDate"/>
<ul>
<!--<xsl:apply-templates select="item"/>--><!--For All Items-->
<xsl:apply-templates select="item[position() <= 5]"/><!--Limit 5 Items-->
<xsl:apply-templates select="pubDate"/><!-- Published Date of the Items-->
</ul>
</xsl:template>
<xsl:template match="item">
<xsl:variable name="item_link" select="link"/>
<xsl:variable name="item_title" select="description"/>
<xsl:variable name="item_pubDate" select="pubDate"/>
<li>
<a href="{$item_link}" title="{$item_title}" target="_blank">
<b><xsl:value-of select="title"/> </b>
<!-- <font color="green"><xsl:value-of select="pubDate"/></font>--><!-- Date and Time -->
<font color="green"><xsl:value-of select="substring(pubDate,1,16)"/></font> <!-- Date Only -->
</a>
</li>
<li></li>
</xsl:template> </xsl:stylesheet>
<li></li>
</xsl:template> </xsl:stylesheet>