I'm not sure if this is relevant to your problem.
I have written a little tool (in powershell, of all things) that applies the data in a csv file to a template. Each record in the csv supplies actual values for an expansion of the template, with variables in the template replaced by actual values from the csv. Using the appropriate template, you can get the output in just about any format you want, although it's stashed in a text file.
This tool might not be suitable for your purposes, but the same tool can be implemented in lots of different languages, with a little work.
Ok, here goes... It's probably cruddy powershell, because this is just a learning exercise for me. But it works ok for me. The output goes into the pipeline by default, but it's easy to redirect the output to a file. It might be easier to follow if I added a sample csv file and template.
<# This function is a table driven template tool. It's a refinement of an earlier attempt. It generates output from a template and a driver table. The template file contains plain text and embedded variables. The driver table (in a csv file) has one column for each variable, and one row for each expansion to be generated. 5/13/2015 #> function Expand-csv { [CmdletBinding()] Param( [Parameter(Mandatory=$true)] [string] $driver, [Parameter(Mandatory=$true)] [string] $template ) Process { $OFS = "`r`n" $list = Import-Csv $driver [string]$pattern = Get-Content $template foreach ($item in $list) { foreach ($key in $item.psobject.properties) { Set-variable -name $key.name -value $key.value } $ExecutionContext.InvokeCommand.ExpandString($pattern) } } }