context() within @calculate

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

context() within @calculate

Marko Ebert, Ebert d.o.o.
Hello everyone!

I'm trying to use context() within @calculate on a bound nodeset, but am getting what to me are unexpected results. Specifically the following
<bind nodeset="instance('some-instance')/some-node/some-other-node" calculate="name(context())" />
calculates a value equal to name(instance('some-instance')) while I would expect it to result in the name of some-other-node.
Meanwhile calculate="name()", calculate="./name()" and calculate="name(self::*)" return some-other-node as expected.

Please note this is a test case to illustrate my confusion. I stumbled on this while trying to use context() in a more complex @calculate where "self::*" appropriately evaluates to another node.

Can someone suggest a different way to the same result (namely the context of the current node).

Thanks!

Marko

P.S. I'm using latest nightly CE build (though behaviour was the same under a build about 4m old).




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: context() within @calculate

Erik Bruchez
Administrator
Marko,

This might be the same as this bug which we noticed recently:

http://forge.ow2.org/tracker/index.php?func=detail&aid=315688&group_id=168&atid=350207

It is certainly a bug. For now I have  added a reference to your
example to the bug.

-Erik

On Mon, Dec 27, 2010 at 11:41 PM, Marko Ebert, Ebert d.o.o.
<[hidden email]> wrote:

> Hello everyone!
>
> I'm trying to use context() within @calculate on a bound nodeset, but am
> getting what to me are unexpected results. Specifically the following
> <bind nodeset="instance('some-instance')/some-node/some-other-node"
> calculate="name(context())" />
> calculates a value equal to name(instance('some-instance')) while I would
> expect it to result in the name of some-other-node.
> Meanwhile calculate="name()", calculate="./name()" and
> calculate="name(self::*)" return some-other-node as expected.
>
> Please note this is a test case to illustrate my confusion. I stumbled on
> this while trying to use context() in a more complex @calculate where
> "self::*" appropriately evaluates to another node.
>
> Can someone suggest a different way to the same result (namely the context
> of the current node).
>
> Thanks!
>
> Marko
>
> P.S. I'm using latest nightly CE build (though behaviour was the same under
> a build about 4m old).
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing
> list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws