Skip to content

Format

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

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

Parameters

string name
    The name of the template.

Xml node
    The XML node to use as input for formatting.

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. When the template name is not found, this method returns an empty string rather than throwing. The supplied node determines the XML and XPath context used while rendering.

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();