Delicious bookmarks on my home page with XQuery

I've been an on-and-off user of Delicious for some years now.  The other day I came across an article (which I can't find now) by Christian Hellmann ( @codep08) in which he uses Javascript to embed selected Delicious bookmarks in his blog page.  His idea was to mark up the notes part of the bookmark to identify the label for a link. In the page, Javascript retrieves the JSON feed and creates a collection of links by replacing the label with the hyperlink.

I adapted this idea to get links to use on my desktop home page.  I copied Christian's idea so I now have this subset of bookmarks in which the link label is enclosed in curly braces.

Insead of the JSON feed, I use the RSS feed

and process these with an XQuery script. This is running on an EC2 micro-instance I've started playing with:

My first  XQuery script used string functions to construct the HTML links:

declare option exist:serialize "method=xhtml media-type=text/html";
let $tag := request:get-parameter("tag","4blog")
let $feed := doc(concat("",$tag,"?count=50"))
     {for $item in $feed//item
      let $link := $item/link
      let $description := $item/description


I include the generated div in the HTML page using an iframe (blush).

The string functions look rather clumsy so I tried a regexp:

                replace ($description, 
                          concat(" $1 ")



Better I think but the code now depends on an eXist function to convert from string to XML. Why conversion between strings and XML (util:parse() and util:serialize() in eXist ) are not core Path functions I really dont know.

Thanks to Christian, my use of Delicious has been reinvigorated and now that I can re-use the bookmarks I'm more likely to personalise my bookmarks by writing notes.