Skip to content

Format

Formats a template by its name, using an optional XML node as input data.

1
$Templates.Format(name: string, node: Xml):string

Parameters

string name
    The name of the template.

Xml node
    The XML node to use as input for formatting. Optional. If not specified, the global $Xml instance is used.

Returns

The formatted template as a string. Returns an empty string if the template is not found.

Remarks

The content of the template can be in XSLT or data template format.

Basic Usage:

1
var result = $Templates.Format('Purchase Order', $Xml.SelectSingle('Order'))

Sending an Email:

1
2
3
4
$Messages.New(targetEmailAddress,
    $Templates.Subject('Purchase Order'),
    $Templates.Format('Purchase Order', $Xml.SelectSingle('Order'))
).Send();

See Also