Generating Artifacts By Using Text Templates

Domain-Specific Language Tools includes a text template transformation toolkit that supports the processing of text templates. A text template is a file that contains a mixture of text blocks and control logic. When you transform a text template, the control logic combines the text blocks with the data in a model to produce an output file. You can use text templates to create text artifacts such as code files and HTML reports. For example, a model of the flow of control between the individual pages in a user interface, such as a wizard, can be passed as input to a text template. The text template can generate code and configuration files that implement that flow of control.

Note

All domain-specific language solutions include a debugging solution. The debugging solution is started whenever you press F5 or Ctrl+F5 from your domain-specific language solution. The debugging solution includes two sample text templates: one in Visual C# and one in Visual Basic.

The following are examples of tasks that you can perform by using text templates:

  • After creating models, you can iterate over their in-memory-representation (instead of their raw XML representation) to generate arbitrary text.

  • You can generate custom code by using either Visual C# or Visual Basic to navigate through a model.

  • You can generate custom reports in XML or HTML.

In This Section

Reference

Domain-Specific Language Tools