Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | DSPs and building output templates | Using Output Templates to Format Service Output | Creating an Output Template
 
Creating an Output Template
You can use Designer to create an output template, or you can create an output template file using an ordinary text editor.
When you create an output template, keep the following points in mind:
*You must give the output template file a name that is unique within the package in which it resides.
*If you plan to assign the output template to a service, the template file must reside in the \templates directory of the package where the service resides (i.e., Integration Server_directory \packages\packageName\templates).
*If you specify a file encoding other than UTF-8 in the <meta> tag of your template’s content, the characters that you use in your template (including the data inserted into your template using %VALUE% statements) are limited to those in the character set of the encoding you choose.
To create the contents of an output template file, type all literal text exactly as you want it to appear in the result and then embed any of the following tags where you want the server to execute them at run time. For a complete description of each tag, see Tag Descriptions.
Important:
These tags are case sensitive and must be typed exactly as shown in this document. Additionally, all text between %…% symbols in a tag must appear on one line (i.e., a tag cannot contain line breaks).
Use this tag...
To...
%value VarName%
Insert the value of the specified variable into the output string.

%scope DocumentName%
.
.
.
%end%
Limit the scope for the enclosed block of code to those elements in the specified document.

%loop VarName%
.
.
.
%end%
Repeat the enclosed block of code once for each element in the a specified array variable.

%ifvar VarName%
.
.
.
%end%
Conditionally include the enclosed block of code if a variable exists or matches a specified value.

%switch VarName%
%case Value1%
%caseValue2%
%case Value3%
.
.
.
%end%
Conditionally include a block of code depending on the value of a specified variable.
%includeTemplateName%
Insert and execute a specified output template.
%validConst urlurl1,url2,...,urln)%
%endvalidConst%
Limit the external URLs that can be accessed via redirection.
%nl%
Insert new line in the output string.

%comment%
.
.
.
%end%
Omit the enclosed block of text from the output.
%rename VarName NewVarName%
Change the name of a variable for the purpose of referencing it in the output template. This may be necessary if you include predefined output templates that use variable names that are different from those in the pipeline.
For steps for creating an output template using Designer, see webMethods Service Development Help.