Re: [xsl] count(arvosana) with if condition

Subject: Re: [xsl] count(arvosana) with if condition
From: Jarkko.Moilanen@xxxxxx
Date: Wed, 26 Jun 2002 07:57:56 +0300 (EEST)
Hi!

Actually the solution to my prob was
instead of <xsl:if test="count(//arvosana[text()&lt;3])">
I used 
<xsl:value-of select="count(//arvosana[text()&lt;3])" />

Thank U

Cheers 
Jarkko

> The following will help you...
> 
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> <xsl:template match="/">
> <xsl:if test="count(//arvosana[text()&lt;3])">
> add text..
> the no of arvosana with value less than 3 are <xsl:value-of 
> select="count(//arvosana[text()&lt;3])"/>
> 
> </xsl:if>
> </xsl:template>
> </xsl:stylesheet>
> This prints the no of arvosana with values less than 3.
> 
> HTH
> >From: Jarkko.Moilanen@xxxxxx
> >Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >To: xsl-list <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> >Subject: [xsl] count(arvosana) with if condition
> >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
> 
> 
> 
> 
> _________________________________________________________________
> Join the world?s largest e-mail service with MSN Hotmail. 
> http://www.hotmail.com
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 



******************************************************************
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