[xsl] RE: xsl mathematical calculation

Subject: [xsl] RE: xsl mathematical calculation
From: "Andrew Welch" <andrew@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 12 Feb 2002 15:17:36 -0000
Hi,

You can use div and mod to work this out.  Div basically is divide, while
mod gives the remainder.  Div will return a decimal, so you need to find its
floor.

So if variable $duration holds the number 130:

<xsl:value-of select="floor($duration div 60)"/>

will return 2

<xsl:value-of select="$duration mod 60"/>

will return 10


cheers

andrew

===



>  -----Original Message-----
> From: 	stevenson [mailto:stevenson@xxxxxxxxxxxxxxxxxxxxxx]
> Sent:	Tuesday, February 12, 2002 10:20 AM
> To:	xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Cc:	andrew@xxxxxxxxxxxxxxxxxxxxxxx
> Subject:	xsl mathematical calculation
>
> i have 130 minutes
> What i want to do is to do a calculation and output it in terms of hours
and minutes i.e
>
> 2Hrs, 10 Mins.
>
> How can i do that?
>
> Can someone assist
>
> Stevenson Ngila
> Footman-Walker Associates Ltd
>
>


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


Current Thread