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