<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>
<xsl:template match="/">
<html>
<head>
  <title><xsl:value-of select="protocol-archive/protocol/protocol-information/name"/> - <xsl:value-of select="protocol-archive/archive-info/archive-creator"/></title>
<link rel="stylesheet" type="text/css" href="http://cvs.openmicroscopy.org.uk/snapshots/omero/editor/xsl/omeroStyles.css"/>

<script src="http://cvs.openmicroscopy.org.uk/snapshots/omero/editor/xsl/jquery.js" type="text/javascript"></script>
<script src="http://cvs.openmicroscopy.org.uk/snapshots/omero/editor/xsl/omeroScript.js" type="text/javascript"></script>

</head>

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


<!-- removes internal archive information -->
<xsl:template match="archive-info">
</xsl:template>

<!-- removes necessity -->
<xsl:template match="necessity">
</xsl:template>

<!-- removes param-type -->
<xsl:template match="param-type">
</xsl:template>

<!-- removes step_type -->
<xsl:template match="step-type">
</xsl:template>

<!-- removes parameter name -->
<xsl:template match="name">
</xsl:template>

<!-- removes step description -->
<xsl:template match="description">
</xsl:template>

<!-- delegates to the next level of templates -->
<xsl:template match="protocol">
    	<xsl:apply-templates/>
</xsl:template>

<!-- adds the general protcol information in the html file -->
<xsl:template match="protocol-information">
	<table id="protocolHeader"><tr>
	<td class="protocolName">
		<xsl:value-of select="name"/>
	</td>
	<td align="right">
		<table><tr><td><div id="controls"></div></td>
		<td><div id='icon'/></td></tr></table>
	</td>
	</tr></table>
	
	<!-- delegate to children, eg experiment-information -->
	<xsl:apply-templates/>
	
	<div class="protocolDescription">
     	<xsl:value-of select="description"/>
   </div>
</xsl:template>


<!-- experimental info -->
<xsl:template match="experiment-information">

    <table id="experimentInfo"><tr>
	<td><span id="expInfoTitle">Experiment Info: </span>
        <span id="expInfo">Investigator: <xsl:value-of select="investigator-name"/>. 
		 Experiment Date: <span class="date"><xsl:value-of select="experiment-date"/></span></span>
	</td>
	<td align="right">
		<div id="expControls"></div>
	</td>
    </tr></table>
</xsl:template>


<!-- contains the list of steps -->
<xsl:template match="steps">

    <div class="steps" id="protocol">
        <xsl:apply-templates/>
    </div>
</xsl:template>


<!-- contains the child steps -->
<xsl:template match="step-children">

    <div class="step-children">
        <xsl:apply-templates/>
    </div>
</xsl:template>



<!-- contains all steps -->
<xsl:template match="step">
     <!-- step  -->
     
     <div class="step">
     <div class="collapseButton" />
	<div class="rightButton">
		<xsl:for-each select="notes/note">
			<div class="stepNote">
		        <div class="stepNoteName"><xsl:value-of select="name"/></div>
				<div class="stepNoteContent"><xsl:value-of select="content"/></div>
			</div>
		</xsl:for-each>
     	<div class="stepName"><xsl:value-of select="name"/></div>
     	<div class="stepDescription"><xsl:value-of select="description"/></div>
     	<xsl:apply-templates/> 
     </div>
     
     </div>

</xsl:template>


<!-- ignore the step notes -->
<xsl:template match="notes">
</xsl:template>

<!-- for parameters, simply apply the templates for description and parameter -->
<xsl:template match="parameter-list">
<table><tr>
	<xsl:apply-templates/> 
</tr></table>
</xsl:template>

<!-- for parameters, simply apply the templates for description and parameter -->
<xsl:template match="parameter-table">
<table><tr>
	<xsl:apply-templates/> 
</tr></table>
</xsl:template>

<!-- parameter - Place attributes in a span element -->
<xsl:template match="parameter">

<td valign="top">
	<table class="paramTable">
	<tr><th class="paramHeader">
  <xsl:attribute name="id">
    <xsl:value-of select="id" />
  </xsl:attribute> 
  <xsl:attribute name="name">
    <xsl:value-of select="name" />
  </xsl:attribute> 
  <xsl:attribute name="value">
    <xsl:value-of select="data/value" />
  </xsl:attribute> 
  <xsl:attribute name="units">
    <xsl:value-of select="units" />
  </xsl:attribute> 
<xsl:attribute name="type">
    <xsl:value-of select="param-type" />
  </xsl:attribute>
  
  <xsl:value-of select="name"/>
  (<xsl:value-of select="units"/>)
  </th></tr>
  
  <xsl:for-each select="data/value">
      <tr>
      	<td class="paramData">
      		<xsl:variable name="val" select="."/>
      		<xsl:choose>          
				<xsl:when test="$val != ''">
					<xsl:value-of select="."/> 
				</xsl:when>
                <xsl:otherwise>
                	 -
                </xsl:otherwise>
           	</xsl:choose>
        </td>
      </tr>
      </xsl:for-each>

  
     </table>
   </td>
     

     
</xsl:template>

</xsl:stylesheet>

