%dw 2.0
output text/xml encoding="UTF-16"
---
{
 result:
  {
    a: in0.users[?($$ ~= "user")] groupBy $$.@sex,
    b: in0.users[?($$ ~= "user")] groupBy ($$.@age >= 30 and $$.@age < 40),
    c: in0.users.&user groupBy (if (($$.@age as Number) >= 30)  "Old"  else "Young"),
    d: { name: "Mariano", name:"Santiago", name: "Mariano", name: "Luis" } groupBy $
  }
}