<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template name="lf2br">
	  <xsl:param name="StringToTransform"/>
	  <xsl:choose>
	    <xsl:when test="contains($StringToTransform,'&#10;')">
	      <xsl:value-of select="substring-before($StringToTransform,'&#10;')"/>
	       <br/>
	      <xsl:call-template name="lf2br">
	        <xsl:with-param name="StringToTransform" 
				select="substring-after($StringToTransform,'&#10;')"/>
	      </xsl:call-template>
	    </xsl:when>
	    <xsl:otherwise>
	      <xsl:value-of select="$StringToTransform"/>
	    </xsl:otherwise>
	  </xsl:choose>
	</xsl:template>
	
	<xsl:variable name="tyhja_muuttuja"/>
	
	<xsl:template match="/">
	
	<xsl:for-each select="OmaTagi">
		<xsl:element name="juokseva_numerointi"><xsl:number/></xsl:element>
	</xsl:for-each>

	<html>
	<head>
		<meta name="description" content="Antin ja Sannan DVD-kokoelma" />
		<meta name="robots" content="noindex, nofollow" />
		<title>Antin ja Sannan DVD-kokoelma</title>
		<link rel="stylesheet" href="collection.css" type="text/css" media="screen"/>
	</head>
	<body>
	
	<div id="keskitys">
	
	<div style="vertical-align: bottom;">
		<img src="../css/dvd_gizmo.gif" width="250" height="157" alt="Gizmo" 
			style="position: relative;top: 50px; left: -200px; "/>
		<img src="../css/dvd_dvd-kokoelma.gif" width="334" height="57" alt="DVD-kokoelma" 
			style="position: relative; left: -110px;" />
	</div>
	
	<div id="paaloota">
	
	<table class="paataulu">
		<tr class="otsikkorivi">
			<td>Nimi</td>
			<td>Vuosi</td>
			<td>Kesto</td>
			<td>Ikä</td>
			<td>Genre</td>
		</tr>
		
        <xsl:for-each select="Collection/DVD">
		<xsl:sort select="SortTitle" order="ascending"/>
		
		<tr class="levyn_tiedot">
			<td class="alaviiva">
			
			<juokseva_numerointi>
				<xsl:value-of select="0 + position()"/>  -
			</juokseva_numerointi>
			
			<b><xsl:value-of select="Title"/></b><xsl:text> </xsl:text>

			<xsl:choose>
				<xsl:when test="DistTrait != $tyhja_muuttuja">
					[<xsl:value-of select="DistTrait"/>]
				</xsl:when>
				<xsl:otherwise/>
			</xsl:choose>
				
			<i><xsl:value-of select="OriginalTitle"/></i>
			
			</td>
			
			<td class="alaviiva"> <xsl:value-of select="ProductionYear"/> </td>
			<td class="alaviiva"> <xsl:value-of select="RunningTime"/> </td>
			<td class="alaviiva"> 

			<xsl:choose>
				<xsl:when test="Rating = 18">
					<span style="color: red"><xsl:value-of select="Rating"/></span>
				</xsl:when>
				<xsl:when test="Rating = 'Från 15 år'">
					15
				</xsl:when>
				<xsl:when test="Rating = '15 år'">
					15
				</xsl:when>
				<xsl:when test="Rating = 'Från 11 år'">
					11
				</xsl:when>
				<xsl:when test="Rating = '11 år'">
					11
				</xsl:when>
				<xsl:when test="Rating = 'Barntillåten'">
					3
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="Rating"/>
				</xsl:otherwise>
			</xsl:choose>
			
			</td>
			<td class="alaviiva"> <xsl:value-of select="Genres"/> </td>
		</tr>
		
		<tr class="kuvaus">
			<td colspan="5">

			<div class="infolaatikko">

			<b><u>Pääosissa</u></b><br />		
			<xsl:choose>
				<xsl:when test="Actors!=$tyhja_muuttuja">
					<xsl:for-each select="Actors/Actor">
						<xsl:value-of select="@FirstName"/> <xsl:text> </xsl:text>
						<xsl:value-of select="@LastName"/><br />
					</xsl:for-each> <br />
				</xsl:when>
				<xsl:otherwise>
					Ei tiedossa<br />
				</xsl:otherwise>
			</xsl:choose>
			
			<b><u>Ohjaus</u></b><br />
			<xsl:choose>
				<xsl:when test="Credits/Credit/@CreditType='Direction'">
					<xsl:value-of select="Credits/Credit/@FirstName"/> <xsl:text> </xsl:text>
					<xsl:value-of select="Credits/Credit/@LastName"/>
				</xsl:when>
				<xsl:otherwise>
					Ei tiedossa
				</xsl:otherwise>
			</xsl:choose>
			
			<br /><br />
			
			<xsl:variable name="haku">
				http://www.google.fi/search?q="<xsl:value-of select="Title"/>"%20DVD
			</xsl:variable>
			
			<a><xsl:attribute name="href"><xsl:value-of select="$haku" />
			</xsl:attribute>Lisää tietoa</a><br />

			</div>
			
			<p style="margin: 0;">
			<xsl:call-template name="lf2br">
				<xsl:with-param name="StringToTransform" select="Overview" />
			</xsl:call-template>
			</p>
			<br />
			
			<b>Arvio:
			<xsl:choose>
				<xsl:when test="Review/@Film &gt;= 9">
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					(pisteet <xsl:value-of select="Review/@Film"/>)
				</xsl:when>
				<xsl:when test="Review/@Film &gt;= 7">
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti_off.gif" width="20" height="19" alt="Tähti" />
					(pisteet <xsl:value-of select="Review/@Film"/>)
				</xsl:when>
				<xsl:when test="Review/@Film &gt;= 5">
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti_off.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti_off.gif" width="20" height="19" alt="Tähti" />
					(pisteet <xsl:value-of select="Review/@Film"/>)
				</xsl:when>
				<xsl:when test="Review/@Film &gt;= 3">
		   			<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti_off.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti_off.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti_off.gif" width="20" height="19" alt="Tähti" />
					(pisteet <xsl:value-of select="Review/@Film"/>)
				</xsl:when>
			    <xsl:when test="Review/@Film = 0">
					ei arvosteltu
				</xsl:when>
				<xsl:otherwise>
					<img src="../css/dvd_tahti.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti_off.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti_off.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti_off.gif" width="20" height="19" alt="Tähti" />
					<img src="../css/dvd_tahti_off.gif" width="20" height="19" alt="Tähti" />
					(pisteet <xsl:value-of select="Review/@Film"/>)
				</xsl:otherwise>
			</xsl:choose></b>
			
			<xsl:choose>
				<xsl:when test="Notes='Sanna'">
					[<span style="color: #fff;"><b><xsl:value-of select="Notes"/></b></span>]
				</xsl:when>
				<xsl:otherwise>
					[<span style="color: #fff;"><b>Antti</b><xsl:value-of select="Notes"/></span>]
				</xsl:otherwise>
			</xsl:choose>
			
			<br />
			
			</td>
		</tr>
		<xsl:if test="position()=last()">
		<tr>
			<td colspan="5" style="background: #333333;">
			<p class="iso">Kokoelmassa yhteensä <xsl:value-of select="position()"/> DVD:tä!</p>
			</td>
		</tr>			
		</xsl:if>
        </xsl:for-each>

	</table>
	
	</div>
	
	<p class="copyright">Päivitetty 31.8.2009 - (C) 2008-2009
		<a style="color: #fff;" href="mailto:antti.lehtonen@gmail.com">Antti Lehtonen</a>
	</p>
	
	</div>
	</body>
	</html>
	
    </xsl:template>
</xsl:stylesheet>
