The first answer that came to mind, using standard OCL, was :
[for (cf:ControlFlow |c.ownedElement->select(a|a.oclIsKindOf(ControlFlow))->sortedBy(e: Element | e.oclAsType(ControlFlow).name))]
Pretty verbose ... If we instead make use of the implicit iterators Acceleo offers, the expression can be simplified to
But this still sports the redundancy of filtering from a list only the elements of a given type (select) and then casting the elements to ... that very same type (oclAsType). This is due to OCL not allowing Acceleo to infer the return type of the select operation. Starting from Acceleo 3.0, this expression can also be written
Now that's better!