Thread:Project:Support desk/How to make a template generate working onlyinclude tags on the referring page/reply

You can't dynamically create the onlyinclude tags like that.

It sounds like there's probably a better way to do whatever you're trying to do. Either just using one template, or something like parser functions or something along those lines.