add callback function to apply_template to allow modifying builtin values