Sunday 19 February 2012

Insert Rss feed items using the WLW XsltPlugin

Choose an rss feed address. For the sake of this example we are choosing the rss feed of Mashable(http://feeds.mashable.com/Mashable). Now using a text editor copy and paste the following piece of xslt into a file and save it as ie. rsslinks.xslt:

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" 
                xmlns:xsl=http://www.w3.org/1999/XSL/Transform >
    
  <xsl:output method="html"/>
  
  <xsl:template match="/">
    <div class="">
      <xsl:call-template name="uList"/>      
    </div>
  </xsl:template>

  <xsl:template name="uList">
    <h6 class="">
      <xsl:value-of select="rss/channel/title"/>
    </h6>
    <ul>
      <xsl:for-each select="rss/channel/item">
        <li class="">
          <a class="" href="{link}">
             <xsl:value-of select="title"/>
          </a>
        </li>
      </xsl:for-each>
    </ul>
  </xsl:template>
</xsl:stylesheet> 

This is just a piece of xslt that transforms rss feed items into a list of links.

Now using the Windows Live Writer, select your post and choose to insert the XsltPlugin. Click on the ellipsis to select the xml. In the dialog opened set the “File Name” to the rss feed address ie. http://feeds.mashable.com/Mashable and click “Open” button. Now click the ellipsis to select the xslt and browse to your saved xslt file ie. rsslinks.xslt and click “Open”. Click the “Insert” button of the XsltPlugin to insert the content. You should see a list of the feed links like below

Mashable!

No comments:

Post a Comment