Alrd
Alrd

Reputation: 1

XQuery: compute product

I am trying to find a method like the function sum() in XQuery that performs the same thing for product. Any help with that?

sum(/root//elemnts)

Upvotes: 0

Views: 39

Answers (1)

Martin Honnen
Martin Honnen

Reputation: 167516

Use fold-left e.g. fold-left(/root//elemnts, 1, function($p, $e) { $p * $e }).

Upvotes: 2

Related Questions