[xsl] for-each loops: arithmetic functions

Subject: [xsl] for-each loops: arithmetic functions
From: "Mazza, Glen" <glen.mazza@xxxxxxx>
Date: Tue, 2 Jan 2001 17:40:03 -0500
Pardon the newbie question (I couldn't find an answer in the archives), but
I am trying to use arithmetic operators in the XSL for-each loops.  For
example, assume the following sample XML:

		<name>City Library</name>
		<name>Branch Library #1</name>
		<name>Branch Library #2</name>

It is trivial to output the values in a listing:

<xsl:for-each select="libraries/library">
Name:		<xsl:value-of select="name"/><BR/>
# books overdue: <xsl:value-of select="booksOverdue"/><BR/>
total days overdue: <xsl:value-of select="totalDaysOverdue"/><BR/>
fine per day: 	<xsl:value-of select="finePerDay"/><BR/>

But I would like the average days overdue for each book (=
booksOverdue/totalDaysOverdue), , not the total.
I also would like to display the total fines collected, not the fines per
day:  (=finePerDay * totalDaysOverdue).

However, XSL doesn't appear to let me use these statements:

average days overdue: 	<xsl:value-of select="totalDaysOverdue" div
total $ collected: 	<xsl:value-of select="finePerDay" *

I possibly have the syntax wrong.  This appears to be a very simple problem,
but I can't seem to find the answer anywhere.

Thanks for your help,

Glen Mazza
* E-Mail:  glen.mazza@xxxxxxx

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread