Friday, October 24, 2014

RSS feed is not working in Chrome browser.




Chrome browser does not support RSS feed while working with Mozila and IE. When I want to open RSS feed in Chrome browser, it shows in XML format.when I applied XSL with RSS file, it was working fine.




I have copied here sample XML file and XSL as well. Need to put in same folder and host at IIS and try to access rssfeeds.xml at chrome browser.

File Name - rssfeeds.xml (.rss can also be as extension of this)

<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="rss.xsl" type="text/xsl" media="screen"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">

  <channel>
    <title>xyz Updates</title>
    <link>http://www.xyz.com/</link>
    <description>xyz Updates</description>
    <language>en-us</language>
    <pubDate>26 Nov 2013 21:29:00 CST</pubDate>
    <lastBuildDate>26 Nov 20013 20:00:00 CST</lastBuildDate>
    <docs>http://xyz.com</docs>
    <generator>Weblog Editor 2.0</generator>
    <managingEditor>admin@xyz.com (WEBSITE Webmaster)</managingEditor>
    <webMaster>admin@xyz.com (WEBSITE Webmaster)</webMaster>
    <atom:link href="http://www.xyz.com" rel="self" type="application/rss+xml" />

    <item>
      <title>xyz</title>
      <link>http://www.xyz.com</link>
      <description>Connecting Homeowners to Contractors</description>
      <pubDate>26 Nov 2013 21:05:00 CST</pubDate>
      <guid>http://www.xyz.com</guid>
    </item>
    <item>
      <title>Find a pro in Vancouver</title>
      <link>http://www.xyz.com/city/vancouver</link>
      <description>Connecting Homeowners to Contractors</description>
      <pubDate>26 Nov 2013 21:05:00 CST</pubDate>
      <guid>http://www.xyz.com/city/vancouver</guid>
    </item>
  </channel>
</rss>

--------------------------------------------------------------------------------------------
File Name - rss.xsl



<?xml version="1.0"?>


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wfw="http://wellformedweb.org/CommentAPI/">
 <xsl:output method="html"/>
 <xsl:template match="/">
 <xsl:apply-templates select="/rss/channel"/>
 </xsl:template>
 <xsl:template match="/rss/channel">
 <div>
 <h3><xsl:value-of select="title"/></h3>
   <br/>
 <p><xsl:value-of select="description"/></p>
   <br/>
   <br/>
 </div>
 <div>
 <xsl:apply-templates select="item"/>
 </div>
 </xsl:template>
 <xsl:template match="/rss/channel/item">
 <div>
 <a href="{link}" rel="bookmark"><xsl:value-of select="title"/></a>
   <br/>
   <br/>
 <xsl:value-of select="description"/>
   <br/>
 </div>
 </xsl:template>

<xsl:output method="html"
            encoding="UTF-8"
            indent="no"/>
</xsl:stylesheet>


No comments:

Post a Comment