Nesting in jsp includes unexpected tags
I have two components, C1 and C2. C2 can contain C1 components.
C1 has a jsp file called "c1.directive.jsp" which outputs some xml-like data:
<c1-element></c1-element>
C2 has a jsp file called "c2.directive.jsp" which outputs some xml-like data and also tries to output the directive.jsp of its C1 children:
<c2-element> // for each child, get childpath and append "directive" selector <sling:include path="<%=childpath%>" </c2-element>
When I request "[server]/content/.../c1.directive", I get the result I expect:
<c1-element></c1-element>
However, when I request "[server]/content/.../c2.directive", I get this:
<c2-element> <div class="parbase c1"> <c1-element></c1-element> <script type="text/javascript"> CQ.WCM.edit({"path":"/content/.../c1","dialog":"/apps/.../c1/dialog","type":"../c1","csp":"c1|page/menu|parbase/c1|parbase"}); </script> </div> </c2-element>Why do I get the correct response when I request the C1 directive directly, but not when the same path is sling:include'd in another jsp? Why do I get the <div> and <script> tags and how can I prevent this?