[xsl] del.icio.us script

Subject: [xsl] del.icio.us script
From: iwantto keepanon <iwanttokeepanon@xxxxxxxx>
Date: Mon, 18 Jul 2005 04:06:34 +0400 (MSD)
I created an account on del.icio.us and used an import script to copy all of my Opera bookmarks into 
del.icio.us "post"s.  But instead of creating an XML representation in nested folders, it linearized 
all my folders into a string attribute called "tag".
 
I.e. the source structure:
   reference
      css
      javascript
      recipe
         tea
      isbn-books
         health
            fanatics
      colors

became:
   .imported
   .imported reference css
   .imported reference javascript
   .imported reference recipe tea
   .imported reference isbn-books health fanatics
   .imported reference colors

(in various random orders w/ multiple entries for each bookmark).

I already have a script that transforms Opera bookmarks into an HTML page (which is also my homepage), 
but now I wanted a similar one for del.icio.us bookmarks.

But the Muenchian grouping algorithm only seems to work w/1 key and 1 level.  I could create 5 keys 
anticipating a max of 5 levels, but that would require a bunch of if's and hack-ish XSLT programming.

I tried for a while with various bits of success, until I decided to use what I knew about the input 
set.  Which is all @tag(s) had the folder names in the same order and that a space seperated all 
folder names.  The above statement is only true b/c I use the same import script each time I sync my 
bookmarks or if I manually create a post I use care to make the above statement true.  I.e. add a post 
w/ tag name ".imported reference css" and not simply "css".

   Sample output : http://man-page.homelinux.org/~rodney/del.icio.us/bookmarks.html
   Sample input  : http://man-page.homelinux.org/~rodney/del.icio.us/iWantToKeepAnon.xml
   XSLT script   : http://man-page.homelinux.org/~rodney/del.icio.us/xml2html-key.xsl
   actual del.icio.us bookmarks : http://del.icio.us/iWantToKeepAnon/
   import script : http://www.hybernaut.com/bdv/delicious-import.html
      (mine is modified for Opera and skips "private" folders/URLs)

I think this solution is pretty good and I'd like some constructive criticism on how it could be 
better.  Also, I've seen some questions recently about grouping and I'm hoping that somebody else will 
find this useful to their programming.  Let me know, how'd I do?  How could this be better?

BTW, I am using Gnome's LibXSLT and LibXML from http://xmlsoft.org/

-- 
Rodney

Current Thread