Recursive XSLT
This tutorial describes sample code that uses recursive XSLT calls and JavaScript to display an expanding and collapsing tree view of an XML document.
http://otn.oracle.com/sample_code/tutorials/parser/treeview/toc.htm