Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [JET] <c:iterate> , arithmetic questions
[JET] <c:iterate> , arithmetic questions [message #515419] Thu, 18 February 2010 17:47 Go to next message
Samira  is currently offline Samira
Messages: 10
Registered: November 2009
Junior Member
Hi Every one Smile

I have some questions..

1) how to start an iteration with zero instead of 1.

2)can I loop on children of a certain node and have an Iterator @ the same time?

3) are any arithmetic operations are allowed?


note: I use jet to generate .c files ... ie. i dont use jet2 java tags.
Re: [JET] <c:iterate> , arithmetic questions [message #516891 is a reply to message #515419] Thu, 25 February 2010 13:18 Go to previous message
Paul Elder is currently offline Paul Elder
Messages: 849
Registered: July 2009
Senior Member
Samira:

Some answers...

Samira wrote:
> Hi Every one :)
>
> I have some questions..
>
> 1) how to start an iteration with zero instead of 1.

I assume you are doing a numerical iteration. Something like:

<c:iterate select="5" var="i">
... i will have values 1, 2, 3, 4, 5
</c:iterate>

There is no way start at a different number, but you can do arithmetic
with i:

<c:iterate select="5" var="i">
someCArray[<c:get select="$i - 1"/>] = ...
// or, with JET 1.0 compact replacement expressions:
someCArray[${$i - 1}] = ...
</c:iterate>

>
> 2)can I loop on children of a certain node and have an Iterator @ the
> same time?

I don't understand your question. Can you give me an example of what you
would like to do?

>
> 3) are any arithmetic operations are allowed?
>

Yes. XPath has four basic types: nodes (i.e. elements, attributes, ...),
strings, numbers and booleans. You can do standard arithmetic operations
on numbers, plus, there is the number() function to convert other types
to numbers.

>
> note: I use jet to generate .c files ... ie. i dont use jet2 java tags.
Previous Topic:UML2 Profile Types Not Found
Next Topic:[Xpand] Regression when migrating from 0.7.0 to 0.8.0M5
Goto Forum:
  


Current Time: Thu Sep 18 10:05:08 GMT 2014

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

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