On 12/19/07, Matthieu Riou <[EMAIL PROTECTED]> wrote:
>
> with(c = customer.payload.ns::customer, v = visitor.payload.ns::customer)
> {
> c.ns::firstname = v.ns::fname;
> c.ns::lastname = v.ns::lname;
> with (ca = c.ns::address, va = v.ns::address) {
> ca.ns::city = va::ns.city;
> ca.ns::zipcode = va.ns::zip;
> }
> }
I think aliasing is a good idea, although I think we can achieve it using
functions and possibly currying instead of adding syntax to the language.
How about,
c = xpath(customer.payload.ns::customer)
v = xpath(visitor.payload.ns::customer)
c.ns::firstname = v.ns::fname
c.ns::lastname = v.ns::lname
ca = xpath(c, c.ns::address)
va = xpath(v, v.ns::address)
...
Here c, v, ca and va are actually aliases to the original path. I'd also
> propose (optional) that a non-existent path used in *with* gets created if
> it doesn't exist when a *with* relies on it. So in my previous example if
> customer.payload.ns::customer doesn't exist, we create this XML structure
> and set it on customer.
>
> So the would get translated to a BPEL equivalent to:
>
> <if>
> <condition>!exists(customer.payload.ns::customer)</condition>
> <assign>
> <from><literal><ns:customer></ns:customer></literal></from>
> <to>$customer.payload</to>
> </assign>
> </if>
This has the side-effect of wiping the rest of the $customer.payload
content.
alex