This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: count(arvosana) with if condition
- From: Jarno dot Elovirta at nokia dot com
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 25 Jun 2002 15:24:06 +0300
- Subject: RE: [xsl] count(arvosana) with if condition
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi,
A variable name is a QName and thus cannot start with a digit ("3").
Cheers,
Santtu
> -----Original Message-----
> From: ext Jarkko.Moilanen@uta.fi [mailto:Jarkko.Moilanen@uta.fi]
> Sent: 25. June 2002 14:15
> To: xsl-list
> Subject: [xsl] count(arvosana) with if condition
>
>
> 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@uta.fi *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
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list