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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Math function in XSL

Status
Not open for further replies.

crazysexycrazy

Technical User
May 21, 2007
5
AU
Hey i just want to calculate some numbers from my xml document. Here is my code

<Users>
<User id="001">
<User_Details>
<User_Name>John</User_Name>
<User_Number1>360</User_Number1>
<User_Number2>300</User_Number2>
<Difference>60</Difference>
</User_Details>
</User>
</Users>

How do i get my xslt to take <User_Number1> from <User_Number2> and output the difference of 60?
I'm not even sure i need <Difference>60</Difference>

Thanks, help would be appreciated.
 
Here is a hint:
Code:
<xsl:value-of select="/Users/User/User_Details/User_Number1 - /Users/User/User_Details/User_Number2"/>
Your actual XPath expression might be different depending on the context in which you need to place the <xsl:value-of> element.

Tom Morrison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top