vogella training Android Training Eclipse Training

Xpand - Tutorial

Lars Vogel

Version 0.3

24.02.2011

Revision History
Revision 0.1 07.07.2010 Lars
Vogel
Created
Revision 0.2 - 0.3 24.10.2010 - 24.02.2011 Lars
Vogel
bugfixes and enhancements

Xpand

This articles describes Xpand. It is based on Eclipse 3.6 (Helios). This article is currently in EARLY DRAFT.


Table of Contents

1. Xpand
2. Installation
3. Example
4. Thank you
5. Questions and Discussion
6. Links and Literature

1. Xpand

Xpand is a template engine which allows to create text output from EMF models . The text output can be a programming language or something else. Xpand requires that you define your EMF metamodel and one or more templates which will translate the model into text. Once this definition is done you can run the code generator by defining a EMF model and by running the generator.

This article will show how to translate the website model from EMF Tutorial into an HTML representation.

2. Installation

Install the "Xpand SDK" via the Eclipse update manager .

3. Example

Create a new Xpand Project "de.vogella.xpand.htmlconvert".

Create or copy the EMF website model from the EMF tutorial into your project under the "src" folder in a new folder "metamodel". Create also the folders "model", "templates" and "workflow" in "src".

Create an instance of your model by selecting in "webpage.ecore" the "Web" model element, right-clicking on it and selecting "Create dynamic instance".

Create the file "Web.xmi" in the folder "model".

In the folder "template" create a new Xpand template "htmlTemplate.xpt".

4. Thank you

Please help me to support this article:

Flattr this

5. Questions and Discussion

Before posting questions, please see the vogella FAQ. If you have questions or find an error in this article please use the www.vogella.com Google Group. I have created a short list how to create good questions which might also help you.

6. Links and Literature

Xpand Wiki XSLT FAQ

Xpand Tutorial from Peter Friese