Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » how to implement the for instruction
how to implement the for instruction [message #1027605] Wed, 27 March 2013 03:07 Go to next message
samar sousou is currently offline samar sousou
Messages: 63
Registered: March 2013
Member
Hi ,
I am looking for how implement a for loop in atl transformation.
I need an exemple.
Re: how to implement the for instruction [message #1027648 is a reply to message #1027605] Wed, 27 March 2013 04:16 Go to previous messageGo to next message
Federico Toledo is currently offline Federico Toledo
Messages: 97
Registered: April 2012
Location: Ciudad Real, Spain
Member
Hi, you have what you need in the manual

http://wiki.eclipse.org/ATL/User_Guide_-_The_ATL_Language#The_for_statement

kind regards
Re: how to implement the for instruction [message #1027655 is a reply to message #1027648] Wed, 27 March 2013 04:30 Go to previous messageGo to next message
samar sousou is currently offline samar sousou
Messages: 63
Registered: March 2013
Member
But how to emplement it in the code ATL, where and how! in rules or in helpers!! because there is an error when i implement it.
Re: how to implement the for instruction [message #1027675 is a reply to message #1027655] Wed, 27 March 2013 05:03 Go to previous messageGo to next message
Federico Toledo is currently offline Federico Toledo
Messages: 97
Registered: April 2012
Location: Ciudad Real, Spain
Member
here http://www.eclipse.org/atl/ you have a section with basic examples, and another very useful called "ATL transformations Zoo". Check them out

otherwise, share your error here
Re: how to implement the for instruction [message #1027900 is a reply to message #1027675] Wed, 27 March 2013 11:12 Go to previous message
samar sousou is currently offline samar sousou
Messages: 63
Registered: March 2013
Member
hi,
can I do like this!!

helper context XML!Element def: getStringValue(m : String) : Sequence(XML!Element) =
XML!Element.allInstances() -> select (p |
p.oclIsTypeOf(XML!Element) and p.name='a'and p.getStringAttrValue('name')= m )->asSequence();

helper context XML!Element def: getText(m : String) : String =
for(p in Xml!Element.getStringValue(m)) {
if not(p->isUndefined())
p.getStringDataValue()
else
''
endif
};



but as a response i have empty attribute

[Updated on: Wed, 27 March 2013 11:20]

Report message to a moderator

Previous Topic:XML2metamodel exemple
Next Topic:Can my idea work?
Goto Forum:
  


Current Time: Fri Apr 18 10:02:42 EDT 2014

Powered by FUDForum. Page generated in 0.01719 seconds