That's a collision between OCL keywords and UML choice of feature names.
To access UML's "package" attribute, you need to use "_package" in OCL.
The same will be true for most collisions such as this one.

Laurent Goubet
Obeo

Peter Keller a écrit :
> Dear all,
>
> Can anyone explain what is wrong with this template?
>
> [module syntaxerr('http://www.eclipse.org/uml2/2.1.0/UML')/]
>
> [template public syntaxerr(c : Class)]
>
> [comment @main /]
> [c.package/]
>
> [/template]
>
>
> I get a syntax error in the MTL editor, and the message:
>
> Quote:
>> token 'package' is invalid
>
>
> I paused after typing 'c.' and selected 'package' from the drop-down
> list. If I use 'namespace' instead of 'package', it works fine.
>
> I am using the Galileo modeling SR1 release (Linux x86_64) with Acceleo
> 2.6.0 installed from the Acceleo update site.
>
> Thanks for any help,
> Peter.
>
> P.S. In case anyone is wondering what use a template like this is, I
> would really like to use [c.package.name/] , but need to get past this
> error first.

I had been looking at the OCL standard, but hadn't spotted the collisions with the keywords...

Merci!
Peter.

Laurent Goubet wrote on Fri, 30 October 2009 11:49

Hi Peter,

That's a collision between OCL keywords and UML choice of feature names.
To access UML's "package" attribute, you need to use "_package" in OCL.
The same will be true for most collisions such as this one.