How to use a document as a template for another document