[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

newbie questions (calculating sums on ranges of values

Subject: newbie questions (calculating sums on ranges of values)
From: "Mazza, Glen" <glen.mazza@xxxxxxx>
Date: Mon, 22 Jan 2001 18:27:31 -0500
calculating sums
Hello, let's say I have an XML showing, for a library, the number of books
that were a given number of days overdue:

<libraries>
	<library name = "City Library">
		<overdue days = "1" count = "15"/>
		<overdue days = "4" count = "2" />
		<overdue days = "5" count = "4" />
		<overdue days = "6" count = "7" />
	</library>
	<library name = "Branch Library #1">
		<overdue days = "2" count = "12" />
		<overdue days = "7" count = "5"  />
		<overdue days = "18" count = "2" />
	</library>
	...
</libraries>

I want to create a three-column HTML table, showing for each library, the
number of books that were 1-4 days overdue and the number of books that were
5 days overdue:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<HTML><BODY>
<table border="border">
<tr><th>Name</th><th>1-4days</th><th>5+ days</th></tr>
<xsl:for-each select="libraries/library">
<tr>
<td><xsl:value-of select="@name"/></td>
<td>WHAT GOES HERE???</td>
<td>WHAT GOES HERE???</td>
</tr>
</xsl:for-each>
</table>
</BODY></HTML>
</xsl:template>
</xsl:stylesheet>

1)  Question:  what is the syntax for the sum where "1 < overdue days < 4"
and "overdue days > 4"?

2)  Also, if I were to break out the count into separate tags (perhaps
because I had other types of overdue information):

<library name = "Branch Library #1">
	<overdue days = "2">
		<count>12</count>
	</overdue>
	<overdue days = "7">
		<count>5</count>
	</overdue>
	<overdue days = "18">
		<count>2</count>
	</overdue>
</library>

How would the syntax in #1 above change?

Thanks,
Glen

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.