Use the price calculation I proposed in your other question and run it for each order. The problem is the exact same in both questions, putting fn:sum()
at the wrong position.
for $order in /mo/orders/order
return concat
(
$order/@ono,
'-',
fn:sum(
for $item in $order/items/item
return /mo/parts/part[@pno = $item/partNumber]/price * $item/quantity
)
)