String template Syntax





Replaced with value of attribute.ToString() (or empty string if missing).



Replaced with value of property of attribute (or empty string if missing).



Indirect property lookup. Same as except value of expr is the property name.



Concatenation of ToString() invoked on each element.


<multi-valued-attribute; separator=expr>

Concatenation of ToString() invoked on each element separated by expr.

<users; separator=", ">


Include (i.e. call) template. argument-list is a list of attribute assignments of the form arg-of-template=exprexpr is evaluated in the context of the surrounding template not of the invoked template.



Template application. The optional argument-list is evaluated before application. The default attribute it is set to the value of attribute. If attribute is multi-valued, it is set to each element in turn and template is invoked n times where n is the number of values in attribute.

<name:checkoutReceipt(items=skus, ship=shipOpt)>

<attribute:{argument-name_ | _anonymous-template}>

Apply an anonymous template to each element of attribute. Set the argument-name to the iterated value and also set it.

<users:{s|<li>$s$</li>}; separator="\n">


If attribute has no value or is a bool object that evaluates to false, include subtemplate. These conditionals may be nested.

<if(users)> <users:{u|<u>}> <endif>

\$ or \<

escaped delimiter prevents $ or < from starting an attribute expression and results in that single character.


<\ ><\n><\t><\r>

special characters: space, newline, tab, carriage return.


<! comment !>$! comment !$

Comments, ignored by StringTemplate.

<! this is a comment !>