Monday, April 25, 2005

XQuery + RSS + Blog rolling + Blogger

Consider this:

  • Blogger can host your blog.
  • Blogrolling lets you have an online blog roll, which in short is a list of links to blogs you are watching.
  • XQuery The Web lets you run XQuery on a web page.

If your blog is on Blogger, and your blog roll is on Blogrolling, how can you show your blog roll in your blog? Blogrolling provides an RSS feed for your blog roll, but you cannot write server-side code on Blogger that would pull out data from that RSS feed and generate HTML. However, on Blogger you can include an external script with: <script language="javascript" type="text/javascript" src="http://...">.

That script can be dynamically generated to produce HTML based on the Blogrolling RSS feed. With XQuery The Web, you can do this in a couple of clicks:

  1. Go to XQuery The Web
  2. In the URL field enter the RSS link provided by Blogrolling.
  3. In the XQuery field, enter this query:
      {for $i in /rss/channel/item return
        <li><a href="{$i/link}">{string($i/title)}</a></li>
  4. Select the JavaScript radio button, and run the query.
  5. Copy the generated <script> tag and include it in your blog template where you want your blog roll to appear.

For instance, based on the RSS feed provided by Blogrolling, XQuery The Web generates JavaScript which is included in my personal blog.


  1. There is an error in view description/view source translator page. However good stuff!

  2. Good point. I will fix the links to the source.