Check more compound inheritance chains. >>>>templates/test.tpl <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <opt:extend file="extended1.tpl"> <opt:snippet name="foo"> FOO-VALUE1 </opt:snippet> </opt:extend> >>>>templates/extended1.tpl <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <opt:extend file="extended2.tpl"> <opt:snippet name="foo"> FOO-VALUE2 </opt:snippet> <opt:snippet name="goo"> GOO-VALUE2 </opt:snippet> </opt:extend> >>>>templates/extended2.tpl <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <opt:root> BEGIN <opt:insert snippet="foo" /> <opt:insert snippet="goo" /> END </opt:root> >>>>expected.txt OUTPUT >>>>result.txt BEGIN FOO-VALUE1 GOO-VALUE2 END