Nested transclude issue

Solves the problem of transclude directives that contain transclude directives in their template.

Fixes #7240 
Fixes #4969