Ashik, hopefully somebody will point you to the solution, but if not, you have at least two alternatives:
1) write your own XSLT function. In this case, please, submit it to some of XSLT code repositories like
http://aspn.activestate.com/ASPN/Cookbook/XSLT/ for public benefit
2) You may have better chances to find this function written in
Java and call it from your XSLT. The downside of calling Java function is that the mechanism for it isn't standardized, so it will decrease portability of your stylesheet. All major XSLT processors support extension functions, they only use slightly different syntax for it. If 100% portability isn't a strong requirement, java function may be a way to go.