XSLT Mapping using foreach
<p>This is the sample XML data that i am using and then i have to pass all the values to an additional properties tag.. </p>

<pre><code>&lt;ns1:Quote&gt;
&lt;ns1:QuoteVendor&gt;123&lt;/ns1:QuoteVendor&gt;
&lt;ns1:QuoteNumber&gt;sai&lt;/ns1:QuoteNumber&gt;
&lt;ns1:QuoteVersion&gt;sri&lt;/ns1:QuoteVersion&gt;
&lt;ns1:QuoteValue&gt;sas&lt;/ns1:QuoteValue&gt;
&lt;ns1:QuoteProperty&gt;sandy&lt;/ns1:QuoteProperty&gt;
&lt;/ns1:Quote&gt;
</code></pre>

<p>After transformation using XSLT i am expecting the format as </p>

<pre><code>&lt;AdditionalProperties&gt;
&lt;ns1:Properties&gt;
&lt;ns1:Propertyname&gt;QuoteVendor&lt;/ns1:Propertyname&gt;
&lt;ns1:propertyValue&gt;123&lt;/ns1:propertyValue&gt;
&lt;/ns1:Properties&gt;
&lt;ns1:Properties&gt;
&lt;ns1:Propertyname&gt;QuoteNumber&lt;/ns1:Propertyname&gt;
&lt;ns1:propertyValue&gt;sai&lt;/ns1:propertyValue&gt;
&lt;/ns1:Properties&gt;
&lt;ns1:Properties&gt;
&lt;ns1:Propertyname&gt;QuoteVersion&lt;/ns1:Propertyname&gt;
&lt;ns1:propertyValue&gt;sri&lt;/ns1:propertyValue&gt;
&lt;/ns1:Properties&gt;
&lt;ns1:Properties&gt;
&lt;ns1:Propertyname&gt;QuoteValue&lt;/ns1:Propertyname&gt;
&lt;ns1:propertyValue&gt;sas&lt;/ns1:propertyValue&gt;
&lt;/ns1:Properties&gt;
&lt;ns1:Properties&gt;
&lt;ns1:Propertyname&gt;QuoteProperty&lt;/ns1:Propertyname&gt;
&lt;ns1:propertyValue&gt;sandy&lt;/ns1:propertyValue&gt;
&lt;/ns1:Properties&gt;
&lt;/AdditionalProperties&gt;
</code></pre>

<p>The  transformation that i am using currently is :</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="../BPELProcess1.wsdl"/&gt;
          &lt;rootElement name="Quote" namespace="http://www.example.org"/&gt;
        &lt;/source&gt;
      &lt;/mapSources&gt;
      &lt;mapTargets&gt;
        &lt;target type="WSDL"&gt;
          &lt;schema location="../BPELProcess1.wsdl"/&gt;
          &lt;rootElement name="AdditionalProperties" namespace="http://www.example.org"/&gt;
        &lt;/target&gt;
      &lt;/mapTargets&gt;
      &lt;!-- GENERATED BY ORACLE XSL MAPPER 11.1.1.7.8(build 150622.2350.0222) AT [THU NOV 24 17:33:14 IST 2016]. --&gt;
    ?&gt;
    &lt;xsl:stylesheet version="1.0"
                    xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
                    xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
                    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:ns1="http://www.example.org"
                    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:xsd="http://www.w3.org/2001/XMLSchema"
                    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                    xmlns:client="http://xmlns.oracle.com/add/MultiplevaluesTest/BPELProcess1"
                    xmlns:ora="http://schemas.oracle.com/xpath/extension"
                    xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
                    xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
                    exclude-result-prefixes="xsi xsl ns1 plnk xsd wsdl client bpws xp20 mhdr bpel oraext dvm hwf med ids bpm xdk xref ora socket ldap"&gt;
      &lt;xsl:template match="/"&gt;
        &lt;ns1:AdditionalProperties&gt;
          &lt;xsl:for-each select="/ns1:Quote/*"&gt;
            &lt;xsl:choose&gt;
              &lt;xsl:when test="(position() = 1.0) or (position() = 3.0)"&gt;
                &lt;ns1:Properties&gt;
                  &lt;ns1:Propertyname&gt;
                    &lt;xsl:value-of select='substring-after(name(),"ns1:")'/&gt;
                  &lt;/ns1:Propertyname&gt;
                  &lt;ns1:propertyValue&gt;
                    &lt;xsl:value-of select='/ns1:Quote/*/text()'/&gt;
                  &lt;/ns1:propertyValue&gt;
                &lt;/ns1:Properties&gt;
              &lt;/xsl:when&gt;
            &lt;/xsl:choose&gt;
          &lt;/xsl:for-each&gt;
        &lt;/ns1:AdditionalProperties&gt;
      &lt;/xsl:template&gt;
    &lt;/xsl:stylesheet&gt;
</code></pre>

<p>The Output after using this is</p>

<pre><code>&lt;AdditionalProperties&gt;
&lt;ns1:Properties&gt;
&lt;ns1:Propertyname&gt;QuoteVendor&lt;/ns1:Propertyname&gt;
&lt;ns1:propertyValue&gt;123&lt;/ns1:propertyValue&gt;
&lt;/ns1:Properties&gt;
&lt;ns1:Properties&gt;
&lt;ns1:Propertyname&gt;QuoteVersion&lt;/ns1:Propertyname&gt;
&lt;ns1:propertyValue&gt;123&lt;/ns1:propertyValue&gt;
&lt;/ns1:Properties&gt;
&lt;/AdditionalProperties&gt;
</code></pre>

<p>I am not getting the text value for the specific tag.The same element is repeated for all the values.
can anyone help me on this on how to do that.</p>