{
 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"),
    //xml output
    d: { name: "Mariano", name:"Santiago", name: "Mariano", name: "Luis" } groupBy $,
    e: in1.orders.&item groupBy $."type",

    //json output
    f: { name: "Mariano", name:"Santiago", name: "Mariano", name: "Luis" }.*name groupBy $,
    g: in1.orders.*item groupBy $."type"
  }
}