In fact, you are very close to what you have. I find this helps remember that the template is essentially a C # / VB class under the hood, so when you use the <# + #> block, you really just add a member to the class.
, < # + # > , , , TransformText(), < # # > .
<
blah blah blah etc. very complex example with embedded expression like <
<