<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8"/>
<!-- Declare velocity parameters -->
<xsl:param name="context_path"/>
<xsl:param name="current_path"/>
<xsl:template match="/">
<p>Your search has returned <xsl:value-of select="search-results/size"/> item<xsl:if test="search-results/size!=1">s</xsl:if></p>
<xsl:apply-templates select="//search-results/items" />
</xsl:template>
<xsl:template match="items">
<table>
<thead>
<tr>
<th class="id">Id</th>
<td class="name">Name</td>
<td class="collection">Collection</td>
<td class="image">Image</td>
<td class="actions">Actions</td>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="data-item|file-item" />
</tbody>
</table>
</xsl:template>
<xsl:template match="data-item">
<tr class="data-item">
<xsl:apply-templates select="." mode="details"/>
<td class="image"></td>
<xsl:apply-templates select="@id" mode="actions"/>
</tr>
</xsl:template>
<xsl:template match="file-item">
<tr class="file-item">
<xsl:apply-templates select="." mode="details"/>
<td class="image"><xsl:if test="derived-files/thumbnail!=''"><img src="{derived-files/thumbnail}" class="file" /></xsl:if></td>
<xsl:apply-templates select="@id" mode="actions"/>
</tr>
</xsl:template>
<xsl:template match="*" mode="details">
<td class="id"><xsl:value-of select="@id"/></td>
<td class="name"><h3><a href="{$current_path}/view/item{@id}"><xsl:value-of select="name" disable-output-escaping="yes"/></a></h3></td>
<td class="collection"><xsl:value-of select="collection-schema/name"/> (Id: <xsl:value-of select="collection-schema/@id"/>)</td>
</xsl:template>
<xsl:template match="@id" mode="actions">
<td class="actions">
<ul>
<li class="view"><a href="{$current_path}/view/item{.}">View</a></li>
<li class="edit"><a href="{$current_path}/edit/item{.}">Edit</a></li>
</ul>
</td>
</xsl:template>
</xsl:stylesheet>