Microsoft has published a "document generator" tool as a sample. This is an article that describes the architecture and operation of the sample app in some detail.
If you just want to use the document generation tool, click here and install the MSI. It requires no programming.
It's free. The source is available. Requires the .NET Framework to run. Works only with XSDs. (not Relax NG or DTD).