Common JET Tags
JET includes four tag libraries, which are collections of related tags. These are:
- Control tags - used for accessing the input model, and controlling template execution.
- Format tags - used to alter (format) text in templates according to certain rules.
- Java tags - special tags useful to generating Java code.
- Workspace tags - used for creating workspace resources, such as files, folders and projects.
Although there are many tags available, only a few are needed to get started.
These tags are either control or workspace tags
Most common control tags
Control tags usually access the input model, and either produce a value, or cause an action based on the information
extracted from the input model. The control tags access the input model via XPath expressions.
(See
Essential XPath).
Three control tags are used frequently:
-
c:get
- Write a value from the input model into the expanded template.
-
c:iterate
- Traverse elements in the input model and evaluate the contained template text once for each element.
-
c:set
- create or set an attribute on a model element. This is frequently used to store the result of a calculation.
Most common workspace tags
Three workspace tags are used frequently:
-
ws:file
- Write a workspace file, settings its contents to the result of expanding a template.
-
ws:folder
- Create a workspace folder.
-
ws:project
- Create a workspace project.
Accessing model elements within tag attributes
Frequently, templates must use a model value in a tag's attribute. For example, the name of a generated file
might depend on a value from the input model. To do this, the main.jet
template would require a ws:file
that looks like:
<ws:file template="..." path="... value from the model..."/>
Because JET does not permit one XML tag to be embedded in an attribute value of another, JET provides
Dynamic XPath Expressions, which can be used only in tag attribute values. The format of a dynamic
XPath expression is:
{XPath expression}
So, the ws:file
tag above would be written as:
<ws:file template="..." path="{XPath expression}"/>