Visual Paradigm provides XML-based template language (DCTL - document template language), which is support many options to filter elements. You can introduce variables into templates and get flexible filter of models in different document using the same template.
But DCTL doesn't support enabling or disabling part of document. For example, there is not a direct way to enable output of the table with component's tagged values in one document, and disable this table in another documents using the same template.
I developed a simple "hack", which allows to enable/disable block via variable. It's based on that filtering by modelTypes
or stereotypes
attributes of Conditional Checkers. If you doesn't write attribute or set empty to filtering, this rule always return true. Next snippets accept any stereotypes valuee:
<HasValueChecker property="taggedValues">
<HasValueChecker stereotypes="" property="taggedValues">
Due to this behavior we can implement enable/disable blocks. For example, create a simple template as below. Take an attention on stereotypes="${disable_tagged_values}"
<ElementBaseInitiationBlock
xmlns="http://www.visual-paradigm.com/2015/DocComposer">
<Property property="name" style="@heading+"/>
<ParagraphBreak/>
<HasValueChecker stereotypes="${disable_tagged_values}" property="taggedValues">
<Text>Output of tagged values is enabled</Text>
</HasValueChecker>
<HasValueChecker stereotypes="${disable_tagged_values}" property="taggedValues" flag="false">
<Text>Output of tagged values is disabled</Text>
</HasValueChecker>
</ElementBaseInitiationBlock>
Create a simple component with tagged values:
And apply the created template to a new document. You should see:
Set a variable disable_tagged_values
to any value (true, ex.) and document is changed to Output of tagged values is disabled. If you clear the value text will be Output of tagged values is enabled.
Links
https://www.visual-paradigm.com/support/documents/vpuserguide/304/1983/86365_usingvariabl.html - Using variables in Doc. Composer
Top comments (0)