Suppose I have the following xml template:
<?xml version="1.0" encoding="UTF-8" ?>
<myXML>
<params>
<param name="a"">${A}</param>
<param name="b">${B}</param>
<param name="c">${C}</param>
</params>
</myXML>
I am looking for a way to change the template’s cotnent based on a certing condition, for example:
if (<certain condition is true>)
{
remove the line <param name="c">${C}</param> from the template
}
Please note: I am not looking to fill the value of ${C} but to remove this line from the template altogether. Sort of making the template “dynamic” rather than “static”.
Of course I can hold two different tremplates and load the right one based on the condition but prefer the approach I described above if possible.
A template can’t change itself; the whole template is parsed before it’s executed. But maybe it’s easier to find a solution for the problem if the readers understand the problem. Why is
<#if <certain condition is true>><param name="c">${C}</param></#if>not sufficient?