I have many input fields in Orbeon in Form builder as
war3, and not all fields have to be filled. I want to make a sum of this fields (I can't make them repeatable because I want to reset it via web service), but when some of the fields are empty, the sum doesn't display. Using an initial value doesn't resolve the problem because I want to set values via a web service, and sometimes the values returned by the service are empty string.
Assuming your fields are named
sum(($war1, $war2, $war3)[string() castable as xs:decimal], 0.0)
And for some background on this, see the blog post Formulas for summing values, done right, which is exactly about this topic. (The very fact that there is a blog entry about this tells you that this is rather subtle, which makes your question all the more justifiable.)