<?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"/>
<!-- lucegene_result.xsl -->
<!--  
  // not right yet - headers not shown
  // wish this include would work...
  <xsl:include href="conf/acode-fields.xsl"/>
-->

<xsl:param name="docurl">/cgi-bin/fbidq.html?</xsl:param>
<xsl:param name="resorturl">results?sort=</xsl:param>
<xsl:param name="outfields">docid,docclass,url</xsl:param>
<!-- need to arrange columns in display on outfields list -->

<xsl:template match="SearchResultList">
  <table border="1" width="100%" bgcolor="#f9f9f9" cellpadding="1">
  <tr><td>
  <table width="100%" cellpadding="2" cellspacing="0">
  
<!--   <tr bgcolor="#EEEEEE">  -->
<!--   <th align="right" bgcolor="#DODODO" >#</th> -->
<!--   <xsl:for-each select="SearchResult[1]"> -->
<!--      <xsl:call-template name="header" /> -->
<!--   </xsl:for-each> -->
<!--   </tr><xsl:text> -->
<!--   </xsl:text> -->

  <xsl:apply-templates mode="header" select="SearchResult[1]"/> 
 
  <xsl:apply-templates/> 
  
  </table>
  </td></tr></table>
</xsl:template>


<!-- <xsl:template name="header0" match="SearchResult" >  -->
<!--   <th bgcolor="#DODODO"> -->
<!--   <a href="{$resorturl}{name()}"> <xsl:value-of select="name()"/> </a> -->
<!--   </th> -->
<!-- </xsl:template> -->

<xsl:template mode="header" match="SearchResult">
  <tr bgcolor="#EEEEEE"> 
  <th bgcolor="#DODODO" align="right"><xsl:value-of select="'#'" /></th>
  <xsl:for-each select="*">
    <th bgcolor="#DODODO" align="right">
    <a href="{$resorturl}{name()}"> <xsl:value-of select="name()"/> </a>
    </th>
  </xsl:for-each>
  </tr><xsl:text>
  </xsl:text>
</xsl:template>

<xsl:template match="SearchResult">
  <tr> 
  <td bgcolor="white" align="right"><xsl:value-of select="@i+1" /></td>
  <xsl:for-each select="*">
    <td bgcolor="white" align="right">
    <xsl:apply-templates select="."/>
    </td>
  </xsl:for-each>
  </tr><xsl:text>
  </xsl:text>
</xsl:template>


<!-- <xsl:include href="acode_fields.xsl"/> -->
<!-- dang partial url conf/ doenst work here 
    neither does /lucegene/conf ..  
 -->
 
<!-- greek html patch; works with proper preprocessing, but dang xsl -->
<xsl:template match="gr">
<xsl:value-of select="'&amp;'" disable-output-escaping="yes"/>
<xsl:apply-templates/>
<xsl:value-of select="';'" disable-output-escaping="yes"/>
</xsl:template>

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