Article View: fr.comp.text.xml
Article #8454Tableau de calcul
From: lacombe
Date: Mon, 01 Oct 2001 19:07
Date: Mon, 01 Oct 2001 19:07
77 lines
2636 bytes
2636 bytes
Bonjour,
Je cherche � afficher un tableau de calcul � partir du fichier XML:
<?xml version="1.0" encoding="UTF-8"?>
<liste>
<product>
<unitprice>2.00</unitprice>
<sold>5</sold>
</product>
<product>
<unitprice>3.00</unitprice>
<sold>2</sold>
</product>
</liste>
J'utilise le fichier xsl:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:internal="foo" version='1.0'>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>
Tableau
</TITLE>
</HEAD>
<BODY>
<TABLE style="table-layout:fixed" BORDER="2" CELLSPACING="2">
<col width="100"/>
<col width="100"/>
<col width="100"/>
<THEAD>
<TH>Unite Price</TH>
<TH>Solde</TH>
<TH>Total</TH>
</THEAD>
<xsl:apply-templates select="/liste/product"/>
<TR>
<td/>
<td>
<xsl:value-of select="sum(//sold)"/>
</td>
<td>
<xsl:comment>
Addition de toutes la colonne
</xsl:comment>
</td>
</TR>
</TABLE>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="product">
<TR>
<td>
<xsl:value-of select="unitprice"/>
</td>
<td>
<xsl:value-of select="sold"/>
</td>
<td>
<xsl:variable name="mul" select="number(unitprice * sold)"/>
<xsl:value-of select="$mul"/>
</td>
</TR>
</xsl:template>
</xsl:stylesheet>
Mais je ne sais pas faire la somme de la derni�re colonne.
Merci de votre aide.
Michel Lacombe
Technical Details
Message-ID:
<K93u7.324$Gd7.1220799@nnrp3.proxad.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!proxad.net!feeder2-1.proxad.net!nnrp3.proxad.net.POSTED!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: FRENCH,ASCII X-Google-Thread: 114f60,e8ee46de00e85453,start X-Google-Attributes: gid114f60,public X-Google-ArrivalTime: 2001-10-01 12:07:25 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!proxad.net!feeder2-1.proxad.net!nnrp3.proxad.net.POSTED!not-for-mail Reply-To: "lacombe" <famillelacombe@free.fr> From: "lacombe" <famillelacombe@free.fr> Newsgroups: fr.comp.text.xml Subject: Tableau de calcul Lines: 79 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: <K93u7.324$Gd7.1220799@nnrp3.proxad.net> Date: Mon, 01 Oct 2001 19:07:22 GMT NNTP-Posting-Host: 213.228.19.18 X-Complaints-To: abuse@proxad.net X-Trace: nnrp3.proxad.net 1001963242 213.228.19.18 (Mon, 01 Oct 2001 21:07:22 CEST) NNTP-Posting-Date: Mon, 01 Oct 2001 21:07:22 CEST Organization: Guest of ProXad - France