<?xml version='1.0'?>

<xsl:stylesheet version="2.0"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:fn="http://www.w3.org/2005/xpath-functions"
    xmlns:csc="http://csclub.uwaterloo.ca/xslt">

<xsl:template match="menuitem">
  <xsl:variable name="preabs">
    <xsl:choose>
      <xsl:when test="@absolute = 'true'" />
      <xsl:otherwise>
        <xsl:value-of select="$pre" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <div class="menuitem">
    <a href="{$preabs}{@href}"><p><img src="{$pre}buttons/{@icon}.png" width="40" 
      height="40" alt="{@title}" /></p><p><xsl:value-of select="@title" /></p></a>
  </div>
</xsl:template>

<xsl:template match="menudefs">
  <div class="menubar">
    <xsl:apply-templates select="menuitem" />
  </div>
</xsl:template>

<xsl:template match="menu" name="menu">
 <xsl:apply-templates select="document(concat($g_root, '/menu.xml'))/menudefs" />
</xsl:template>

</xsl:stylesheet>
