title: Smooks XML-XML transformation with multiple insertion points
body: <p>I am trying to transform an xml from one format to another using smooks. The source xml looks like what is shown below:</p>
  
  <pre><code>&lt;page&gt;
      &lt;responsedata&gt;
        &lt;header&gt;
            ...
            &lt;ref_no&gt;xyz&lt;/ref_no&gt;
        &lt;/header&gt;
        &lt;detail&gt;
            &lt;acc_no&gt;x&lt;/acc_no&gt;
            &lt;ac_ccy&gt;y&lt;/ac_ccy&gt;
            &lt;avail_bal&gt;z&lt;/avail_bal&gt;
        &lt;/detail&gt;
        &lt;detail&gt;
            ...
        &lt;/detail&gt;
      &lt;/responsedata&gt;
  &lt;/page&gt;
  </code></pre>
  
  <p>I am trying to tranform the above to something like this:</p>
  
  <pre><code>&lt;detail&gt;
      &lt;ref_no&gt;xyz&lt;/ref_no&gt;
      &lt;accounts&gt;
           &lt;account&gt;
              &lt;Account_no&gt;x&lt;/Account_no&gt;
              &lt;Curr&gt;y&lt;/Curr&gt;
              &lt;Avail_Bal&gt;z&lt;/Avail_Bal&gt;
           &lt;/account&gt;
           &lt;account&gt;
              ...
           &lt;/account&gt;
      &lt;/accounts&gt;
  &lt;/detail&gt;        
  </code></pre>
  
  <p>For this, I used the following smooks configuration:</p>
  
  <pre><code>&lt;ftl:freemarker applyOnElement="responsedata"&gt;
      &lt;ftl:template&gt;&lt;!--&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
      &lt;DETAIL&gt;
        &lt;Ref_No&gt;????&lt;Ref_No&gt; //how to bring the ref_no here
        &lt;Accounts&gt;
          &lt;?TEMPLATE-SPLIT-PI?&gt;
        &lt;/Accounts&gt; 
      &lt;/DETAIL&gt;
      --&gt;&lt;/ftl:template&gt;
  &lt;/ftl:freemarker&gt;
  
  
   &lt;ftl:freemarker applyOnElement="detail"&gt;
      &lt;ftl:template&gt;&lt;!--
      &lt;Account&gt;
         &lt;Account_no&gt;${detail.acc_no}&lt;/Account_no&gt;
         &lt;Curr&gt;${detail.ac_ccy}&lt;/Curr&gt;
         &lt;Avail_Bal&gt;${detail.avail_bal}&lt;/Avail_Bal&gt;
      &lt;/Account&gt;
       --&gt;&lt;/ftl:template&gt;
   &lt;/ftl:freemarker&gt;
  </code></pre>
  
  <p>Except for the reference number, I am able to transform everything else. Any suggestions on how to accomplish this would be highly appreciated.</p>