title: Iterate over cursor in Oracle SOA XSL transform
body: <p>I have a basic application, where I get Loan Products list from database and show to users. I wrote a xsl transform file, where I iterate over resultset and add each row as a Loan Product. But the final List is filled with the same objects.</p>
  
  <p>My composite.xml:</p>
  
  <p><a href="https://i.stack.imgur.com/Yz2C9.png" rel="nofollow"><img src="https://i.stack.imgur.com/Yz2C9.png" alt="enter image description here"></a></p>
  
  <p>GetLoanProductsBPEL content:</p>
  
  <p><a href="https://i.stack.imgur.com/uKG5Q.png" rel="nofollow"><img src="https://i.stack.imgur.com/uKG5Q.png" alt="enter image description here"></a></p>
  
  <p>And Transform1 file content inside of GetLoanProductsBPEL component:</p>
  
  <p><a href="https://i.stack.imgur.com/5Heay.png" rel="nofollow"><img src="https://i.stack.imgur.com/5Heay.png" alt="enter image description here"></a></p>
  
  <p>In database I have 3 loan products:</p>
  
  <p><a href="https://i.stack.imgur.com/J5d0C.png" rel="nofollow"><img src="https://i.stack.imgur.com/J5d0C.png" alt="enter image description here"></a></p>
  
  <p>But as result I get 3 instances of the same loan product:</p>
  
  <pre><code>&lt;env:Body&gt;
      &lt;inp1:GetLoanProductsResponse xmlns:inp1="http://xmlns.oracle.com/singleString"&gt;
          &lt;inp1:LoanProduct&gt;
              &lt;inp1:Id&gt;1&lt;/inp1:Id&gt;
              &lt;inp1:Name&gt;Cash loan&lt;/inp1:Name&gt;
              &lt;inp1:MaxAmount&gt;100000&lt;/inp1:MaxAmount&gt;
              &lt;inp1:InterestRate&gt;12&lt;/inp1:InterestRate&gt;
              &lt;inp1:MaxPeriod&gt;60&lt;/inp1:MaxPeriod&gt;
          &lt;/inp1:LoanProduct&gt;
          &lt;inp1:LoanProduct&gt;
              &lt;inp1:Id&gt;1&lt;/inp1:Id&gt;
              &lt;inp1:Name&gt;Cash loan&lt;/inp1:Name&gt;
              &lt;inp1:MaxAmount&gt;100000&lt;/inp1:MaxAmount&gt;
              &lt;inp1:InterestRate&gt;12&lt;/inp1:InterestRate&gt;
              &lt;inp1:MaxPeriod&gt;60&lt;/inp1:MaxPeriod&gt;
          &lt;/inp1:LoanProduct&gt;
          &lt;inp1:LoanProduct&gt;
              &lt;inp1:Id&gt;1&lt;/inp1:Id&gt;
              &lt;inp1:Name&gt;Cash loan&lt;/inp1:Name&gt;
              &lt;inp1:MaxAmount&gt;100000&lt;/inp1:MaxAmount&gt;
              &lt;inp1:InterestRate&gt;12&lt;/inp1:InterestRate&gt;
              &lt;inp1:MaxPeriod&gt;60&lt;/inp1:MaxPeriod&gt;
          &lt;/inp1:LoanProduct&gt;
      &lt;/inp1:GetLoanProductsResponse&gt;
  &lt;/env:Body&gt;
  </code></pre>
  
  <p>When I look at Flow Trace, I see that inside Invoke I get 3 different records, but after Transform1 the same record is written 3 times.</p>
  
  <p>Invoke1 trace:</p>
  
  <p><a href="https://i.stack.imgur.com/MlOPY.png" rel="nofollow"><img src="https://i.stack.imgur.com/MlOPY.png" alt="enter image description here"></a></p>
  
  <p>ReplyOutput after transformation:</p>
  
  <p><a href="https://i.stack.imgur.com/h6sOf.png" rel="nofollow"><img src="https://i.stack.imgur.com/h6sOf.png" alt="enter image description here"></a></p>
  
  <p>Transform1 XSLT file source code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;?oracle-xsl-mapper
   &lt;!-- SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY. --&gt;
   &lt;mapSources&gt;
     &lt;source type="WSDL"&gt;
       &lt;schema location="../payments_dwh.wsdl"/&gt;
       &lt;rootElement name="VMbLoanProductsCollection" namespace="http://xmlns.oracle.com/pcbpel/adapter/db/top/payments_dwh"/&gt;
     &lt;/source&gt;
   &lt;/mapSources&gt;
   &lt;mapTargets&gt;
     &lt;target type="WSDL"&gt;
       &lt;schema location="../GetLoanProductsBPEL.wsdl"/&gt;
       &lt;rootElement name="processResponse" namespace="http://xmlns.oracle.com/PashaMobileBankingWs/PashaMobileBankingWS/GetLoanProductsBPEL"/&gt;
     &lt;/target&gt;
   &lt;/mapTargets&gt;
   &lt;!-- GENERATED BY ORACLE XSL MAPPER 11.1.1.7.0(build 130301.0647.0008) AT [WED OCT 19 17:41:51 AZST 2016]. --&gt;
    ?&gt;
    &lt;xsl:stylesheet version="1.0"
              xmlns:client="http://xmlns.oracle.com/PashaMobileBankingWs/PashaMobileBankingWS/GetLoanProductsBPEL"
              xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
              xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
              xmlns:top="http://xmlns.oracle.com/pcbpel/adapter/db/top/payments_dwh"
              xmlns:mhdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.mediator.service.common.functions.MediatorExtnFunction"
              xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
              xmlns:oraext="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:dvm="http://www.oracle.com/XSL/Transform/java/oracle.tip.dvm.LookupValue"
              xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
              xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
              xmlns:med="http://schemas.oracle.com/mediator/xpath"
              xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
              xmlns:bpm="http://xmlns.oracle.com/bpmn20/extensions"
              xmlns:xdk="http://schemas.oracle.com/bpel/extension/xpath/function/xdk"
              xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions"
              xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
              xmlns:xsd="http://www.w3.org/2001/XMLSchema"
              xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
              xmlns:ora="http://schemas.oracle.com/xpath/extension"
              xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
              xmlns:tns="http://xmlns.oracle.com/pcbpel/adapter/db/PashaMobileBankingWs/PashaMobileBankingWS/payments_dwh"
              xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
              exclude-result-prefixes="xsi xsl top plt xsd wsdl tns client plnk xp20 bpws mhdr bpel oraext dvm hwf med ids bpm xdk xref ora socket ldap"&gt;
   &lt;xsl:template match="/"&gt;
     &lt;client:processResponse&gt;
       &lt;xsl:for-each select="/top:VMbLoanProductsCollection/top:VMbLoanProducts"&gt;
         &lt;client:LoanProduct&gt;
           &lt;client:Id&gt;
             &lt;xsl:value-of select="top:id"/&gt;
           &lt;/client:Id&gt;
           &lt;client:Name&gt;
             &lt;xsl:value-of select="/top:VMbLoanProductsCollection/top:VMbLoanProducts/top:nameAz"/&gt;
           &lt;/client:Name&gt;
           &lt;client:MaxAmount&gt;
             &lt;xsl:value-of select="/top:VMbLoanProductsCollection/top:VMbLoanProducts/top:maxAmount"/&gt;
           &lt;/client:MaxAmount&gt;
           &lt;client:InterestRate&gt;
             &lt;xsl:value-of select="/top:VMbLoanProductsCollection/top:VMbLoanProducts/top:interestRate"/&gt;
           &lt;/client:InterestRate&gt;
           &lt;client:MaxPeriod&gt;
             &lt;xsl:value-of select="/top:VMbLoanProductsCollection/top:VMbLoanProducts/top:maxPeriod"/&gt;
           &lt;/client:MaxPeriod&gt;
         &lt;/client:LoanProduct&gt;
       &lt;/xsl:for-each&gt;
     &lt;/client:processResponse&gt;
   &lt;/xsl:template&gt;
  </code></pre>
  
  <p></p>