Dave,
Thanks for the help. I finally found the solution elsewhere on the forum. Here's the post, by Dan Wickstrom:
https://openacs.org/forums/message-view?message_id=53556
The key piece I needed was template::adp_compile, which can accept either a string or a filename: https://openacs.org/api-doc/proc-view?proc=template%3A%3Aadp_compile
Kind regards,
Justis