INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

XML-XSL calculation

XML-XSL calculation

(OP)
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!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close