Template

Template is file which use models defined into XML component. Template can be :

Code generation

For code generation, template use :

  • models defined into XML component.
  • XUL controls values of XML component filled by user.
  • default value putted.

    Template declaration (used into output element into XML component path_of_myTemplate is done with template element :

    ...
      <template uri="path_of_myTemplate" />
    ...

    path_of_myTemplate is the path of the template to use. More exactly path_of_myTemplate is the uri of the template. All templates must be stored into Templates folder of the catalog. Template uri must start with this folder.

    ...
      <template uri="/ftl/HelloWord/helloWord.ftl" />
    ...

    means there is a file /ftl/HelloWord/helloWord.ftl stored into the Templates folder of the catalog.

Template attributes

Attribute nameDescriptionRequired ?
uriTemplate URI.Yes

Default value

It's possible to put default value into template engine with param elements :

...
  <template uri="/ftl/HelloWord/helloWord.ftl" >
    <param name="myParam" value="Value of myParam" />
  </template>
...

With freemarker we can use param name into template :

  ${myParam}

Template engine

Template engine are getted with Spring descriptor. By default, Akrogen implements template engine :

Template extension give the template engine to use :

  • .ftl for Freemarker.
  • .vm for Velocity.
  • .xsl for XSLT.

You can use engine attribute of the template element, to set the template engine to use.

XUL dynamique

In this case, only Freemarker template engine is supported. Square bracket syntax ([#list, [#if) is used to describe XML component with XML well formtated.

Dynamique XUL section show how write XUL which use models defined into XML component.