user3010912
user3010912

Reputation: 391

How to convert decimal to integer in xpath?

The input xml includes the following element:

<numberOfPayments>14.0</numberOfPayments>

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

Upvotes: 4

Views: 4560

Answers (1)

hek2mgl
hek2mgl

Reputation: 157967

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())

Upvotes: 6

Related Questions