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

<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp   "&#160;">
]>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- <xsl:output method="html" indent="no"/> -->
<xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"/>

<!--     file="../conf/GeneSummary2.xsl"  -->
<!-- <xsl:variable name="tabwidth"><xsl:text>100%</xsl:text></xsl:variable> -->
<!-- <xsl:include href="../conf/commongene.xst"/> -->

<!-- <xsl:template match="*"> <xsl:apply-templates/> </xsl:template> -->
<!-- <xsl:template match="text()|@*" /> .. to output only specified nodes -->

<xsl:template match="/">
	<html>
	<head>
	<title> <xsl:value-of select="GeneSummary/Title"/> </title>
<!-- <link rel="stylesheet" type="text/css" title="GeneSummary"
      href="conf/GeneSummary2.css" /> -->
	</head>

	<body id="body">
	
	<h1 align="left">Unified Gene Pages. Example #1</h1>

  <xsl:apply-templates/>
  
	</body>
	</html>
</xsl:template>

<xsl:template match="GeneSummary">
<xsl:variable name="legend">
<xsl:value-of select="Title"/> -- (Source: <xsl:value-of select="Source"/>)
</xsl:variable>

<div id="GeneSummary" >
<!-- <fieldset>  -->
<!-- <legend ><xsl:value-of select="$legend"/></legend> -->

	<h2 align="left"> 
  <xsl:value-of select="$legend"/> <br/>  
  <xsl:value-of select="Type"/>  for 
  <xsl:choose>
  <xsl:when test='BASIC_INFORMATION/Symbol/text()'>
    <i><xsl:value-of select="BASIC_INFORMATION/Symbol"/></i>
  </xsl:when>
  <xsl:otherwise>
    <xsl:value-of select="BASIC_INFORMATION/GeneID"/>
  </xsl:otherwise>
  </xsl:choose>
  </h2>
  
  <xsl:apply-templates/>
  
<!-- </fieldset> -->
</div>
<br/><br/>
</xsl:template>


<xsl:template name="commonhead" > 
  <tr bgcolor="#EEEEEE"> 
  <td colspan="2"><b><font size="+1" color="#339933">
  <xsl:value-of select="name()"/> 
  </font></b></td>
  </tr>
</xsl:template>

<xsl:template name="commonlabel" > 
  <td width="15%"><b><xsl:value-of select="name()"/> </b>:</td>
</xsl:template>

<xsl:template  mode="commonfield"  match="GeneSummary/*/*"> 
  <tr> 
  <xsl:call-template name="commonlabel" />
  <td> <xsl:apply-templates select="." /></td>
  </tr>
</xsl:template>


<!-- top level blocks -->
<xsl:template priority="1" match="GeneSummary/*"> 
  <table id="{name()}" width="100%" >
  <xsl:call-template name="commonhead" />
  <xsl:apply-templates mode="commonfield" />
	</table>
</xsl:template>

<xsl:template priority="6" match="GeneSummary/BASIC_INFORMATION"> 
  <table id="{name()}" width="100%" >
  <xsl:call-template name="commonhead" />
  <tr><td colspan="2">
  <xsl:for-each select="*">
   <table style="border-right: solid; border-width: thin; float: left; ">
    <tr> 
    <td><b><xsl:value-of select="name()"/> </b>:</td>
    <td> <xsl:apply-templates /></td>
    </tr>
   </table>
  </xsl:for-each>
  </td></tr> 
	</table>
</xsl:template>


<xsl:template mode="commonfield" priority="6"  match="GeneSummary/LOCATION/Map">
  <tr>
  <xsl:call-template name="commonlabel" />
  <td> 
  <xsl:apply-templates select="."  />
  <xsl:if test='@type'>
  <xsl:text> (</xsl:text> <i><xsl:value-of select="@type"/></i> <xsl:text>) </xsl:text>
  </xsl:if>
  </td>
  </tr>
</xsl:template>



<!-- field content handlers, links, etc. -->

<xsl:template  match="Polypeptide"> 
<a href="/cgi-bin/fbidq.html?{@id}"> <xsl:apply-templates/></a> <br/>
</xsl:template>

<xsl:template  match="Transcript"> 
<a href="/cgi-bin/fbidq.html?{@id}"> <xsl:apply-templates/> </a>, 
</xsl:template>

<xsl:template  match="Species"> 
<i><xsl:apply-templates/></i> 
</xsl:template>

<xsl:template  match="ref/Title"> <i><xsl:apply-templates/></i> </xsl:template>
<xsl:template  match="ref/Source"> <b><xsl:apply-templates/></b> </xsl:template>
<xsl:template  match="ref/Identifier"> <u><xsl:apply-templates/></u> </xsl:template>

<xsl:template  match="goterm"> 
<a href="/cgi-bin/goreport?{@id}"> <xsl:apply-templates/> </a>, 
</xsl:template>

<xsl:template match="anatomy"> 
<a href="/cgi-bin/cvreport?{text()}"> <xsl:apply-templates/> </a>, 
</xsl:template>

<xsl:template priority="10" match="db_xref"> 
  <xsl:choose>
  <xsl:when test='@id'> <a href="/cgi-bin/db_xref?{@id}"><xsl:apply-templates/> </a>, </xsl:when>
  <xsl:otherwise> <a href="/cgi-bin/db_xref?{text()}"> <xsl:apply-templates/> </a>,</xsl:otherwise>
  </xsl:choose>
</xsl:template>

<xsl:template priority="10" match="url"> 
  <xsl:choose>
  <xsl:when test='@href'> <a href="{@href}"><xsl:apply-templates/> </a> </xsl:when>
  <xsl:otherwise> <a href="{text()}"> <xsl:apply-templates/> </a> </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<!-- <xsl:template priority="6" match="Expressions">  -->
<!--   <tr>  -->
<!--   <xsl:call-template name="commonlabel" /> -->
<!--   <td>  -->
<!--   <xsl:for-each select="Expressions/*"> -->
<!--     <xsl:value-of select="@type"/> <xsl:value-of select="text()"/> -->
<!--     <xsl:apply-templates/> <br/> -->
<!--   </xsl:for-each> -->
<!--   </td> -->
<!--   </tr> -->
<!-- </xsl:template> -->


<xsl:template priority="6" match="GeneSummary/SIMILAR_GENES"> 
  <table id="{name()}" width="100%" >
  <xsl:call-template name="commonhead" />
  <tr><td>
  <table> <!-- ? width="100%" -->
		<tr>
		<xsl:for-each select="./Similarity[1]/*">
		 <th align="left"><xsl:value-of select="name()"/></th>
		</xsl:for-each>
		</tr>
    <xsl:apply-templates mode="simtable"/>
  </table>
  </td></tr> 
	</table>
</xsl:template>

<xsl:template mode="simtable" match="GeneSummary/SIMILAR_GENES/Similarity">
  <tr> 
		<xsl:for-each select="*">
		 <td><xsl:apply-templates select="."/></td> <!-- <xsl:value-of select="."/>  -->
		</xsl:for-each>
  </tr> 
</xsl:template>


<xsl:template  match="Reagent" mode="reagents"></xsl:template>
<xsl:template  match="Reagent"><xsl:apply-templates/>, </xsl:template>

<xsl:template mode="reagents" match="Name">
  <tr> 
  <td><b> <xsl:value-of select="text()"/></b>:</td> 
  <td><xsl:apply-templates select="Reagent"/></td>
  </tr> 
</xsl:template>

<xsl:template priority="6" match="GeneSummary/REAGENTS"> 
  <table id="{name()}" width="100%" >
  <xsl:call-template name="commonhead" />
  <xsl:apply-templates mode="reagents"/>
	</table>
</xsl:template>



<xsl:template priority="6"  match="GeneSummary/SUMMARY"> 
  <div id="{name()}" >
  <table id="{name()}" width="100%" style="width:auto">
  <xsl:call-template name="commonhead" />
  <xsl:apply-templates mode="sumtable" />
	</table>
	</div>
</xsl:template>

<xsl:template mode="sumtable" match="GeneSummary/SUMMARY/*"> <!-- summary/text summary/html .. -->
  <tr><td> <xsl:apply-templates /></td></tr> <!-- <xsl:value-of select="."/> --> 
</xsl:template>


<!-- hide metadata pulled at top -->
<xsl:template priority="10" match="GeneSummary/Title"></xsl:template>
<xsl:template priority="10" match="GeneSummary/Source"></xsl:template>
<xsl:template priority="10" match="GeneSummary/Type"></xsl:template>


</xsl:stylesheet>
