<?xml version="1.0" encoding="cp866"?>
<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:dt="urn:schemas-microsoft-com:datatypes"
	xmlns:user="demon:xslt-function"
	xmlns:msxsl="urn:schemas-microsoft-com:xslt"
>
  <xsl:output omit-xml-declaration="yes" indent="yes"/>

  <msxsl:script language="JScript" implements-prefix="user">
    <![CDATA[
       function truncate(str, len) {
      
        if ((str.length > len) && (len > 3))
          return str.substr(0, len - 3) + '...';
        else 
          return str.toString();

        }
    ]]>
  </msxsl:script>

  
  <xsl:template match="/">
    <div>
      <xsl:apply-templates select="//servers" />
    </div>
  </xsl:template>

  <xsl:template match="servers">
    
    <div class="ptable" id="serverslist">
      <xsl:if test="count(server) = 0">
        <!--<tr>-->
        <div class="progr">No responding servers available now.</div>
        <!--</tr>-->
        
      </xsl:if>
      <xsl:apply-templates select="server" >
        <xsl:sort select="appid" data-type="number" order="descending"/>
        <xsl:sort select="@name" data-type="text"/>
        
      </xsl:apply-templates>
    </div>
  </xsl:template>

  <xsl:template match="server">
   
        <table class="stable" cellpadding="0" cellspacing="1">
                  <xsl:attribute name="onclick">serverInfo("<xsl:value-of select="@address"/>")</xsl:attribute>

          <COL WIDTH="33"/><COL WIDTH="88"/>
    <tr>
      <td colspan="2" class="servername" title="{@address}">
        <xsl:value-of select="@name"/>
        <!--<nobr><xsl:value-of sselect="user:truncate(string(@name),15)"/></nobr>-->
      </td>
    </tr>
    <tr>
      <td title="Players" class="players">
        <xsl:value-of select="@players"/>/<xsl:value-of select="@playersmax"/>
      </td>
      <td class="map" title="{@map}">
       
            <xsl:value-of select="@map"/>
        
      </td>
    </tr>    

        </table>
       
    
  </xsl:template>
</xsl:stylesheet>