Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | DSPs and building output templates | Using Output Templates to Format Service Output | What Does an Output Template Look Like?
 
What Does an Output Template Look Like?
A template is simply a String containing text and one or more tags. Tags are special commands, enclosed in % symbols, that cause webMethods Integration Server to perform a specified action—typically to insert the value of a variable—at a specified point in the String.
For example, if you have the following values in the pipeline:
Output in the Pipeline
Variable Name
Value
CompanyName
Bitterroot Boards
AccountNum
BTB-9590651
ContactName
Lauren Cheung
PhoneNum
406-721-5000
You might create a template that looks as follows to return the values in an HTML document to a browser-based client. The strings in bold are template tags instructing the server to insert specified values from the pipeline at run time.
<!--Output Template for an HTML Document-->
============================================
<!DOCTYPE HTML PUBLIC>
<HTML><HEAD><META HTTP-EQUIV="Content-Type" VALUE="text/html;chaset=UTF-
8"><TITLE></TITLE></HEAD>
<BODY><P>Contact information for account %value AccountNum% is:</P>
<TABLE>
<TR><TD><B>Account Name</B></TD><TD>%value CompanyName%</TD></TR>
<TR><TD><B>Contact Name</B></TD><TD>%value ContactName%</TD></TR>
<TR><TD><B>Phone Number</B></TD><TD>%value PhoneNum%</TD></TR>
</TABLE>
</BODY></HTML>
Output templates are not limited to HTML. You could create an output template that looks like this to return values in an XML document:
<!--Output Template for an XML Document-->
==========================================
<?xml version="1.0"?>
<ACCOUNT_INFO>
<ACCOUNT_NAME>%value AccountNum%</ACCOUNT_NAME>
<COMPANY_NAME>%value CompanyName%</COMPANY_NAME>
<CONTACT_NAME>%value ContactName%</CONTACT_NAME>
<PHONE_NUM>%value PhoneNum%</PHONE_NUM>
</ACCOUNT_INFO>
Or an output template that looks like this to return values as a comma-separated record:
<!--Output Template for a Comma-Separated
Values Record
-->
==========================================================
%value AccountNum%,%value CompanyName%,%value
ContactName%,%value PhoneNum%