🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fr.comp.text.xml
Article #9753

Re: Sommer un calcul

#9753
From: Alain Ketterlin
Date: Thu, 15 Feb 2001 05:41
40 lines
2386 bytes
Tom. <ptittom+news@free.fr> writes:

> In <96dnk2$13g$1@capella.worldonline.fr>, Sydney wrote:
> > Voici un extrait de mon fichier XML
> >          <module nom="Introduction aux Syst&#232;mes Informatiques"
> > coeff="1">
> >             <note obtenu="14" coeff="2" type="DS" date="01/12/2000"/>
> >             <note obtenu="6" coeff="1" type="TP" date="16/11/2000"/>
> >          </module>
> > Je veux creer un named-template qui calcule la moyenne de ce module.
> > [...] Comment faire?
> 
> Penser �r�cursivit�.
> XSLT est un langage fonctionnel, comme Lisp ou Scheme.

[...]
> �a c'est la solution "100% XSLT", il y a aussi la possibilit� d'utiliser 
> une fonction d'extension.

Oui. Perso je trouve ca tres bien, mais je comprends que ca puisse
rebuter.

Est-ce que je me trompe en disant que XSLT 1.1 permettra d'ecrire :

        <xsl:variable name="sxy">
          <xsl:for-each select="note">
            <np><xsl:value-of select="@obtenu*@coeff"/></np>
          </xsl:for-each>
        </xsl:variable>

        <xsl:variable name="moyenne" select="sum($sxy/np)/count($sxy/np)"/>

parce que sxy contient un result-tree-fragment (en 1.0), mais qu'en
1.1 ce sera un nodeset comme un autre.

En attendant, il existe souvent une fonction d'extension qui fait ca
(en general elle s'appelle nodeset ou node-set). Peut-etre que ca
simplifiera la vie a Sydney...

-- Alain.
Technical Details
Message-ID: <wyofw45wr5.fsf@polya.u-strasbg.fr>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-xfer.nuri.net!enews.sgi.com!news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!ciril.fr!news.u-strasbg.fr!not-for-mail
References: <96dnk2$13g$1@capella.worldonline.fr> <96f3uo$3h1$1@wanadoo.fr>

Show Full Headers
Complete Article Headers
X-Google-Language: FRENCH,ASCII
X-Google-Thread: 114f60,4a899d71806a4395
X-Google-Attributes: gid114f60,public
X-Google-ArrivalTime: 2001-02-14 21:50:04 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-xfer.nuri.net!enews.sgi.com!news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!ciril.fr!news.u-strasbg.fr!not-for-mail
From: Alain Ketterlin <alain@dpt-info.u-strasbg.fr>
Newsgroups: fr.comp.text.xml
Subject: Re: Sommer un calcul
Date: 15 Feb 2001 06:41:02 +0100
Organization: CRC - Universite Louis Pasteur Strasbourg France
Lines: 40
Message-ID: <wyofw45wr5.fsf@polya.u-strasbg.fr>
References: <96dnk2$13g$1@capella.worldonline.fr> <96f3uo$3h1$1@wanadoo.fr>
NNTP-Posting-Host: polya.u-strasbg.fr
X-Trace: news.u-strasbg.fr 982220101 3265 130.79.6.19 (15 Feb 2001 06:55:01 GMT)
X-Complaints-To: usenet@u-strasbg.fr
NNTP-Posting-Date: 15 Feb 2001 06:55:01 GMT
X-Newsreader: Gnus v5.6.45/XEmacs 21.1 - "Capitol Reef"