I have a number like 12.20. I want to write xsl statement, which will get only 12. Not the fraction. Can you guys let me know if you know anything how to write it.?
- Moved by Mike Walsh FIN Friday, January 07, 2011 5:24 PM cust q (From:SharePoint - General Question and Answers and Discussion (pre-SharePoint 2010))
For that you would want to use the substring-before function. Here's an example:
<xsl:value-of select="substring-before(@NumberColumn, '.')"/>
Let me know if you need more help.
According to your description, I suggest that you can check this useful blog, it is similar to your problem:
I hope it can help you a little.
I tried, but the problem is i need to multiply after decimal point with 60 and then show the value as AA:BB.
consider 12.50 is the number then if take .50 and multiply with 60 it gives 3.0 right?
so the value will 12:30.
SO for that I tried your thing, but the problem is the decimals are rounding of and giving me 13.30. And it is the same problem if numbers are negative.
So i need the absolute number before decimal point.
There are many functions you can use to manipulate numbers/strings in XPath. Look at floor(), round(), max() if you need absolute numbers. I'm thrown off by your 13.30 because if you get 12 and add .50 * 60 to it, that's 15 not 13.30. I'm not sure exactly what you are doing here...
By any chance are you manipulating time?