<?xml version="1.0"?>
<xsl:stylesheet 
  version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html"/>
  <xsl:strip-space elements="*"/>

<xsl:template match="/">
  <HTML>
    <HEAD>
    <style>
      BODY { font-size: smaller; }
      .item { padding: 5px; }
      .collapsed { display: none; }
      .body { margin-left: 22px;  }
      .head { margin-left: 10px; font-weight: bold; }
    </style>
    <script type="text/javascript"><![CDATA[
    
    function test(el) {
      alert(el.parentNode);
    
    }
    function toggle(el) {
       var item = el.parentNode.parentNode;
       var state = item.getAttribute("state");
       if ( state == "collapsed" ) {
            item.setAttribute("state", "expanded");
            item.setAttribute("class", "item");
            el.childNodes[0].data = " - ";	 
            var sections = item.getElementsByTagName("DIV");
            for (var i = 0; i < sections.length; i++)
               if (sections[i].className == "collapsed")
                  sections[i].className = "body";
       } else {
            item.setAttribute("state", "collapsed");
            el.childNodes[0].data = " + ";	 
            var sections = item.getElementsByTagName("DIV");
            for (var i = 0; i < sections.length; i++)
               if (sections[i].className == "body") 
                  sections[i].className = "collapsed";
       }
    }]]>
    </script>
    </HEAD>
    <BODY>
    <xsl:apply-templates select="/leo_file/vnodes/v/vh" />

    </BODY>

  </HTML>
</xsl:template>

<xsl:template match="vh">
  <DIV class="item" state="expanded">
    <SPAN class="but"><a href="#" onclick="toggle(this);"> - </a></SPAN>
    <SPAN class="head"><xsl:value-of select="."/></SPAN>
    <DIV class="body">
          <xsl:variable name="textID" select="../@t"></xsl:variable>
          <xsl:apply-templates select="//t[@tx=$textID]"/>
          <xsl:apply-templates select="../v/vh"/>
    </DIV>
  </DIV>
</xsl:template>

<xsl:template match="t">
        <div class='t'>
        <xsl:value-of select="." />
        </div>
</xsl:template>

</xsl:stylesheet>




