Hi Carlos... I got your private message... here's the answer...
Sounds like you have 2 issues... handling a large/huge message and conditionally adding a header element.
Handle the huge message by setting th filter type to SAX (default is DOM => can't handle big messages) See User Guide.
For conditionally adding the header... in the versions of Smooks in the ESB (easier in newer versions of Smooks)... easiest way is prob to do something like the following...
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.2.xsd">
<jb:bean beanId="headerDetails" class="java.util.HashMap" createOnElement="order/header">
<jb:value property="secureId" data="order/header/secureId" />
<jb:bean>
<ftl:freemarker applyOnElement="order/header">
<condition>isdef headerDetails.secureId</condition>
<ftl:template><!-- <secureId>blah</secureId> --></ftl:template>
<ftl:use>
<ftl:inline directive="addto" />
</ftl:use>
</ftl:freemarker>
</smooks-resource-list>
So.. capture details about the data in the header into a HasMap and then add a conditional on a template (having an "addto" directive) that's applied to the header fragment.