Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » conditional iteration
conditional iteration [message #58111] Tue, 10 March 2009 19:47 Go to next message
Guadalupe is currently offline GuadalupeFriend
Messages: 34
Registered: July 2009
Member
Hi all,
I want to make a list of elements separated from comas from a set of
elements name of a specific type with a specific value. (letÂ’s say all "a"
elements whose type value is not "b").

I use an iteration to select all "a" elements and a Choose inside it to
select all those elements whose type value is b and I only print in the
otherwise option.

If I use the delimiter in the iteration I also get a comma for b elements,
though they are not printed.

Is there any option to put a condition in the iteration?

Btw, is there any way to know how many elements and iteration has
collected?

Thanks a lot for your answers
Re: conditional iteration [message #58161 is a reply to message #58111] Tue, 10 March 2009 20:36 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
How about this:

<c:iterate select="$yourContextHere/a[not(@type = 'b')]" var="a"
delimiter=", ">
<c:get select="$a"/>
</c:iterate>

The expression in square brackets is an XPath 'predicate'. It is relative
to the step it follows, and filters selected nodes that do not meet
satisfy the expression.

Paul
Re: conditional iteration [message #58211 is a reply to message #58161] Wed, 11 March 2009 11:40 Go to previous message
Guadalupe is currently offline GuadalupeFriend
Messages: 34
Registered: July 2009
Member
Definitely yes!!
I focused too much in the Jet2 control Tags and did not realize that I
should focus on the XPath expressions.
Thanks a lot!!
Previous Topic:[Announce] M2T XPAND 0.7.0 I200903100728 is available
Next Topic:newbie: including external jars
Goto Forum:
  


Current Time: Fri Nov 28 01:44:24 GMT 2014

Powered by FUDForum. Page generated in 0.02319 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software