I have an XML file with information, for example:
Test
20
Me
One possible solution would be to change your template file to be an XML configuration, like this:
Dear ,
some text with other variables like or again
greatings
Assuming that the above XML template is named template.xml and in the same directory as the XSLT below:
When the XSLT is run against the sample XML file, it produces the following output:
Dear Test,
some text with other variables like 20 or Test again
greatings Me
As @Tomalak pointed out, unmatched placeholder elements would be removed from the output. If you wanted to preserve them, to make it apparent that the XML file did not have a match for placeholder items in the template, you could change the template that matches on the template placeholder elements like this:
$
If there was an unmatched placeholder element, for example, then it would appear in the text output as $foo.