<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:saxon="http://icl.com/saxon"
		version="1.0"
                extension-element-prefixes="saxon">
				
<!-- *************************************************** -->
<!-- *** Tag Definition & Overloading                 *** -->
<!-- *************************************************** -->				

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <note-body>                                          -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="note-body">
    <xsl:apply-templates/>
</xsl:template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <sup>                                             -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="sup">
 	<span class="sup">
	  <xsl:apply-templates/>
	  </span>    
</xsl:template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <p>                                             -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="p">
 	<p>
	  <xsl:apply-templates/>
    </p>
</xsl:template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <a>                                             -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="a">
  <xsl:variable name="link" select="@href"/>
   <A HREF="{$link}">
      <xsl:apply-templates/>
  </A>
</xsl:template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <a_ext>                                             -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="a_ext">
  <xsl:variable name="link" select="concat('', @href)"/>
<!--  
  <A HREF="{$link}" target="_NEW"  onmouseover="window.status='External Link : {$link}'; return true;"><xsl:apply-templates/></A>
-->
  <A HREF="{$link}" target="_NEW"  title="External Link: {$link}"><xsl:apply-templates/></A>
</xsl:template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <download>                                             -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="download">
  <xsl:variable name="link" select="@href"/>
  <A HREF="{$relroot}downloads/{$link}" target="_NEW" onmouseover="window.status='Download Link : {$link}'; return true;"><xsl:apply-templates/></A>
</xsl:template>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <red>                                             -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="red">
  <span class="red">
      <xsl:apply-templates/>
  </span>
</xsl:template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <email>                                             -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="email">
  <xsl:variable name="addr" select="concat('mailto:', @href)"/>
  <A HREF="{$addr}"> <i>    <xsl:value-of select='@href'/></i></A>
</xsl:template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <simple_table>                                       -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="simple_table">
  <xsl:variable name="name" select="@name"/>
  <A NAME="{$name}"></A>
    <TABLE cellpadding="2" class="simpletable">
    <TBODY>
      <xsl:apply-templates/>
    </TBODY>
  </TABLE>
</xsl:template>


<xsl:template match="st_row">
 <TR>
   <td class="st_1st_col" width="150">
    <xsl:value-of select='@type'/>
   
  </td>
  <td class="st_2nd_col">
        <xsl:apply-templates/>
   
  </td>
 </TR>
</xsl:template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <webcomp_citation>                                       -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="webcomp_citation">
  <xsl:variable name="school" select="@school"/>
  <xsl:variable name="team" select="@team"/>
  <xsl:variable name="project" select="@project"/>
  <xsl:variable name="teamsize" select="@teamsize"/>
  <xsl:variable name="tn" select="@tn"/>
  <xsl:variable name="url" select="@url"/>
  <TABLE cellpadding="2" class="simpletable">
 <TBODY>
 <!--<TD><TABLE cellpadding="2" class="simpletable">
 <TBODY>
 -->
 <TR>
 <td class="st_1st_col" width="150">School</td>
 <td class="st_2nd_col"><xsl:value-of select='@school'/></td>
 <TD width="156" align="" valign="top" rowspan="4"><A HREF="{$url}" target="_NEW" title="External Link: {$url}"><IMG SRC="images/{$tn}" alt="External Link: {$url}" width="150" border="0" /></A></TD>
</TR>
<TR>
<td class="st_1st_col" width="150">Team name and size</td>
<td class="st_2nd_col"><xsl:value-of select='@team'/> (<xsl:value-of select='@teamsize'/>)</td>
</TR>
<TR>
<td class="st_1st_col" width="150">Project name and link to site (if available)</td>
<td class="st_2nd_col"><A HREF="{$url}" target="_NEW" title="External Link: {$url}"><xsl:value-of select='@project'/></A></td>
</TR>
<TR>
<td class="st_1st_col" width="150">Award</td>
<td class="st_2nd_col"><xsl:value-of select='@award'/></td>
</TR>
<TR>
<td class="st_1st_col" width="150">Judges' citation</td>
<td class="st_2nd_col" colspan="2"><xsl:apply-templates/></td>
</TR>
<!--</TBODY>
</TABLE>
</TD>
<TD width="156" align="" valign="top" colspan=""><A HREF="{$url}" target="_NEW" title="External Link: {$url}"><IMG SRC="images/{$tn}" ALT="website homepage" height="150" width="150" border="0" TITLE="website homepage"/></A></TD>
-->
</TBODY>
</TABLE>
<br/>
</xsl:template>





<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <photo>                                       -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="photo">
   <center>
   <xsl:variable name="src" select="@src"/>
   <xsl:variable name="alt" select="@alt"/>
   <a href="javascript:bcsoxon_photo('{$relroot}photos/{$src}')"><IMG SRC="{$relroot}photos/thumb-{$src}" ALT="{$alt}" border="0"/></a>
   <br/>
    <xsl:value-of select='@alt'/>
   </center>
</xsl:template>


<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <section>                                       -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="section">
  <xsl:variable name="name" select="@name"/>
  <A NAME="{$name}"></A>
      <hr width="100%" size="1"/>
    <h3><b><xsl:apply-templates/></b></h3>
  


</xsl:template>


<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <section-noline>                                       -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="section-noline">
  <xsl:variable name="name" select="@name"/>
  <A NAME="{$name}"></A>
  <h3><b><xsl:apply-templates/></b></h3>


</xsl:template>

	       
<!-- *************************************************** -->
<!-- *** Common HTML Tags                            *** -->
<!-- *************************************************** -->
  

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--     match common HTML tags <i>, <b>, <br>, <pre>         -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="script">
  <xsl:variable name="lang" select="@language"/>
<!--
  <B>** SCRIPT ** <xsl:apply-templates/> ** SCRIPT **</B>
-->
  <script language='{$lang}'><xsl:apply-templates/></script>
</xsl:template>


<xsl:template match="SCRIPT">
  <xsl:variable name="lang" select="@LANGUAGE"/>
  <xsl:variable name="src" select="@SRC"/>
  <script language='{$lang}' src='{$src}'>
     <xsl:apply-templates/>
  </script>
</xsl:template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--     it's recommended to supply explicit width and height -->
<!--     parameters on img tags. With values are omitted      -->
<!--     my first pass at this generated (for example)        -->
<!--     width=""  which Opera handled fine but IE6 treated   -->
<!--     as zero width and didn't show the image.             -->
<!--     Hence this cascade of choose/when/otherwise          -->
<!--     because I don't know a smarter way to do it          -->
<!--     Add a Title parameter because its contents are       -->
<!--     displayed by Opera, rather than the alt tag like IE  -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<xsl:template match="img">
  <xsl:param name="src" select="@src"/>
  <xsl:param name="alt" select="@alt"/>
  <xsl:param name="align" select="@align"/>
  <xsl:param name="width" select="@width"/>
  <xsl:param name="height" select="@height"/>
  <xsl:param name="mouseover" select="@onmouseover"/>
  <xsl:param name="mouseout" select="@onmouseout"/>
  <xsl:param name="imgname" select="@name"/>
  <xsl:choose>
  <xsl:when test="string-length($width)+string-length($height)=0">
  <IMG ALIGN="{$align}" SRC="{$src}" ALT="{$alt}" border="0" TITLE="{$alt}"/> 
  </xsl:when>
  <xsl:when test="string-length($height)=0">
  <IMG ALIGN="{$align}" SRC="{$src}" ALT="{$alt}" width="{$width}" border="0" TITLE="{$alt}"/> 
  </xsl:when>
  <xsl:when test="string-length($width)=0">
   <IMG ALIGN="{$align}" SRC="{$src}" ALT="{$alt}" height="{$height}" border="0" TITLE="{$alt}"/> 
  </xsl:when>
 <xsl:otherwise>
 <IMG NAME="{$imgname}" ALIGN="{$align}" SRC="{$src}" ALT="{$alt}" height="{$height}" width="{$width}" border="0" TITLE="{$alt}" onmouseover="{$mouseover}" onmouseout="{$mouseout}" /> 
</xsl:otherwise>
</xsl:choose> 
</xsl:template>

<xsl:template match="image">
  <xsl:param name="alt" select="@alt"/>
  <xsl:param name="align" select="@align"/>
  <xsl:param name="width" select="@width"/>
  <xsl:param name="height" select="@height"/>
  <xsl:variable name="src" select="concat($relroot,@src)"/>
  <xsl:choose>
  <xsl:when test="string-length($width)+string-length($height)=0">
  <IMG ALIGN="{$align}" SRC="{$src}" ALT="{$alt}" border="0" TITLE="{$alt}"/> 
  </xsl:when>
  <xsl:when test="string-length($height)=0">
  <IMG ALIGN="{$align}" SRC="{$src}" ALT="{$alt}" width="{$width}" border="0" TITLE="{$alt}"/> 
  </xsl:when>
  <xsl:when test="string-length($width)=0">
   <IMG ALIGN="{$align}" SRC="{$src}" ALT="{$alt}" height="{$height}" border="0" TITLE="{$alt}"/> 
  </xsl:when>
 <xsl:otherwise>
 <IMG ALIGN="{$align}" SRC="{$src}" ALT="{$alt}" height="{$height}" width="{$width}" border="0" TITLE="{$alt}"/> 
</xsl:otherwise>
</xsl:choose> 
</xsl:template>

<xsl:template match="img-newpage">
  <xsl:variable name="src" select="@src"/>
  <xsl:variable name="onload" select="@onload"/>
  <IMG SRC="{$src}" ONLOAD="{$onload}" border="0"></IMG>
</xsl:template>

<xsl:template match="h1">
  <h1><xsl:apply-templates/></h1>
  <hr width="100%" size="1"/>
</xsl:template>

<xsl:template match="h2">
  <h2><xsl:apply-templates/></h2>
</xsl:template>

<xsl:template match="h3">
  <h3><xsl:apply-templates/></h3>
</xsl:template>

<xsl:template match="h4">
  <xsl:apply-templates/><br/>
</xsl:template>

<xsl:template match="ul">
  <UL><xsl:apply-templates/></UL>
</xsl:template>

<xsl:template match="ol">
  <OL><xsl:apply-templates/></OL>
</xsl:template>



<xsl:template match="li">
  <li><span class="list"><xsl:apply-templates/></span></li>
</xsl:template>

<xsl:template match="i">
  <I><xsl:apply-templates/></I>
</xsl:template>

<xsl:template match="b">
  <B><xsl:apply-templates/></B>
</xsl:template>

<xsl:template match="br">
  <BR><xsl:apply-templates/></BR>
</xsl:template>

<xsl:template match="brleft">
  <BR clear="left"><xsl:apply-templates/></BR>
</xsl:template>

<xsl:template match="brright">
  <BR clear="right"><xsl:apply-templates/></BR>
</xsl:template>

<xsl:template match="pre">
  <PRE><xsl:apply-templates/></PRE>
</xsl:template>

<xsl:template match="right">
  <p class="smallright"><xsl:apply-templates/></p>
</xsl:template>


<xsl:template match="table">
  <TABLE><xsl:apply-templates/></TABLE>
</xsl:template>

<xsl:template match="tr">
  <TR valign="top"><xsl:apply-templates/></TR>
</xsl:template>

<xsl:template match="td">
   <xsl:variable name="valign" select="@valign"/>
   <xsl:variable name="width" select="@width"/>
   <xsl:variable name="align" select="@align"/>
   <xsl:variable name="colspan" select="@colspan"/>

  <TD width="{$width}" align="{$align}" valign="{$valign}" colspan="{$colspan}">
          <xsl:apply-templates/>
  </TD>
</xsl:template>
<!--
<xsl:template match="span">
  <BR/><B><xsl:apply-templates/></B><BR/>
</xsl:template>
-->
<xsl:template match="small">
<span class="small"> <xsl:apply-templates/></span>
</xsl:template>

<xsl:template match="hr">
  <hr width="75%" size="1"/>
</xsl:template>

<xsl:template match="hr-wide">
  <hr width="100%" size="1"/>
</xsl:template>

<xsl:template match="center">
  <center><xsl:apply-templates/></center>
</xsl:template>


<!-- *************************************************** -->
<!-- *** Form Elements                               *** -->
<!-- *************************************************** -->

<xsl:template match="form">
   <xsl:variable name="method" select="@method"/>
   <xsl:variable name="name" select="@name"/>
   <xsl:variable name="action" select="@action"/>

  <form method="{$method}" name="{$name}"  action="{$action}">
    <xsl:apply-templates/>
  </form>
</xsl:template>

<xsl:template match="input">
   <xsl:variable name="type" select="@type"/>
   <xsl:variable name="value" select="@value"/>
   <xsl:variable name="size" select="@size"/>
   <xsl:variable name="name" select="@name"/>
   <xsl:variable name="alt" select="@alt"/>
   <xsl:variable name="src" select="@src"/>
   <xsl:variable name="class" select="@class"/>
   <xsl:variable name="onClick" select="@onClick"/>
   <xsl:variable name="onmouseover" select="@onmouseover"/>
   <xsl:variable name="onmouseout" select="@onmouseout"/>

  <input type="{$type}" value="{$value}" src="{$src}" name="{$name}" alt="{$alt}" size="{$size}"  onClick="{$onClick}"  class="{$class}" onmouseover="{$onmouseover}" onmouseout="{$onmouseout}" maxLength="255">
     <xsl:apply-templates/>
  </input>
</xsl:template>

<xsl:template match="input_checked">
   <xsl:variable name="type" select="@type"/>
   <xsl:variable name="value" select="@value"/>
   <xsl:variable name="size" select="@size"/>
   <xsl:variable name="name" select="@name"/>
   <xsl:variable name="alt" select="@alt"/>
      <xsl:variable name="src" select="@src"/>
   <xsl:variable name="onClick" select="@onClick"/>

  <input type="{$type}" value="{$value}" src="{$src}" name="{$name}" alt="{$alt}" size="{$size}"  onClick="{$onClick}" maxLength="60" checked="checked">
     <xsl:apply-templates/>
  </input>
</xsl:template>

<xsl:template match="textarea">
   <xsl:variable name="name" select="@name"/>
   <xsl:variable name="rows" select="@rows"/>
   <xsl:variable name="cols" select="@cols"/>
   <xsl:variable name="wrap" select="@wrap"/>

  <textarea name="{$name}" rows="{$rows}"  cols="{$cols}" wrap="{$wrap}">
     <xsl:apply-templates/>
  </textarea>
</xsl:template>

<xsl:template match="select">
   <xsl:variable name="name" select="@name"/>
   <xsl:variable name="multiple" select="@multiple"/>
   <xsl:variable name="size" select="@size"/>   
 <xsl:choose>
  <xsl:when test="string-length($size)+string-length($multiple)=0">
    <select name="{$name}">
	     <xsl:apply-templates/>
    </select>
  </xsl:when>
  <xsl:when test="string-length($multiple)=0">
    <select name="{$name}" size="{$size}">
          <xsl:apply-templates/>
    </select> 
  </xsl:when>
    <xsl:when test="string-length($size)=0">
    <select name="{$name}" multiple="{$multiple}">
          <xsl:apply-templates/>
    </select> 
  </xsl:when>
  <xsl:otherwise>
 <select name="{$name}" size="{$size}" multiple="{$multiple}">
    <xsl:apply-templates/>
  </select>
</xsl:otherwise>
</xsl:choose>   
  </xsl:template>

<xsl:template match="option">
   <xsl:variable name="value" select="@value"/>
   <xsl:variable name="onClick" select="@onClick"/>
   <xsl:variable name="selected" select="@selected"/>
<xsl:choose>
  <xsl:when test="$selected='1'">
  <option value="{$value}" selected="1" onClick="{$onClick}">
    <xsl:apply-templates/>
  </option>
    </xsl:when>
 <xsl:otherwise>
   <option value="{$value}" onClick="{$onClick}">
     <xsl:apply-templates/>
  </option>
</xsl:otherwise>
</xsl:choose>
   
</xsl:template>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--    match <META>                                             -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<xsl:template match="META">
   <xsl:variable name="http-equiv" select="@HTTP-EQUIV"/>
   <xsl:variable name="content" select="@CONTENT"/>
	<META HTTP-EQUIV="{$http-equiv}" CONTENT="{$content}">  
	  <xsl:apply-templates/>
    </META>
</xsl:template>

</xsl:stylesheet>