Format¶
Applies the specified template to the current node and returns the resulting string.
1 |
|
Parameters¶
string template
Template to apply.
object options
Optional template options. This can include parameters to be used in the template, or specific formatting options.
Returns¶
The result of applying the template to the current node.
Remarks¶
Similar to XSLT formatting, this method provides a simpler way to transform XML data into HTML or other formats using templates.
The template may contain XPath expressions or variables enclosed in {{
and }}
characters. All formatting is done using the invariant culture unless otherwise specified in the options. Please refer to the Data+Templates section for more information.
Custom variables can be used in the template content using the {{$VariableName}}
format. If a variable is an object, a formatting string can be used to access properties, such as {{$VariableName.Property}}
.
Basic template:¶
1 2 3 |
|
Date formatting:¶
1 2 3 |
|
Using a variable:¶
1 2 3 4 5 |
|