How to: Call a Custom Directive
When you create a text template, you can call one or more of the five built-in directives: assembly, import, template, output, and include. For example, you call the output directive by using the following syntax.
<#@ output extension=".txt" #>
In addition to calling built-in directives, you can also call custom directive processors. For more information, see Architecture of the Text Template Transformation Process.
To call a custom directive processor from a text template, you must add an extra parameter for the name of the directive processor. The name of the directive processor matches the name of its key in the registry. For more information, see Setting the Registry Key for Custom Directive Processors.
To call a custom directive processor
In your text template file, add a custom directive statement, and specify the name of the directive processor.
The syntax is as follows.
<#@ DirectiveName Processor="DirectiveProcessorName" ParameterName="ParameterValue" #>
For example, use the following syntax to call the CoolDirective custom directive, which is located in a directive processor named CustomDirectiveProcessor and requires a parameter named FileName.
<#@ CoolDirective Processor="CustomDirectiveProcessor" FileName="C:\UserFiles\data.xml" #>
Note
To debug text templates, you must set the debug parameter of the template directive. For more information, see Walkthrough: Debugging a Text Template.
Security
For more information, see Security of Text Templates.
See Also
Tasks
Walkthrough: Creating a Custom Directive Processor
How to: Call a Generated Directive
Concepts
Setting the Registry Key for Custom Directive Processors
Change History
Date |
History |
Reason |
---|---|---|
July 2008 |
Rewrote and refactored project. |
Content bug fix. |