<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:output method="html" omit-xml-declaration="yes" encoding="ISO-8859-1" indent="yes" />

<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" href="../misc/tree.css" ></link>
<script language="javascript" type="text/javascript">
<![CDATA[
var lastFileselected;
    function ExpandCollapse(ziel)
    {
		
		var mutter = ziel.parentNode;
		var kinder = mutter.childNodes;
		var ttext = mutter.getElementsByTagName("SPAN")[0];
		var icon = ttext.previousSibling;
		var plusminus = icon.previousSibling;
		/*
		alert ( icon.tagName );
		if ( icon.src.indexOf("o.") > 0 )
		{
			icon.src = icon.src.replace( "o.gif", ".gif" )
		}
		else
		{
			icon.src = icon.src.replace( ".gif", "o.gif" )
		}
		//icon.src = "images/foldero.gif";
		*/
		if ( plusminus.className == "pm" )
		{
			if ( plusminus.src.indexOf("z.gif") > 0 )
			{
				plusminus.src = plusminus.src.replace("z.gif", "a.gif");
			}
			else
			{
				plusminus.src = plusminus.src.replace("a.gif", "z.gif");
			}	
		}
 		for ( i = 0 ; i < kinder.length; i++)
		{
			if ( kinder[i].tagName == "DIV" )
			{
				if ( kinder[i].style.display == "" ) 
				{
					kinder[i].style.display = "none";
				}
				else
				{
					kinder[i].style.display = "";
				}	
			}
		}
    }
    function handleClick()
    {
    var ziel = window.event.srcElement;
		window.status = ziel.className;
		window.event.cancelBubble = true;
		if ( ziel.className == "pm" )
		{
			ExpandCollapse( ziel );
		}
		else
		{
		if ( ziel.tagName == "SPAN")
		{
			if ( lastFileselected != null )
				lastFileselected.style.borderStyle="none";
			lastFileselected = ziel;	
			ziel.style.borderStyle = "solid";
			ziel.style.borderWidth = "1px";
		}
		else
		{
		if ( (ziel.tagName == "IMG")  && ((ziel.className = "folder" ) || ( ziel.className = "file")) )
		{
			if ( lastFileselected != null )
				lastFileselected.style.borderStyle="none";
			lastFileselected = ziel.nextSibling;	
			ziel.nextSibling.style.borderStyle = "solid";
			ziel.nextSibling.style.borderWidth = "1px";
		}
		}
		}
		
		
		
    }
    function handleDblClick()
    {
		var ziel = window.event.srcElement;
		window.event.cancelBubble = true;
		ExpandCollapse( ziel );
    }
    
  ]]>
</script>
</head>
<body>
	<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="*">
<div onclick="return handleClick()" ondblclick="return handleDblClick()">
<xsl:for-each select="ancestor::*">
<xsl:choose>
      <xsl:when test="count(./following-sibling::*)=0">
			<img src="images/0.gif"  align="absbottom" />
      </xsl:when>
      <xsl:when test="count(./following-sibling::*)>0">
         <img src="images/i.gif"  align="absbottom" />
      </xsl:when>
      <xsl:otherwise>
         ?
      </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:choose>
	<xsl:when test="position()=last() and count(./child::*) = 0">
		<img  border="0" align="absbottom" src="images/l.gif" />
	</xsl:when>
	<xsl:when test="position()=last() and count(./child::*) > 0">
		<img  border="0" align="absbottom"  src="images/lz.gif" class="pm" />
	</xsl:when>
	<xsl:when test="position()!=last() and count(./child::*) = 0">
		<img  border="0"  align="absbottom" src="images/t.gif" />
	</xsl:when>
	<xsl:otherwise>
		<img border="0"  align="absbottom" src="images/tz.gif" class="pm" />
	</xsl:otherwise>
</xsl:choose>
<img border="0" align="absbottom" >
<xsl:attribute name="src">images/<xsl:value-of select="@icon" />.gif</xsl:attribute>
<xsl:attribute name="class"><xsl:value-of select="name()" /></xsl:attribute></img>
<span> <xsl:attribute name="class">txt<xsl:value-of select="name()" /></xsl:attribute>
<xsl:attribute name="onclick"><xsl:value-of select="@action" /></xsl:attribute>
<xsl:attribute name="title"><xsl:value-of select="@title" /></xsl:attribute> <xsl:value-of select="@name" /></span>
<xsl:apply-templates />
</div>
</xsl:template>
<xsl:template match="fie">
<div>
<xsl:for-each select="ancestor::*">|</xsl:for-each>
<xsl:if test="position() = last()">+</xsl:if>
<xsl:if test="position() != last()">-</xsl:if>
<xsl:value-of select="@name" />
</div>
</xsl:template>
</xsl:stylesheet>

