[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[xml-dev] Calculation.
- From: Michel.LACOMBE@fr.thalesgroup.com
- To: xml-dev@lists.xml.org
- Date: Tue, 02 Oct 2001 10:01:34 +0200
hello,
I want to show a table of calculation.
My xml file
<?xml version="1.0" encoding="UTF-8"?>
<liste xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=".\math.xsd">
<product>
<unitprice>2.00</unitprice>
<sold>5</sold>
</product>
<product>
<unitprice>3.00</unitprice>
<sold>2</sold>
</product>
</liste>
My xsl File
<?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>
Banques
</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
of all the column
</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>
<bobo>
<xsl:variable name="mul"
select="number(unitprice * sold)"/>
<xsl:value-of select="$mul"/>
</bobo>
</td>
</TR>
</xsl:template>
</xsl:stylesheet>
But I do not know how to add the last column.
Somebody can help me.
Thank you
LACOMBE MG
<<LACOMBE Michel - CLB.vcf>>
LACOMBE Michel - CLB.vcf