<?xml version="1.0" ?>
<!DOCTYPE stylesheet 
[
<!ENTITY nbsp    "&amp;#160;">

]>
<!--==================================================================-->
<!--        (c) Genias Benelux 2001                                   -->
<!--       This file is part of the VMP publishing system             -->
<!--      Its contents may  not be copied or used in any way          -->
<!--      outside of a licensed VMP system                            -->
<!--       03-07-2001                                                 -->
<!--==================================================================-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		  version="1.0"
                  xmlns:vmp="http://www.hoise.com/vmp/1.0"
                  xmlns:xt="http://www.jclark.com/xt"
                  extension-element-prefixes="xt">

<xsl:include href="../set-up/current-date.xsl" />
<xsl:include href="../set-up/settings.xsl" />
<xsl:include href="../set-up/format-basis.xsl"/>
<xsl:variable name="CMTSetUp" select="document('../set-up/cmt.xml')/vmp:cmt" />
<xsl:variable name="resetForms" />



<xsl:variable name="id"/>
<xsl:variable name="type"/>
<xsl:variable name="mimetype"/>
<xsl:variable name="title"/>
<xsl:variable name="username"/>
<xsl:variable name="organization"/>
<xsl:variable name="description"/>
<xsl:variable name="category"/>
<xsl:variable name="xmlfile">..database/repository.xml</xsl:variable>
<xsl:variable name="Action">search</xsl:variable>


<xsl:template match="vmp:repository">

<xt:document method="html" href="../temp/search-formatted.html"> 
<xsl:call-template name="format-basis">
<xsl:with-param name="Title">Repository  Search Results</xsl:with-param> 
<xsl:with-param name="Contents">

<tr>
<td width="50">
<img src="{$IconDirectory}/spacer.gif" 
     width="50" 
     border="0" />

<td>
</td>
<table bgcolor="#000000" 
       cellpadding="1"
       cellspacing="0">
<tr><td>

<table bgcolor="{$BaseColour}" 
       cellspacing="0" 
       cellpaddding="0">
<tr>
<td>
<table cellspacing="1" 
       cellpaddding="0">
<tr bgcolor="{$SupportColour}">
<td colspan="9" 
    height="20" 
    align="center"
    style="{$CMTSetUp/vmp:layout/vmp:table/@title-style}"><div style="color: {$BaseColour};" >VMP Repository - Search Results</div></td>
</tr>

<tr >
<td style="{$CMTSetUp/vmp:layout/vmp:table/@header-style}" >&#160;</td> 
<td style="{$CMTSetUp/vmp:layout/vmp:table/@header-style}" >Id</td> 
<td style="{$CMTSetUp/vmp:layout/vmp:table/@header-style}" >Type</td>
<td style="{$CMTSetUp/vmp:layout/vmp:table/@header-style}" >Mimetype</td>
<td style="{$CMTSetUp/vmp:layout/vmp:table/@header-style}" >Title</td>
<td style="{$CMTSetUp/vmp:layout/vmp:table/@header-style}" >Username</td>
<td style="{$CMTSetUp/vmp:layout/vmp:table/@header-style}" >Organization</td>
<td style="{$CMTSetUp/vmp:layout/vmp:table/@header-style}" >Description</td>
<td style="{$CMTSetUp/vmp:layout/vmp:table/@header-style}" >Category</td> 
</tr>
 

<xsl:variable name="stype">
<xsl:choose>
<xsl:when test="$type = '-' " />
<xsl:otherwise>
<xsl:value-of select="$type"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<xsl:variable name="smimetype">
<xsl:choose>
<xsl:when test="$mimetype = '-' "/>
<xsl:otherwise>
<xsl:value-of select="$mimetype"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<xsl:variable name="scategory">
<xsl:choose>
<xsl:when test="$category = '-' "/>
<xsl:otherwise>
<xsl:value-of select="$category"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>


<xsl:apply-templates select="vmp:item[ contains(@id,normalize-space($id))
                                  and (contains(@type,normalize-space($stype)) or @type ='-')
                                  and (contains(@mimetype,normalize-space($smimetype)) or @mimetype ='-')
                                  and (contains(vmp:title,normalize-space($title)) or vmp:title = '')
                                  and (contains(vmp:username,normalize-space($username)) or vmp:username = '')
                                  and (contains(vmp:organization,normalize-space($organization)) or vmp:organization = '')
                                  and (contains(vmp:description,normalize-space($description)) or vmp:description = '')
                                  and (contains(vmp:category,normalize-space($scategory)) or vmp:category ='-') ]" />

</table>
</td>
</tr>
</table>

</td></tr>
</table>

</td>
</tr>

</xsl:with-param>
</xsl:call-template>
</xt:document>
</xsl:template>


<xsl:template match="vmp:item">

<xsl:variable name="bgcolor">
<xsl:choose>
<xsl:when test="position() mod 2 = 1 ">
<xsl:value-of select="$BackgroundColour" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$BaseColour" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<tr bgcolor="{$bgcolor}">
    <td style="{$CMTSetUp/vmp:layout/vmp:table/@text-style}" ><xsl:value-of select="position()" /></td>
	<td style="{$CMTSetUp/vmp:layout/vmp:table/@text-style}" ><xsl:value-of select="@id" /></td>
	<td style="{$CMTSetUp/vmp:layout/vmp:table/@text-style}" ><xsl:value-of select="@type" /></td>
	<td style="{$CMTSetUp/vmp:layout/vmp:table/@text-style}" ><xsl:value-of select="@mimetype" /></td>	
	<td style="{$CMTSetUp/vmp:layout/vmp:table/@text-style}" ><a href="{$BaseUrl}repository/{@id}"><xsl:value-of select="vmp:title"/></a></td>
	<td style="{$CMTSetUp/vmp:layout/vmp:table/@text-style}" ><xsl:value-of select="vmp:username" /><br /></td>
	<td style="{$CMTSetUp/vmp:layout/vmp:table/@text-style}" ><xsl:value-of select="vmp:organization" /><br /></td>
	<td style="{$CMTSetUp/vmp:layout/vmp:table/@text-style}" ><xsl:value-of select="vmp:description" /><br /></td>
	<td style="{$CMTSetUp/vmp:layout/vmp:table/@text-style}" ><xsl:value-of select="vmp:category" /><br /></td>
</tr>

</xsl:template>



<xsl:template match="*|@*">
  <xsl:copy>
    <xsl:apply-templates select="@*"/>
    <xsl:apply-templates select="node()"/>
  </xsl:copy>

</xsl:template>

</xsl:stylesheet>

