Abstract
This paper proposes a method to integrate a template engine for web applications in a strongly-typed functional language. A template is essentially a text file and is read at runtime as a string; therefore, operations on templates are usually untyped. This means that the type system of a host language cannot ensure the consistency between templates and host programs. The proposed method gives templates ML record types and performs dynamic typecheck of templates based on the mechanism of partially dynamic records, which is for dealing with dynamic external data in a statically typed language. This paper also reports the implementation of the proposed system in SML# compiler, evaluates its usability, and discuses further extensions.