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

Is there a trunc() function in XPath?

Status
Not open for further replies.

swim

Programmer
Jul 1, 2002
22
US
Hi All,

XPath provides math operation functions such as round(). But I want to TRUNCATE a real-type value.

Is there a function like trunc() in XPath?

Thanks.
 
There is not a truncate function. Basically you get "floor()" and "ceiling()" functions, which are great if you're trying for the integer value.

Here's an XPath function Reference:

Neither does EXSLT.ORG ( appear to have and extension for this.

As far as I an tell, if you're looking to round to a fixed number of decimal places instead of the integer value, you'll have to do it the old-fashioned way:
i.e. Multiply by 1XXXX, Round, Divide by 1XXXX. Hope this helps.
Ciao, K----------------
"If you were supposed to understand it, we wouldn't call it code" - FedEx
 
Thanks, what I need is ceiling(). Great help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top