See the document titled Using Custom Functions in SLAX Scripts for a discussion of functions versus templates.