I have a element with a child element name nextElement
a.nextElement is b
b.nextElement is c
c.nextElement is d
When I do a request a->closure(a.nextElement) I expect to get a set with b, c and d but I only get b. What I am not understanding or doing wrong?
Have you tried something like?:
a -> closure(child:Element | true)
true is an expression. You can specify there any condition you need.
I saw it here
Even though I'm not sure that closure
is included in Acceleo API (I repeat, not sure). I tried to use closure
function but the IDE didn't suggested it to me.
In my project, I made this generic query by my own:
[query public descendants(aElement : Node):
Set(Node) = if (aElement.oclIsTypeOf(Element)) then
Set{aElement} -> union (aElement.oclAsType(Element).children
-> collect (n : Node | descendants(n)) -> asSet() )
else
Set{aElement}
endif
/]
I hope this would help !!!