Friday, July 25, 2008

Using RSS and XML Web Part

I really like the XML Web Part because of its simplicity - take an XML data source, apply XSLT and have it pretty much whatever you want.

I was recently asked to create a jump-to-list-item dropdown box so that you could place the web part on any page and a user could select an item from that list from a dropdown and it would take them to the list item. Here are the steps that it took to create this using the out of the box XML Web Part.

  1. Turn on anonymous access on your list (here's how to do it)
  2. RSS Enable your list and then view the RSS Feed (you can do this through the list's Action menu)
  3. Place an XML Web Part on your page
  4. Modify the settings of the XML web part by pasting your RSS Feed URL into the webpart's XML Source attribute.
  5. Open the XSLT editor and place the following code:

    <?xml version="1.0"?>

    <xsl:stylesheet xmlns:xsl="" version="1.0">

    <xsl:template match="/">

    <select id="jumpDD">

    <xsl:for-each select="rss/channel/item">

    <xsl:attribute name="value">
    <xsl:value-of select="link"/>

    <xsl:value-of select="title"/>


    <input class='webPartJump' onclick="window.location.href=jumpDD.options[jumpDD.selectedIndex].value;" onfocus="this.blur()" type="button" value="Go" />


  6. *Optional: I did this for a Wiki Page Library so I wanted the wiki page to open directly instead of opening the item (which contained the page). In the RSS Settings for the list you can specify to open the document directly instead of going to the item.
There are tons of options with the XML Web Part. (I just wish you could use OWSSVR.dll to provide list XML for you, but sadly I don't think the XML Web Part will pass credentials).

...sounds like a project for the future...

No comments:

Restoring a lot of files from the Recycle Bin

I had a customer who accidentally synched a (very large) SP Online library and then decided they didn't want the files on their PC anymo...