Soory, was a bit in a hurry. Anyway, here's an experiment I once did on making a treeview in HTML. Hope you can make something out of it.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="
version="1.0">
<xsl:variable name="intInput" select="9"/>
<!--
find upper elements
-->
<xsl:template match="obj_tabel">
<script type="text/javascript">
function TOGGLE(id)
{
if (eval('subs'+id+'.style.display')==''){
eval('subs'+id+'.style.display="none"');
}
else{
eval('subs'+id+'.style.display=""');
};
if (eval("IM"+id+".src"

.match("closed.gif","g"

!=null){
eval('IM'+id+'.src="open.gif"');
};
else {
if (eval("IM"+id+".src"

.match("open.gif","g"

!=null){
eval('IM'+id+'.src="closed.gif"');
};
}
}
</script>
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="obj_collectie">
<table border="0" cellpadding="0" cellspacing="0">
<xsl:for-each select="obj_object">
<xsl:sort select="obj_id" data-type="number"/>
<xsl:if test="obj_ouder_obj_id=0">
<xsl:call-template name="MakeBranche">
<xsl:with-param name="col" select="parent:

bj_collectie"></xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</table>
</xsl:template>
<!--
template for object: draws all nodes, starting with rootnode
-->
<xsl:template name="MakeBranche">
<xsl

aram name="StuffBefore" select="''"/>
<xsl

aram name="col" select="."></xsl

aram>
<xsl:variable name="ouder" select="obj_id"/>
<!-- draw this node -->
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<xsl:variable name="StuffBefore2" select="$StuffBefore"/>
<xsl:call-template name="StuffBefore">
<xsl:with-param name="StuffBefore2" select="$StuffBefore"/>
</xsl:call-template>
<a>
<xsl:variable name="ID" select="obj_id"/>
<xsl:attribute name="onclick"><xsl:text>TOGGLE(</xsl:text><xsl:value-of select="$ID"/><xsl:text>)</xsl:text></xsl:attribute>
<td width="11">
<xsl:choose>
<xsl:when test="count($col/obj_object[obj_ouder_obj_id=$ouder])=0">
<img src="leaf.gif">
<xsl:attribute name="id">IM<xsl:value-of select="$ID"/></xsl:attribute>
</img>
</xsl:when>
<xsl

therwise>
<img src="closed.gif">
<xsl:attribute name="id">IM<xsl:value-of select="$ID"/></xsl:attribute>
</img>
</xsl

therwise>
</xsl:choose>
</td>
<td><xsl:text> </xsl:text><xsl:value-of select="obj_omschrijving"/>
</td>
</a>
</tr>
</table>
<!-- draw subs; first the ones that are have childnodes -->
<div>
<xsl:attribute name="id"><xsl:text>subs</xsl:text><xsl:value-of select="obj_id"/></xsl:attribute>
<xsl:attribute name="style"><xsl:text>display='none'</xsl:text></xsl:attribute>
<xsl:variable name="number" select="count($col/obj_object[obj_ouder_obj_id=$ouder])"></xsl:variable>
<xsl:variable name="count" select="0"></xsl:variable>
<table border="0" cellpadding="0" cellspacing="0">
<xsl:for-each select="$col/obj_object[obj_ouder_obj_id=$ouder]">
<xsl:sort select="obj_id" data-type="number"/>
<xsl:variable name="child" select="obj_id"></xsl:variable>
<xsl:if test="count($col/obj_object[obj_ouder_obj_id=$child])>0">
<xsl:choose>
<xsl:when test="$number=$count">
<xsl:call-template name="MakeBranche">
<xsl:with-param name="StuffBefore" select="concat($StuffBefore,'A')"/>
<xsl:with-param name="col" select="$col"></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl

therwise>
<xsl:call-template name="MakeBranche">
<xsl:with-param name="StuffBefore" select="concat($StuffBefore,'B')"/>
<xsl:with-param name="col" select="$col"></xsl:with-param>
</xsl:call-template>
</xsl

therwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$col/obj_object[obj_ouder_obj_id=$ouder]">
<xsl:sort select="obj_id" data-type="number"/>
<xsl:variable name="child" select="obj_id"></xsl:variable>
<xsl:if test="count($col/obj_object[obj_ouder_obj_id=$child])=0">
<xsl:choose>
<xsl:when test="$number=$count">
<xsl:call-template name="MakeBranche">
<xsl:with-param name="StuffBefore" select="concat($StuffBefore,'A')"/>
<xsl:with-param name="col" select="$col"></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl

therwise>
<xsl:call-template name="MakeBranche">
<xsl:with-param name="StuffBefore" select="concat($StuffBefore,'B')"/>
<xsl:with-param name="col" select="$col"></xsl:with-param>
</xsl:call-template>
</xsl

therwise>
</xsl:choose>
$number = $number+1
</xsl:if>
</xsl:for-each>
</table>
</div>
</xsl:template>
<!--
StuffBefore
-->
<xsl:template name="StuffBefore">
<xsl

aram name="StuffBefore2" select="''"/>
<!-- first character of StuffBefore -->
<xsl:if test="string-length($StuffBefore2)>1">
<!-- not yet last cell in StuffBefore -->
<xsl:if test="starts-with($StuffBefore2,'A')">
<!-- vertical line -->
<td width="11">
<img src="geenclosed.gif"/>
</td>
</xsl:if>
<xsl:if test="starts-with($StuffBefore2,'B')">
<!-- nothing at all -->
<td width="11"/>
</xsl:if>
</xsl:if>
<xsl:if test="string-length($StuffBefore2)=1">
<!-- last cell StuffBefore -->
<xsl:if test="starts-with($StuffBefore2,'A')">
<!-- side branche -->
<td width="11">
<img src="zijclosed.gif"/>
</td>
</xsl:if>
<xsl:if test="starts-with($StuffBefore2,'B')">
<!-- last branching -->
<td width="11">
<img src="eindclosed.gif"/>
</td>
</xsl:if>
</xsl:if>
<xsl:if test="string-length($StuffBefore2)>1">
<!-- and do the rest of StuffBefore -->
<xsl:call-template name="StuffBefore">
<xsl:with-param name="StuffBefore2" select="substring($StuffBefore2,2)"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>