If you want to use XML in this case then your template file should be stored in xml format (sample.xml).
If you want to work with Word 2003 then
1. Create an XML Schema based on your template
2. Attach the XML Schema in your word document
3. use word automation to replace the schema content by xquery
If you want to work with Word 2007 then
1. Create an XML Schema based on your template
2. Attach the XML Schema in your word document
3. use Open XML SDK to replace the schema content by xquery
See this
[
Generating Word Reports / Documents] and
[
http://blogs.msdn.com/b/brian_jones/archive/2010/02/26/open-xml-sdk-office-services-better-together.aspx]