Sorry for reposting my thread from general computer support,but im new to the forum!
Hello everybody! Id like some help,i dont know how to calculate the total prize and the total items sold.There are 10 prizes and 10 items to be calculated.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Furniture</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Name</th>
<th>Address</th>
<th>Telephone number</th>
<th>Ordered_item</th>
<th>Start</th>
<th>Prize</th>
</tr>
<xsl:for-each select="Customers/Customer">
<tr>
<td><xsl:value-of select="Name"/></td>
<td><xsl:value-of select="Address"/></td>
<td><xsl:value-of select="Telephone_number"/></td>
<td><xsl:value-of select="Ordered_item"/></td>
<td><xsl:value-of select="start"/></td>
<td><xsl:value-of select="prize"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I used that format:
<P>
<xsl:value-of select="//prize[1]"/>
<xsl:text> + </xsl:text>
<xsl:value-of select="//prize[2]"/>
<xsl:text> = </xsl:text>
<xsl:value-of select="//prize[1] + //prize[2]"/>
</P>
till "//prize[10]" but it only displays : 400+=NaN
The XML file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Customers>
<Customer>
<Name>John </Name>
<Address>19 Holloway Road </Address>
<Telephone_number>07827384928 </Telephone_number>
<Ordered_item>Sofa </Ordered_item>
<start>2012-02-20</start>
<prize>400</prize>
</Customer>
<Customer>
<Name>Nick</Name>
<Address>30 Holloway Road </Address>
<Telephone_number>09382930492 </Telephone_number>
<Ordered_item>Table</Ordered_item>
<start>2012-03-10</start>
<prize>200</prize>
</Customer>
<Customer>
<Name>Roger</Name>
<Address>13 Holloway Road </Address>
<Telephone_number>07823049828 </Telephone_number>
<Ordered_item>Bedside Cabinet </Ordered_item>
<start>2012-01-14</start>
<prize>100</prize>
</Customer>
<Customer>
<Name>Duncan</Name>
<Address>92 Holloway Road </Address>
<Telephone_number>07839482712</Telephone_number>
<Ordered_item>Sofa </Ordered_item>
<start>2012-04-23</start>
<prize>450</prize>
</Customer>
<Customer>
<Name>Chris </Name>
<Address>123 Holloway Road </Address>
<Telephone_number>072839402912 </Telephone_number>
<Ordered_item>Mattresses </Ordered_item>
<start>2012-02-22</start>
<prize>120</prize>
</Customer>
<Customer>
<Name>Matt</Name>
<Address>87 Holloway Road </Address>
<Telephone_number>072839402945 </Telephone_number>
<Ordered_item>Table </Ordered_item>
<start>2012-03-07</start>
<prize>98</prize>
</Customer>
<Customer>
<Name>Jake </Name>
<Address>72 Holloway Road </Address>
<Telephone_number>07263849271 </Telephone_number>
<Ordered_item>Bedside Cabinets </Ordered_item>
<start>2012-03-02</start>
<prize>25</prize>
</Customer>
<Customer>
<Name>Amy </Name>
<Address>69 Holloway Road </Address>
<Telephone_number>07877306301 </Telephone_number>
<Ordered_item>Table </Ordered_item>
<start>2012-03-29</start>
<prize>95</prize>
</Customer>
<Customer>
<Name>Francesca</Name>
<Address>90 Holloway Road </Address>
<Telephone_number>0772732348 </Telephone_number>
<Ordered_item>Mattresses </Ordered_item>
<start>2012-01-09</start>
<prize>150</prize>
</Customer>
<Customer>
<Name>Ryann </Name>
<Address>174 Holloway Road </Address>
<Telephone_number>078290375019</Telephone_number>
<Ordered_item>Sofa </Ordered_item>
<start>2012-04-22</start>
<prize>700</prize>
</Customer>
</Customers>
Thank you in advance!
Hello everybody! Id like some help,i dont know how to calculate the total prize and the total items sold.There are 10 prizes and 10 items to be calculated.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Furniture</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Name</th>
<th>Address</th>
<th>Telephone number</th>
<th>Ordered_item</th>
<th>Start</th>
<th>Prize</th>
</tr>
<xsl:for-each select="Customers/Customer">
<tr>
<td><xsl:value-of select="Name"/></td>
<td><xsl:value-of select="Address"/></td>
<td><xsl:value-of select="Telephone_number"/></td>
<td><xsl:value-of select="Ordered_item"/></td>
<td><xsl:value-of select="start"/></td>
<td><xsl:value-of select="prize"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I used that format:
<P>
<xsl:value-of select="//prize[1]"/>
<xsl:text> + </xsl:text>
<xsl:value-of select="//prize[2]"/>
<xsl:text> = </xsl:text>
<xsl:value-of select="//prize[1] + //prize[2]"/>
</P>
till "//prize[10]" but it only displays : 400+=NaN
The XML file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Customers>
<Customer>
<Name>John </Name>
<Address>19 Holloway Road </Address>
<Telephone_number>07827384928 </Telephone_number>
<Ordered_item>Sofa </Ordered_item>
<start>2012-02-20</start>
<prize>400</prize>
</Customer>
<Customer>
<Name>Nick</Name>
<Address>30 Holloway Road </Address>
<Telephone_number>09382930492 </Telephone_number>
<Ordered_item>Table</Ordered_item>
<start>2012-03-10</start>
<prize>200</prize>
</Customer>
<Customer>
<Name>Roger</Name>
<Address>13 Holloway Road </Address>
<Telephone_number>07823049828 </Telephone_number>
<Ordered_item>Bedside Cabinet </Ordered_item>
<start>2012-01-14</start>
<prize>100</prize>
</Customer>
<Customer>
<Name>Duncan</Name>
<Address>92 Holloway Road </Address>
<Telephone_number>07839482712</Telephone_number>
<Ordered_item>Sofa </Ordered_item>
<start>2012-04-23</start>
<prize>450</prize>
</Customer>
<Customer>
<Name>Chris </Name>
<Address>123 Holloway Road </Address>
<Telephone_number>072839402912 </Telephone_number>
<Ordered_item>Mattresses </Ordered_item>
<start>2012-02-22</start>
<prize>120</prize>
</Customer>
<Customer>
<Name>Matt</Name>
<Address>87 Holloway Road </Address>
<Telephone_number>072839402945 </Telephone_number>
<Ordered_item>Table </Ordered_item>
<start>2012-03-07</start>
<prize>98</prize>
</Customer>
<Customer>
<Name>Jake </Name>
<Address>72 Holloway Road </Address>
<Telephone_number>07263849271 </Telephone_number>
<Ordered_item>Bedside Cabinets </Ordered_item>
<start>2012-03-02</start>
<prize>25</prize>
</Customer>
<Customer>
<Name>Amy </Name>
<Address>69 Holloway Road </Address>
<Telephone_number>07877306301 </Telephone_number>
<Ordered_item>Table </Ordered_item>
<start>2012-03-29</start>
<prize>95</prize>
</Customer>
<Customer>
<Name>Francesca</Name>
<Address>90 Holloway Road </Address>
<Telephone_number>0772732348 </Telephone_number>
<Ordered_item>Mattresses </Ordered_item>
<start>2012-01-09</start>
<prize>150</prize>
</Customer>
<Customer>
<Name>Ryann </Name>
<Address>174 Holloway Road </Address>
<Telephone_number>078290375019</Telephone_number>
<Ordered_item>Sofa </Ordered_item>
<start>2012-04-22</start>
<prize>700</prize>
</Customer>
</Customers>
Thank you in advance!