Convert Boolean to number in xml

Viewed 64

I'm going to convert boolean to number in XML (orbeon), and I'm using number in the formula but still it's showing boolean type.

This is my formula, I'm using round but still showing true:

round(seconds($total-time-calculation-mental)div 60 ) or round(seconds($control-2)div 60)

#Orbeon

1 Answers

This is really an XPath question rather than an XML or orbeon question.

The XPath "or" operator expects two booleans as input, and produces a boolean as output: TRUE or FALSE => TRUE. The numbers you've supplied as input are converted to booleans (0 = FALSE, anything else = TRUE), but there's no reason for the result to be converted back.

What did you actually expect this expression to return?

Perhaps you were using "or" incorrectly in a construct like (A = 5 or 6) to mean (A = 5 or A = 6)?

Or perhaps you had the Javascript usage in mind, where A || B means "if A exists then return A, otherwise return B"?

Related