Using context() within calculate or relevant binding

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

Using context() within calculate or relevant binding

Jeremy Nix
Is there a reason why you cannot use the context() function within a bind statement?  I have a need to create a calculation that depends on statements like this where I have to switch context:

// example for illustration purpose
calculate="Parent/GrandParent[@Gender <> context()/@Gender]/@Age"


I've attached a simple testcase.  If it is not possible, what is commonplace for calculations or relevancy checks that involve looking at values inside another portion of the xml hierarchy using a piece of information of the current hierarchy to form your selection.

--

Jeremy Nix
Senior Application Developer
Cincinnati Children's Hospital Medical Center


--
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

test_simple.xhtml (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Using context() within calculate or relevant binding

Erik Bruchez
Administrator
Jeremy,

You may be hitting this bug:

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

You could write something like:

calculate="for $context in . return Parent/GrandParent[@Gender <>
$context/@Gender]/@Age"

-Erik

On Wed, Jun 1, 2011 at 12:10 PM, Jeremy Nix <[hidden email]> wrote:

> Is there a reason why you cannot use the context() function within a bind
> statement?  I have a need to create a calculation that depends on statements
> like this where I have to switch context:
>
> // example for illustration purpose
> calculate="Parent/GrandParent[@Gender <> context()/@Gender]/@Age"
>
> I've attached a simple testcase.  If it is not possible, what is commonplace
> for calculations or relevancy checks that involve looking at values inside
> another portion of the xml hierarchy using a piece of information of the
> current hierarchy to form your selection.
>
> --
> ________________________________
> Jeremy Nix
> Senior Application Developer
> Cincinnati Children's Hospital Medical Center
>
>
> --
> 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