---
title: "Apply-Template"
---
Applies full template transformation on a literal, a file, or a template asset.
InedoCore::Apply-Template(
[Asset: <text>],
[OutputVariable: <text>],
[OutputFile: <text>],
[Literal: <text>],
[InputFile: <text>],
[AdditionalVariables: <%(key1: value1, ...)>],
[NewLines: <integer>]
);
Name | Format | Script Usage | Usage Notes |
---|---|---|---|
Asset (default) | text | Asset | Value note: "not using an asset". |
⇒ Store to variable | text | OutputVariable | Value note: "do not store in variable". |
Output file | text | OutputFile | Value note: "do not write to file". |
Literal | text | Literal | Variables are not expanded within the contents of this property. |
Input file | text | InputFile | |
Additional variables | %(key1: value1, ...) | AdditionalVariables | |
New lines | integer | NewLines | Specifies how to handle new lines in the output. When set to "Auto", it will attempt to match the format to the operating system of the server in context. Setting "Windows" or "Linux" will force newlines to match each format respectively. Setting "None" will pass through all new line characters unmodified. Default value is "Auto". |
Note: When reading from or writing to a file, there must be a valid server context.
# applies the a literal template and stores the result in $text
Apply-Template
(
Literal: >>Hello from $ServerName!
<% if $IsSimulation { %> This is a simulation run. <% } else { %> This is not a simulation run. <% } %>
Thanks,
$MyName
>>,
OutputVariable => $text,
AdditionalVariables: %(MyName: Steve)
);