Calculate over every value
The separate XPath library computes
sum, min, max and avg
over a sequence. Edit the decimal list or add a fruit element to the
XML basket: every value contributes without a new field expression.
These examples validate values and cast explicitly to xs:decimal,
so 0.1 + 0.2 is exactly 0.3. Invalid values display an error instead of
silently becoming zero. Blank lists and empty baskets have sum 0;
their minimum, maximum and average are absent, shown as ∅.
Terminating decimal averages remain exact; repeating averages use 18 significant digits with half-even rounding. The native aggregate slice also supports integers, floats and doubles; untyped XML values convert to double unless explicitly cast. Nonnumeric minimum/maximum and duration aggregates remain unsupported. Shared XPath item, text and work limits apply; the XML reader allows 32 KiB, 64 levels and 4096 events.
See also
XPath maps and arrays · XPath sequences and columns · XPath XML tables and trees · Multi-format data tables