I have an XML file with information, for example:
Test
20
Me
As @Mads Hansen suggests, if you can use a XML based template this can be solved in an easier, and imo better way.
Here's a solution with a XML template as input.
XML template as input:
Dear ,
some text with other variables like or again
greatings
XSLT:
Test
20
Me
Output:
Dear Test,
some text with other variables like 20 or Test again
greatings Me
If you use the XML template as input, this is one possible way to solve it. The different values to fill you template with could of course be fetched from an external XML file with fn:document() aswell:
Update: As @Tomlak commented the above solution isn't very flexible so here is an updated one:
XSLT:
Test
20
Me
Found unknown variable in template:
Note that this is a different approach since it uses the template as input document and not the list of variables. Why? To me it makes more sense to use the letter template as input since it's actully that document you transform and get as output.