This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: xsl mathematical calculation



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]