Change Images with XML

Hi,
I’m looking at this tutorial http://www.kirupa.com/web/xml/examples/mx04ASclasses.htm and love the functionality that you get with this. This is really my first time playing with XML data, so please forgive me if this does not make sense. I have a couple of questions. 1- Let’s say that I want to have multiple types of documents pull up under this list, so for example some might be an excel document I want to open, or a word doc, powerpoint etc. How would I change the image so that it recognized the file format? 2- Once I have a directory created how do I make each title open up the specific document it references? Thanks for looking and helping me out on this.