Let’s continue with our HelloWorld example. Remember that what we are supposed to do it simply to produce a text displaying "hello world from element ‘xxx’" where ‘xxx’ is the name of the model element the template is applied to.

For this purpose a "Paragraph" production node from the explorer tree contextual menu sounds good.

But first we must create a "Document definition" node.

HelloWorld4.png

Then create a "Paragraph" under it.

HelloWorld5.png

We obtain the result shown below:

HelloWorld6.png

Template tree

In the template tree, a "Paragraph" node has appeared, just below our HelloWorld and Document definition nodes. The right side of the template editor is now displaying the new Paragraph node properties because this node is the current selected node in the template tree. Don’t forget that we should rename nodes in this tree to indicate their use in no time at all.

Railway

Let’s have a look at the new railway contents. The current selected node is now of type "Paragraph" (middle icon). The input element type (left icon) is indicating "Package" because our paragraph node is child of our root node and because our root node produces only package instances. Finally the output element kind (right icon) is also "Package" because our Paragraph node being a production node, it will not navigate in the model and consequently will not change the type of the model element being processed. Practically, if we add another child node to our root, a brother node of our Paragraph node, this brother will receive a "Package" as input element.

Node properties

The important field for our example is the "Text" field where we can enter the text we what the node to produce in the output document. By default the text value is $Name . This $ notation indicates a variable value that will be replaced by the name of the element being produced, in our case a Package (remember the railway input element type). There are several possible variables available and depending on the type of the input element.

In order to fulfil our requirements for our displayed text we need to modify the text contents as follows:

HelloWorld7.png

Action: set the text as shown above.