<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.1" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:java="http://xml.apache.org/xalan/java"
   exclude-result-prefixes="java" 
   > 

<xsl:output  indent="no" method="html" />
<!-- fbgn_result.xsl -->
<!--    
  cdata-section-elements="gr"

  doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN" 

<xsl:value-of select="'&lt;BR/&gt;'" disable-output-escaping="yes"/>

<xsl:include href="conf/acode-fields.xsl"/>
  
input is SearchResultList rows of SearchResult from this
FBgn0031451     RETE|ID 1 FBgn0031451   CLA 1 Gene      GSYM 1 CG9961   DT 1 21 Aug 04  RE
SZ 2246 PDOM 2 INTERPRO:IPR001576 == Phosphoglycerate kinase family     PTD 1   DBA 7   FN
C 1 glycolysis  CLOC 1 23A3     ALESR 1 REF 7           url 1 FBgn.acode,28782099-28784128
        idocid 1 14705  iscore 1 0.83637285
-->

<xsl:param name="docurl">/cgi-bin/fbidq.html?</xsl:param>
<xsl:param name="stockurl">/cgi-bin/fbstoq.html?</xsl:param>
<xsl:param name="resorturl">results?sort=</xsl:param>

<xsl:template match="SearchResultList">
  <table border="1" width="100%" bgcolor="#f9f9f9" cellpadding="1">
  <tr><td>
  <table width="100%" cellpadding="2" cellspacing="0">
  <xsl:call-template name="theader" />
  <xsl:apply-templates/>      
  </table>
  </td></tr></table>
</xsl:template>

<xsl:template name="theader">
  <tr bgcolor="#EEEEEE"> 
  <th align="right" bgcolor="#DODODO" >#</th>
  <th bgcolor="#DODODO" ><a href="{$resorturl}GSYM">Symbol</a></th>
  <th bgcolor="#DODODO" ><a href="{$resorturl}NAM">Name</a></th>
  <th bgcolor="#DODODO" ><a href="{$resorturl}CLOC">Cyto. Map</a></th>
  <th bgcolor="#DODODO" ><a href="{$resorturl}ALESR">Alleles</a></th>
  <th bgcolor="#DODODO" ><a href="{$resorturl}SK">Stocks</a></th>
  <th bgcolor="#DODODO" ><a href="{$resorturl}REF">Refs</a></th>
  <th bgcolor="#DODODO" ><a href="{$resorturl}DBA">DNA acc.</a></th>
  <th bgcolor="#DODODO" ><a href="{$resorturl}DT">Date</a></th>
  <!-- <th bgcolor="#DODODO" ><a href="{$resorturl}RESZ">Rept. size</a></th> -->
  </tr>
</xsl:template>


<xsl:template match="SearchResult">
  <tr> 
  <td bgcolor="white" align="right"><xsl:value-of select="@i+1" /></td>
  <td bgcolor="white" align="right"><xsl:apply-templates select="GSYM"/></td>
  <td bgcolor="white" align="right"><xsl:apply-templates select="NAM"/></td>      
  <td bgcolor="white" align="right"><xsl:apply-templates select="CLOC"/></td>      
  <td bgcolor="white" align="right"><xsl:apply-templates select="ALESR"/></td>      
  <td bgcolor="white" align="right"><xsl:apply-templates select="SK"/></td>      
  <td bgcolor="white" align="right"><xsl:apply-templates select="REF"/></td>      
  <td bgcolor="white" align="right"><xsl:apply-templates select="DBA"/></td>      
  <td bgcolor="white" align="right"><xsl:apply-templates select="DT"/></td>      
  </tr><xsl:text>
  </xsl:text>
</xsl:template>


<!-- <xsl:include href="acode_fields.xsl"/> -->
<!-- dang partial url conf/ doenst work here 
    neither does /lucegene/conf .. needs http:??
 -->

<!-- this disable-output-escaping works  for xsl, but how to get &greek;
  past the xml checker ?? -->
<xsl:template match="gr">
  <xsl:value-of select="'&amp;'" disable-output-escaping="yes"/>
  <xsl:apply-templates/><xsl:value-of select="';'"/>
</xsl:template>

<xsl:template match="gr6">
<xsl:value-of select="text()" disable-output-escaping="yes"/>
</xsl:template>

<!-- // sup, sub work ok -->

<xsl:template match="GSYM">
<xsl:variable name="id" select="../ID/text()"/>
<a href="{$docurl}{$id}"><xsl:apply-templates/></a>
</xsl:template>

<xsl:template match="ALESR">
<xsl:variable name="id" select="../ID/text()"/>
<a href="{$docurl}{$id}&amp;content=allele-table"><xsl:apply-templates/></a>
</xsl:template>

<xsl:template match="CLOC">
<xsl:variable name="id" select="../ID/text()"/>
<a href="{$docurl}{$id}&amp;content=maploc"><xsl:apply-templates/></a>
</xsl:template>

<xsl:template match="SK">
<xsl:variable name="id" select="../ID/text()"/>
<a href="{$stockurl}{$id}"><xsl:apply-templates/></a>
</xsl:template>
 
<xsl:template match="REF">
<xsl:variable name="id" select="../ID/text()"/>
<a href="{$docurl}{$id}&amp;content=ref-table"><xsl:apply-templates/></a>
</xsl:template>
 
<xsl:template match="DBA">
<xsl:variable name="id" select="../ID/text()"/>
<a href="{$docurl}{$id}&amp;content=hg-table"><xsl:apply-templates/></a>
</xsl:template>
 
</xsl:stylesheet>
