Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL arithmetic operations...complete newbie to XSL..

Status
Not open for further replies.

ashvn

Programmer
Mar 21, 2001
33
MU
Hi all!

I'm completely new to XSL and I'm trying to do some simple calculations using variables and arithmetic operators. However, I can't figure how to do divide operations. Here's what I'm trying to do:

<xsl:value-of select=&quot;format-number(((($mySecondVar - $myFirstVar) / $myFirstVar)*100), '##0.00')&quot;/>

I can't get the division part to work.

Basically, I'm trying to get the % increase from 'myFirstVar' to 'mySecondVar'. Is there a way to do divisions with XSL, or is there an alternate way to do the calculation?

Thanks in advance!!
;)

 
Instead of using / to indicate division you need to use the operator &quot;div&quot;.

<xsl:value-of select=&quot;format-number(((($mySecondVar - $myFirstVar) div $myFirstVar)*100), '##0.00')&quot;/>

Hope that helps.

-Mary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top