This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: xsl mathematical calculation
- From: "Andrew Welch" <andrew at thebristoldirectory dot com>
- To: <stevenson at epr dot footman-walker dot com>
- Cc: "XSL-List \(E-mail\)" <XSL-List at lists dot mulberrytech dot com>
- Date: Tue, 12 Feb 2002 15:17:36 -0000
- Subject: [xsl] RE: xsl mathematical calculation
- Reply-to: xsl-list at lists dot mulberrytech dot com
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@epr.footman-walker.com]
> Sent: Tuesday, February 12, 2002 10:20 AM
> To: xsl-list@lists.mulberrytech.com
> Cc: andrew@thebristoldirectory.com
> 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