Currently it is not possible to nest <includeonly> or <onlyinclude>, with all tags being processed on the page they appear.
I would like to propose that these tags be permitted to be nested, as this would allow templates to add <includeonly>, <onlyinclude> and <noinclude> tags to pages that use those templates, with deeper nesting allowing these tags to be passed higher and higher up the calling chain. Currently this is not possible at all, not even passing the tags up one level only, so the example below cannot be done.
ChildTemplate:
This text will appear on all pages.
<includeonly>
This text will only appear on pages using ChildTemplate.
<noinclude>
This category will only appear on templates using ChildTemplate,
but not on any templates using those ones.
[[Category:Templates directly using ChildTemplate]]
</noinclude>
</includeonly>MainTemplate:
This text will appear on any page using MainTemplate.
{{ChildTemplate}}Article:
This is the article text.
{{MainTemplate}}With the proposed change, the pages would appear as follows:
ChildTemplate:
This text will appear on all pages.
MainTemplate:
This text will appear on any page using MainTemplate.
This text will appear on all pages.
This text will only appear on pages using ChildTemplate.
<noinclude>
This category will only appear on templates using ChildTemplate,
but not on any templates using those ones.
[[Category:Templates directly using ChildTemplate]]
</noinclude>Article:
This is the article text. This text will appear on any page using MainTemplate. This text will appear on all pages. This text will only appear on pages using ChildTemplate.
Here, MainTemplate has some content enclosed in <noinclude> tags, but these tags are not present in MainTemplate's wikitext - the tags come from a child template, which is currently impossible.
This change would not break any current functionality, as nesting these tags currently has no effect, so they are never nested.