4

The input xml includes the following element:

<numberOfPayments>14.0</numberOfPayments>

I need to convert the number to integer, with following limitations:

  • the XML is coming from an external source, I cant ask them to send me the integer
  • it has to be an XPath, I can't use any other language
0

1 Answer 1

6

You can use round(). The xpath query would be:

round(/numberOfPayments/text())

or if you are only interested in the integer part without rounding you can use floor():

floor(/numberOfPayments/text())
Sign up to request clarification or add additional context in comments.

2 Comments

Yeah, but the first will give you 15 for 14.6 the latter 14.
In my case I'm getting an integer in decimal form. The external system supposed to send me an integer, but their API is turning it into NN.00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.