A transformation document generation mechanism (TDGM) for automatically generating a transformation document given a source document and a target document is disclosed. The TDGM analyzes each document and builds a pattern dictionary for each that records the patterns found in that document. Thereafter, the TDGM processes the pattern dictionaries to automatically generate the transformation document. In doing so, the TDGM automatically generates pattern creation templates in the transformation document. These templates (when invoked by a transformation processor at a later time while processing a source document with the transformation document) will cause particular patterns to be created in a result document. In addition, the TDGM generates zero or more copy templates in the transformation document to copy identical elements, if any, from the source document to the result document. Once that is done, the transformation document is created and may be refined by a user. By performing much of the underlying document analysis for the user, and by generating an initial transformation document, the TDGM simplifies the transformation document creation process.