The Gadget Doctor worte:
I'm having a bit of a fight with the <onlyinclude> <includeonly> and <noinclude> tags and transclusion.
I would like to have a template that passes a category on once only:
Page A -> Page B -> Template
Page A transcludes Page B Page B transcludes Template
I would like a category to be applied to Page B (from the template) but not to Template or Page A.
I can apply the category to Page B and not Template with the following on the template:
<includeonly>[[Category:Web Citation]]</includeonly>
But that then gets passed on to Page A if I transclude Page B.
I'm sure there's a way, I'm just stumped!
GadgetDoctor
I don't think there's a way only with <onlyinclude> & Co. The easiest would be passing from page B a parameter to the template which defines if the categories shall appear or not. Then conditionally define it. So it could be somehting as ugly as: {{MyTemplate|addcategory={{#if:<includeonly>1</includeonly>|no|yes}} }}