[xsl] count(arvosana) with if condition

Subject: [xsl] count(arvosana) with if condition
From: Jarkko.Moilanen@xxxxxx
Date: Tue, 25 Jun 2002 14:14:57 +0300 (EEST)
Hi!

I´m  trying to count the number of such elements where value is 3.
And if the value is lesser than 3 it should insert xsl:text. 
I´m doing it by using variable (name=3), but it´s not working. Dunno what
I´m doing wrong.

XML-FILE:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?> 
<Document title="Keskiarvot kurssien arvosanoista">
<P1Kurssi koodi="P1" name="P1 Johdatus vuorovaikutteiseen mediaan" 
link="http://hypst09.uta.fi:6969/cgi-bin/html?P1";>

<P1Arvosanat>
  <arvosana>3</arvosana> 
  <arvosana>2.25</arvosana> 
  <arvosana>1.75</arvosana> 
  <arvosana>1.25</arvosana> 
  <arvosana>2.75</arvosana> 
</P1Arvosanat>
</P1Kurssi>
</Document> 


XSL-FILE (part of it):

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";><xsl:output method="html" 
encoding="iso-8859-1" indent="yes" /> 
	<xsl:template match="Document">
<html>
<table>
<tr bgcolor="white">
<td width="80">
<p><font face="Verdana" size="2">
<xsl:value-of select="$3" />

</font></p></td>
</tr>
</table>
</html>
</xsl:template>

<xsl:variable name="3">
	<xsl:for-each select="P1Kurssi/P1Arvosanat">
	<xsl:choose>
	<xsl:when test="arvosana='3'">
	<xsl:value-of select="count(arvosana)" />
	</xsl:when>
	<xsl:otherwise>
	<xsl:text> - </xsl:text>
	</xsl:otherwise>
	</xsl:choose>
	</xsl:for-each>
</xsl:variable>
</xsl:stylesheet>

******************************************************************
Jarkko Moilanen         *You are wise, witty, and wonderful,     *
Researcher/ ITCM        *but you spend too much time             *
jm60697@xxxxxx          *reading this sort of trash.             *
www.uta.fi/~jm60697     *                                        *
GSM: +358 50 3766 927   *                                        *
******************************************************************
* ITCM | Information Technology and Crisis Management            *
* http://www.itcm.org                                            *
******************************************************************

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread