<?xml version="1.0" encoding="ucs-2"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="/">

    <html>
    <head>
    <title>right</title>
    <link rel="stylesheet" href="images/style.css" type="text/css"/>
    </head>

    <body rightmargin="0" bottommargin="0"  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <table width="100%" border="0" cellspacing="10" cellpadding="0" height="100%" class="txt">
      <tr> 
        <td height="1" align="right"><img src="images/online_highscores.gif" alt="Online Highscores" width="171" height="23"/></td>
      </tr>
      <tr> 
        <td valign="top" class="txt"> <a id="top" name="top"></a>
	If the game offers you to enter your name in the Online Highscores Table, 
	you can specify additional information along with your name. It can be your country - for example
	<b>Dunkel (Germany)</b>, age <b>Chi Hua 12 years</b>  or e-mail <b>Big Boss [big@boss.org]</b>.
	<br/>
	<br/>
	Note that only Latin symbols can be used here.
          <br/>
          <img src="images/spacer.gif" width="13" height="8"/>
            <xsl:apply-templates mode="list" select="Hiscore/Mode">
                    <xsl:sort select="@Id" order="ascending"/>
            </xsl:apply-templates>
        </td>
      </tr>
      <tr>
        <td valign="top" class="txt" align="right">

            <xsl:apply-templates mode="table" select="Hiscore/Mode">
                    <xsl:sort select="@Id" order="ascending"/>
            </xsl:apply-templates>
        </td>
      </tr>
    </table>
    </body>
    </html>
</xsl:template>

<xsl:template mode="list" match="Mode">
    <b> <xsl:if test="position() != 1">
            <xsl:text> | </xsl:text>
        </xsl:if>
    <a>
        <xsl:attribute name="href">
            <xsl:text>#</xsl:text>
            <xsl:value-of select="@Id"/>
        </xsl:attribute>
        <xsl:value-of select="@Type"/>
    </a>

    </b>
</xsl:template>

<xsl:template mode="table" match="Mode">

      <table border="0" cellspacing="10" cellpadding="0" width="100%">
        <tr> 
          <td class="table_bg"> 
    <a>
        <xsl:attribute name="id">
            <xsl:text>#</xsl:text>
            <xsl:value-of select="@Id"/>
        </xsl:attribute>
        <xsl:attribute name="name">
            <xsl:text>#</xsl:text>
            <xsl:value-of select="@Id"/>
        </xsl:attribute>
    </a>
            <table width="100%" border="0" cellspacing="1" cellpadding="2">
              <tr> 
                <td colspan="3" class="table_l"><b><font color="#FFFFFF">
    <xsl:value-of select="@Type"/>
        </font></b></td>
              </tr>
              <tr> 
                <td width="70%" class="table_l"><b>Nickname</b></td>
                <td class="table_l"><b>Score</b></td>
              </tr>

            <xsl:apply-templates select="Record">
                    <xsl:sort select="@Score" data-type="number" order="descending"/>
        </xsl:apply-templates>

            </table>
          </td>
        </tr>
      </table>
      <b><a href="#top">On the top of page</a></b><img src="images/spacer.gif" width="10" height="8"/> 
</xsl:template>

<xsl:template match="Record">
   <xsl:choose>
   <xsl:when test="position()*0.5 &gt; floor(position()*0.5)">
              <tr> 
                <td width="70%" class="txt">
            <xsl:value-of select="@Name"/>
        </td>
                <td class="txt">
            <xsl:value-of select="@Score"/>
        </td>
              </tr>
   </xsl:when>
   <xsl:otherwise>
              <tr> 
                <td width="70%" class="table_l">
            <xsl:value-of select="@Name"/>
        </td>
                <td class="table_l">
            <xsl:value-of select="@Score"/>
        </td>
              </tr>
   </xsl:otherwise>
   </xsl:choose>
</xsl:template>

</xsl:stylesheet>
