%dw 2.0
fun dynKeyNs(ns0: Namespace, value: Any) =
    {
      ns0#b: value
    }

fun dynAttrNs(ns0: Namespace, value: Any) =
    {
      j @(ns0#k: true): value
    }

var namespace1 = {uri: "http://acme.com", prefix: "ns0"} as Namespace

var namespace2 = {uri: "http://emca.com", prefix: "ns0"} as Namespace
---
root: {
  a: dynKeyNs(namespace1, "Test1"),
  b: dynKeyNs(namespace2, "Test2"),
  c: dynAttrNs(namespace1, "Test1"),
  d: dynAttrNs(namespace2, "Test2")
}
