I want to create a script that will generate a file and do something with it.
For start I have created a mwe file that contains:
<workflow>
.....
.....
<component id="generator" class="org.eclipse.xpand2.Generator">
<metaModel id="mm" class="org.eclipse.xtend.typesystem.emf.EmfMetaModel">
<metaModelPackage value="grammarmodel.GrammarmodelPackage"/>
</metaModel>
<expand value="templates::createDialogGrammar::Root for model"/>
<outlet path="${generatedPath}/">
<fileEncoding value="ISO-8859-1"/>
</outlet>
</component>
....
</workflow>

I also have the createDialogGrammar.xpt that contains a simple define:
«IMPORT grammarmodel»

It seems that the problem is related to the metamodel loaded.
I was trying to load grammarmodel.GrammarmodelPackage metamodel but somehow the metaModelPackage value(path) is not correct.
I replaced the metamodel value with ContiSpeechDlg.ContiSpeechDlgPackage and it worked.
Note: I have 2 .ecore files that I wanted to use(ContiSpeechDlg.ContiSpeechDlgPackage and grammarmodel.GrammarmodelPackage), only with ContiSpeechDlg.ContiSpeechDlgPackage it worked.

The <expand> tag was correct, it pointed to <package_name>::<xpt_name>::<define_name_from_xpt>.

I still have some troubles finding a good and explanatory documentation for those mwe scripts(Ant?!), what tags should I use and when and the correct syntax for it.
Thank you for you time spend in trying to figure it out.