Elements bodyChildren = body.children();
ElementUtil.appendNodes(wrappingNode, new ArrayList<Node>(bodyChildren));
// copy all the attrs to the wrapping group node
Iterator<Attribute> attrs = elem.attributes().iterator();
Attribute attr;
while (attrs.hasNext()) {
attr = attrs.next();
wrappingNode.attr(attr.getKey(), attr.getValue());
}
// a embed template file may by included many times in same parent
// template, so we have to avoid duplicated snippet refs
resetSnippetRefs(wrappingNode);