<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:output
  doctype-public="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
/>
<xsl:template match="/">
<html>
  <head>
    <title>Bookmarks</title>
    <style type="text/css">
img.fold_icon
{
  width:7px; height:7px;
  border:1px dashed black;
  margin-right:2px;padding:1px;
}
#Bookmarks
{
  list-style:none;
  margin:0px; padding:5px;
}
#Bookmarks ul
{
  list-style:none;
/*  display:none;*/
}
#Bookmarks span.folder_title
{
  font-weight:bold;
}
@media print{
#Bookmarks ul
{
  display:block;
}
img.fold_icon
{
  display:none;
}
}
    </style>
    <script type="text/javascript">
<![CDATA[
function fold(id)
{
  with(document.getElementById(id).style)
  {
    if(display != 'block')
    {
      display = 'block';
      document.getElementById('img_'+ id).src = '/image/icons/minus.png';
    }
    else
    {
      display = 'none';
      document.getElementById('img_'+ id).src = '/image/icons/plus.png';
    }
  }
}

function init()
{
  var folders = document.getElementById('Bookmarks').getElementsByTagName('ul');

  for(i = 0; i < folders.length; i++)
  {
    folders[i].style.display = 'none';
    document.getElementById('img_'+ folders[i].id).src = '/image/icons/plus.png';
  }
}

window.onload = init;
]]>
    </script>
  </head>
  <body>
    <div id="BodyDiv">
<h1>Bookmarks</h1>

<ul id="Bookmarks">
<xsl:for-each select="*">
  <xsl:apply-templates/>
</xsl:for-each>
</ul>

    </div> <!-- end id="BodyDiv" -->


  </body>
</html>
</xsl:template>

<xsl:template match="folder">
<!-- begin folder '<xsl:value-of select="title"/> -->
  <li>
    <span onclick="fold('{generate-id(current())}');" class="folder_title">
      <img
        id="img_{generate-id(current())}"
        src="/image/icons/minus.png"
        class="fold_icon"
        alt="folder"
        title="click to fold/unfold"
      />
      <xsl:value-of select="title"/>
    </span>
    <ul id="{generate-id(current())}">
      <xsl:apply-templates/>
    </ul>
  </li>
<!-- end folder '<xsl:value-of select="title"/> -->
</xsl:template>

<xsl:template match="bookmark">
  <li>
  <xsl:choose>
    <xsl:when test="keyword != ''">
      <form method="get">
        <xsl:attribute name="action">
          <xsl:value-of select="href"/>
        </xsl:attribute>
        <label><xsl:value-of select="title"/> <input type="text">
          <xsl:attribute name="name">
            <xsl:value-of select="keyword"/>
          </xsl:attribute>
        </input></label>
        <input type="submit" value="search"/>
      </form>
    </xsl:when>
    <xsl:otherwise>
  <a>
    <xsl:attribute name="href">
      <xsl:value-of select="href"/>
    </xsl:attribute>
    <xsl:value-of select="title"/>
  </a>
    </xsl:otherwise>
  </xsl:choose>
  </li>
</xsl:template>

<xsl:template match="separator">
  <li><hr/></li>
</xsl:template>

<xsl:template match="title"/>

<xsl:template match="desc"/>

</xsl:stylesheet>
