XForms Everywhere

4/25/2005

XQuery + RSS + Blog rolling + Blogger

Filed under: General — Alessandro Vernet @ 1:46 pm

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:
    <ul>
      {for $i in /rss/channel/item return
        <li><a href=\"{$i/link}\">{string($i/title)}</a></li>
      }
    </ul>
    
  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.

2 Comments »

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

    Comment by Slave01 — 4/27/2005 @ 12:55 am

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

    Comment by Alessandro Vernet — 4/27/2005 @ 7:03 am

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress