Beginning of template

Every element template mush has <ElementBaseInitiationBlock>, <DiagramBaseInitiationBlock> or <ProjectBaseInitiationBlock> as root element.

The use of <ElementBaseInitiationBlock> is to tell the template engine that the template will be applied to a model element. If you are writing a template for a model element (e.g. use case, package...), use <ElementBaseInitiationBlock> as template root.

The use of <DiagramBaseInitiationBlock> is to tell the template engine that the template will be applied to a diagram. If you are writing a template for a diagram (e.g. Class Diagram...), use <DiagramBaseInitiationBlock> as template root.

The use of <ProjectBaseInitiationBlock> is to tell the template engine that the template will be applied to a project. If you are writing a template for a project, use <ProjectBaseInitiationBlock> as template root.
If you check back the example used in the previous section, you will find that the template was written to query the use cases from a diagram. The template will be applied on a diagram so <DiagramBaseInitiationBlock> was used as root element.

The following examples show the use of <ElementBaseInitiationBlock> and <ProjectBaseInitiationBlock> in templates.

<ElementBaseInitiationBlock>

    <!—Output the name of selected class-->
    <Property property="name"/>

</ElementBaseInitiationBlock>
<ProjectBaseInitiationBlock>

    <!—Output the name of all use cases in the project-->
    <IterationBlock allLevel="true" modelType="UseCase">
        <Property property="name"/>
    </IterationBlock>

</ProjectBaseInitiationBlock>

Related Resources

The following resources may help you to learn more about the topic discussed in this page.

 
1. What is Doc. Composer Template Language Table of Contents 3. Text and Property

We use cookies to offer you a better experience. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.OK