Article View: fr.comp.text.xml
Article #8773Re: moyenne en XSLT
From: Thomas Broyer
Date: Wed, 25 Jul 2001 19:09
Date: Wed, 25 Jul 2001 19:09
26 lines
1851 bytes
1851 bytes
In <9jmskg$b3n$1@reader1.fr.uu.net>, Tanguy Crusson wrote:
> A partir du document XML suivant :
> <bulletin eleve="tcrusson">
> <matiere nom="histoire">
> <note coef="4">12</note>
> <appreciation>assez bien</appreciation>
> </matiere>
> <matiere nom="maths">
> <note coef="8">1</note>
> <appreciation>nul. Aucun effort</appreciation>
> </matiere>
> </bulletin>
>
> j'aimerais calculer la moyenne pond�r�e en fonction de la note et du
> coefficient
>
> je vois comment faire sans les coefs round(sum(//note) div count(matiere))
> mais pas avec les coefs
Deux solutions :
� en pur XSLT, il faut passer par un template nomm� r�cursif.
� avec des extensions. SAXON par exemple le permet via saxon:sum()
round(saxon:sum(matiere/note, saxon:expression('@coef*string()'))
div sum(matiere/note/@coef))
Tom.
Technical Details
Message-ID:
<1119610.QgxmLvFx2q@ltgt.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.251.151.101!opentransit.net!proxad.net!feeder2-1.proxad.net!nnrp1.proxad.net.POSTED!not-for-mailReferences:
<9jmskg$b3n$1@reader1.fr.uu.net>Show Full Headers
Complete Article Headers
X-Google-Language: FRENCH,ASCII X-Google-Thread: 114f60,8ef9442d02efc281 X-Google-Attributes: gid114f60,public X-Google-ArrivalTime: 2001-07-25 12:09:15 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.251.151.101!opentransit.net!proxad.net!feeder2-1.proxad.net!nnrp1.proxad.net.POSTED!not-for-mail Message-ID: <1119610.QgxmLvFx2q@ltgt.net> From: Thomas Broyer <ptittom+news@free.fr> Subject: Re: moyenne en XSLT Newsgroups: fr.comp.text.xml References: <9jmskg$b3n$1@reader1.fr.uu.net> Lines: 26 Organization: </> User-Agent: KNode/0.5.6 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8Bit Date: Wed, 25 Jul 2001 19:09:14 GMT NNTP-Posting-Host: 193.251.185.50 X-Complaints-To: abuse@proxad.net X-Trace: nnrp1.proxad.net 996088154 193.251.185.50 (Wed, 25 Jul 2001 21:09:14 CEST) NNTP-Posting-Date: Wed, 25 Jul 2001 21:09:14 CEST