Xsl Problem( xsl:for-each .... )

Hi
I have Xml Dom Object which contain
<Root>
   <CD>
      <Title>Empire Burlesque</Title>
      <artist>Bob Dylan</artist>
      <Price>10.50</Price>
   </CD>
</Root> my XSL contain
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="MPRoot">
  <html>
    <body>
    <h2>My CD Collection</h2>
    <table border="1">
      <xsl:for-each select="cd">
      <tr>
        <td><xsl:value-of select="title" /></td>
        <td><xsl:value-of select="artist" /></td>
        <td><xsl:value-of select="price" /></td>
      </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet> I m not getting My Desire Out put �
I am getting all the Static Value which I have Written before (<xsl:for-each select="cd">) I have already try with (<xsl:for-each select="Root/cd"> and <xsl:for-each select="/cd"> and <xsl:for-each select="./cd">)
Regards,
Nilesh

Your main template selects MPRoot elements. You don't have any MPRoot elements in your example XML. However let's suppose that your example XML is a lie and that those Root elements are MPRoot elements in real life. Then, your xsl:for-each selects cd elements. But your Root elements don't have any cd elements as children. They do have CD elements, though. So if that part of the example wasn't a lie, try <xsl:for-each select="CD"> instead.

Similar Messages

  • Xsl for-each  not working in BPEL

    Hi,
    My input xml would contain the attribute @SourceModified at many places. In a xsl, for each occurence of that attribute I need to assign a set of values and then invoke a partnerlink.
    My code is
    <xsl:template match="/">
    <xsl:for-each select="//@SourceModified">
    <db:InputParameters>
    <db:before_text>
    <xsl:value-of select="normalize-space(.)"/>
    </db:before_text>
    <db:after_text>
    <xsl:value-of select="normalize-space(..)"/>
    </db:after_text>
    </db:InputParameters>
    </xsl:for-each>
    </xsl:template>
    Say if my input xml has the @SourceModified at 3 places, 3 different sets of values should get assigned to
    <db:InputParameters>.
    When I test the xsl in jdeveloper, i can see <db:InputParameters> coming 3 times. But when I deploy and test the BPEL process, only for the first occurence of @SourceModified, <db:InputParameters> is getting assigned in the transform.
    Please let me know how to fix this.

    hi,
    I am sending multiple @SourceModified elements. Also, i could not see any <list><db:InputParameters></list>.
    Only 1 set of value for <db:InputParameters> is getting assigned.
    I achieved the requirement in another way.
    1. counted the occurence of @SourceModified using ora:countNodes & assigned a variable count = 0
    Inside a while loop, while count<ora:countNodes(@SourceModified)
    1. i tempCountVar = count + 1
    2. pass the tempCount variable to my xsl using passing parameters to xsd.
    3. Inside the xsl, add a if condition
    <xsl:template match="/">
    <xsl:for-each select="//@SourceModified">
    *<xsl:if test select="position() = tempCountVar>*
    <db:InputParameters>
    <db:before_text>
    <xsl:value-of select="normalize-space(.)"/>
    </db:before_text>
    <db:after_text>
    <xsl:value-of select="normalize-space(..)"/>
    </db:after_text>
    </db:InputParameters>
    </xsl:if>
    </xsl:for-each>
    </xsl:template>
    4. increment the count
    This worked for me. I am able to get different values of <db:InputParameters>

  • XSLT Question: xsl:for-each select="//MYELEMEMT[1]"

    Hi everybody,
    does anybody know, what [1] means?
    Thanks Regards Mario

    Check this:
    http://www.w3schools.com/xpath/xpath_examples.asp
    <i>select the First book Node
    The following example selects only the first book node under the bookstore element:
    xmlDoc.selectNodes("/bookstore/book[0]")
    If you have IE 5 or higher you can try it yourself
    Note: IE5 and later has implemented that [0] should be the first node, but according to the W3C standard it should have been [1]!!
    A Workaround!
    To solve the [0] and [1] problem in IE5+, you can set the SelectionLanguage to XPath.
    The following example selects only the first book node under the bookstore element:
    xmlDoc.setProperty "SelectionLanguage", "XPath"
    xmlDoc.selectNodes("/bookstore/book[1]")</i>
    Regards
    Stefan

  • Xsl mapping - for each

    HI,
    my xsl mapping is working fine but the output is wrong.
    I need the information from the E1EDK02/BELNR if the E1EDK02/QUALF="002".
    Where is the mistake located ? The BELNR is allways the first one of all E1EDK02.
      <xsl:for-each select="ORDERS05/IDOC/E1EDK02[QUALF='002']">
    <!--   <xsl:for-each select="ORDERS05/IDOC/E1EDK02">-->
           <xsl:value-of select="ORDERS05/IDOC/E1EDK02/BELNR"/>
           </xsl:for-each>
    Thx,
    Gordon

    Hi,
    <xsl:for-each select="ORDERS05/IDOC/E1EDK02[QUALF='002']">
    <!-- <xsl:for-each select="ORDERS05/IDOC/E1EDK02">-->
    <b><xsl:value-of select="ORDERS05/IDOC/E1EDK02/BELNR"/></b> it is absolete path which will take first occurance always.
    </xsl:for-each>
    Use:<b><!-- <xsl:value-of select="BELNR">--></b>
    it is not absolete path.
    Regards,
    AKshay.
    Reward points if find useful.
    <b>** Mark question answered if solved.</b>
    Message was edited by:
            Akshay Jamgaonkar
    Message was edited by:
            Akshay Jamgaonkar

  • Xsl for removing specific nodes and modifying one node.

    Hello,
    i have the urgent need to remove specific nodes
    and modify one node in my XML.
    the xml as input :
    <?xml version="1.0" encoding="utf-8"?>
    <PLOT>
      <REQUEST>
        <GET_LAYOUT>
          <PROPERTIES>
            <MAPNAME name="xxxx" />
           </PROPERTIES>
          <DATAFRAME id="MAIN">
            <LAYERLIST>
              <LAYERDEF id="0" visible="false" query="" />
              <LAYERDEF id="1" visible="false" query="" />
              <LAYERDEF id="2" visible="false" query="" />
              <LAYERDEF id="3" visible="false" query="" />
              <LAYERDEF id="4" visible="false" query="" />
              <LAYERDEF id="5" visible="false" query="" />
              <LAYERDEF id="6" visible="false" query="" />
              <LAYERDEF id="7" visible="false" query="" />
              <LAYERDEF id="8" visible="false" query="" />
              <LAYERDEF id="9" visible="false" query="" />
              <LAYERDEF id="10" visible="false" query="" />     
            </LAYERLIST>
            <MAPSERVICELIST>   
              <MAPSERVICEDEF  service="BASEMAP" >
                <LAYERLIST>
                  <LAYERDEF id="2" visible="True" query="" />
                  <LAYERDEF id="1" visible="False" query="" />
                </LAYERLIST>
              </MAPSERVICEDEF>
              <MAPSERVICEDEF service="MAP1">
                <LAYERLIST>
                  <LAYERDEF id="4" visible="True" query="" />
                  <LAYERDEF id="3" visible="True" query="" />
                  <LAYERDEF id="2" visible="True" query="" />
                  <LAYERDEF id="1" visible="False" query="" />
                </LAYERLIST>
              </MAPSERVICEDEF>
            </MAPSERVICELIST>
          </DATAFRAME>
        </GET_LAYOUT>
      </REQUEST>
    </PLOT>
    what i want to have is:
    <?xml version="1.0" encoding="utf-8"?>
    <PLOT>
      <REQUEST>
        <GET_LAYOUT>
          <PROPERTIES>
            <MAPNAME name="xxxx" />
          </PROPERTIES>
          <DATAFRAME id="MAIN">
            <LAYERLIST>
       <LAYERDEF id="6" visible="True" query="" />
                <LAYERDEF id="5" visible="True" query="" />
                <LAYERDEF id="4" visible="True" query="" />
                <LAYERDEF id="3" visible="False" query="" />
    <LAYERDEF id="2" visible="True" query="" />
    <LAYERDEF id="1" visible="False" query="" />       
            </LAYERLIST>
            <MAPSERVICELIST/>   
          </DATAFRAME>
        </GET_LAYOUT>
      </REQUEST>
    </PLOT>
    as you see, <MAPSERVICELIST/>   is empty and <LAYERLIST> contains all <LAYERDEF> of <MAPSERVICEDEF>/<LAYERLIST> 
     The ones  of BASEMAP  are kept unchanged  but the ones of MAP1 are having a new attribute value for id.
    Thanks four your help.
    Regards.

    You can implement very straightforward map in BizTalk like below:
    If you are interested in XSLT of this map, I copied below which visual studio gave me when i validated the map:
    <?xml version="1.0" encoding="UTF-16"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var" version="1.0">
    <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
    <xsl:template match="/">
    <xsl:apply-templates select="/PLOT" />
    </xsl:template>
    <xsl:template match="/PLOT">
    <PLOT>
    <REQUEST>
    <GET_LAYOUT>
    <PROPERTIES>
    <MAPNAME>
    <xsl:if test="REQUEST/GET_LAYOUT/PROPERTIES/MAPNAME/@name">
    <xsl:attribute name="name">
    <xsl:value-of select="REQUEST/GET_LAYOUT/PROPERTIES/MAPNAME/@name" />
    </xsl:attribute>
    </xsl:if>
    <xsl:value-of select="REQUEST/GET_LAYOUT/PROPERTIES/MAPNAME/text()" />
    </MAPNAME>
    <xsl:value-of select="REQUEST/GET_LAYOUT/PROPERTIES/text()" />
    </PROPERTIES>
    <DATAFRAME>
    <xsl:if test="REQUEST/GET_LAYOUT/DATAFRAME/@id">
    <xsl:attribute name="id">
    <xsl:value-of select="REQUEST/GET_LAYOUT/DATAFRAME/@id" />
    </xsl:attribute>
    </xsl:if>
    <LAYERLIST>
    <xsl:for-each select="REQUEST/GET_LAYOUT/DATAFRAME/MAPSERVICELIST/MAPSERVICEDEF">
    <xsl:for-each select="LAYERLIST/LAYERDEF">
    <LAYERDEF>
    <xsl:if test="../../../../LAYERLIST/LAYERDEF/@id">
    <xsl:attribute name="id">
    <xsl:value-of select="../../../../LAYERLIST/LAYERDEF/@id" />
    </xsl:attribute>
    </xsl:if>
    <xsl:if test="@id">
    <xsl:attribute name="id">
    <xsl:value-of select="@id" />
    </xsl:attribute>
    </xsl:if>
    <xsl:if test="../../../../LAYERLIST/LAYERDEF/@visible">
    <xsl:attribute name="visible">
    <xsl:value-of select="../../../../LAYERLIST/LAYERDEF/@visible" />
    </xsl:attribute>
    </xsl:if>
    <xsl:if test="@visible">
    <xsl:attribute name="visible">
    <xsl:value-of select="@visible" />
    </xsl:attribute>
    </xsl:if>
    <xsl:if test="../../../../LAYERLIST/LAYERDEF/@query">
    <xsl:attribute name="query">
    <xsl:value-of select="../../../../LAYERLIST/LAYERDEF/@query" />
    </xsl:attribute>
    </xsl:if>
    <xsl:if test="@query">
    <xsl:attribute name="query">
    <xsl:value-of select="@query" />
    </xsl:attribute>
    </xsl:if>
    </LAYERDEF>
    </xsl:for-each>
    </xsl:for-each>
    <xsl:value-of select="REQUEST/GET_LAYOUT/DATAFRAME/LAYERLIST/text()" />
    </LAYERLIST>
    <MAPSERVICELIST>
    <xsl:text> </xsl:text>
    </MAPSERVICELIST>
    <xsl:value-of select="REQUEST/GET_LAYOUT/DATAFRAME/text()" />
    </DATAFRAME>
    <xsl:value-of select="REQUEST/GET_LAYOUT/text()" />
    </GET_LAYOUT>
    <xsl:value-of select="REQUEST/text()" />
    </REQUEST>
    </PLOT>
    </xsl:template>
    </xsl:stylesheet>
    You can highlight the issue if you have any specific one.
    Please mark it as Answer if this answers your question
    Thanks.
    Mo
    The contents I write here is my personal views, not the view of my employer and anyone else.

  • Tool for creating xsl for .xsql

    I am looking for tool that will give me the
    default code for xsl base on a .xsql file as imput.
    What I am looking for is a xsl designer.
    null

    If you are doing HTML you can just start with a well-formed HTML file and:
    (1) Add the xsl namespace to the top element,
    (2) Add in <xsl:for-each> tags where you
    need to loop
    (3) Add in <xsl:value-of> tags where
    you want to plug-in values.
    <html xmlns:xsl="http://www.w3.org/1999/XSL/Transform xsl:version="1.0">
    <body>
    <xsl:for-each select="ROWSET/ROW">
    <tr>
    <td><xsl:value-of select="ENAME"/></td>
    <td><xsl:value-of select="SAL"/></td>
    </tr>
    </xsl:for-each>
    </body>
    </html>
    That's it. We don't yet offer an XSL visual editor.
    null

  • Errors while editing the xsl for dataview web part

    while modifying a dataview webpart in sharepoint designer, i finding the issues for the below line
    <xsl:for-each select="$Rows[substring-before(substring-after(substring-after(@FullName, '?ID='), '>'), '<') = $FullName]">
    errors:
    the tag is marked invalid because it is missing quote for  '>' and '<'
    the tag is marked invalid because it has an extra quote ">

    Hi ,
    According to your description, my understanding is that you got an error when you edited the xsl for dataview web part.
    Please try to change
    <xsl:for-each select="$Rows[substring-before(substring-after(substring-after(@FullName, '?ID='), '>'), '<') = $FullName]">
    To
    <xsl:for-each select="$Rows[substring-before(substring-after(substring-after(@FullName, '?ID='), '&gt;'), '&lt;') = $FullName]">
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • Using a for-each for a CallObject

    Hello everyone,
    i am having trouble to get the following scenario to work:
    1. SQL Call is prepared and called
    2. Branch with a condition whether there is a payment related to an invoice
    3. For-Each record of the resultset a cancellation will be called by using a B1Objectcall with cancellation method
    The for-each is configurated like this:
    /vpf:Msg/vpf:Body/vpf:Payload[@Role='C']/jdbc:ResultSet/jdbc:Row
    The path is configurated like this:
    /vpf:Msg/vpf:Body/vpf:Payload[./@id=&apos;atom36&apos;]/jdbc:ResultSet[./@rowCount>&apos;0&apos;]
    My problem is the preparation of the xsl-transformation to access the DocEntry of each record. This is my xml.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:b1e="urn:com.sap.b1i.sim:b1event" xmlns:b1ie="urn:com.sap.b1i.sim:b1ievent" xmlns:b1im="urn:com.sap.b1i.sim:b1imessage" xmlns:bfa="urn:com.sap.b1i.bizprocessor:bizatoms" xmlns:jdbc="urn:com.sap.b1i.adapter:jdbcadapter" xmlns:rfc="urn:sap-com:document:sap:rfc:functions" xmlns:sim="urn:com.sap.b1i.sim:entity" xmlns:utils2="com.sap.b1i.bpc_tools.Utilities" xmlns:vpf="urn:com.sap.b1i.vplatform:entity" xmlns:xci="urn:com.sap.b1i.xcellerator:intdoc" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" bfa:force="" vpf:force="" jdbc:force="" rfc:force="" b1ie:force="" b1e:force="" xci:force="" sim:force="" utils2:force="" b1im:force="">
      <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
      <xsl:param name="atom"/>
      <xsl:param name="sessionid"/>
      <xsl:variable name="msg" select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role=&apos;S&apos;]"/>
      <xsl:variable name="msg2" select="/vpf:Msg/vpf:Body/vpf:Payload[@Role='C']/jdbc:ResultSet/jdbc:Row"/>
      <xsl:variable name="vpSender" select="/vpf:Msg/vpf:Header/vpf:Sender/@Id"/>
      <xsl:variable name="vpObject" select="/vpf:Msg/vpf:Header/vpf:Sender/@ObjId"/>
      <xsl:variable name="vpReceiver" select="/vpf:Msg/vpf:Header/vpf:ReceiverList/vpf:Receiver[./@handover=&apos;P&apos;]/@Id"/>
      <xsl:variable name="vpSysId" select="/vpf:Msg/vpf:Header/vpf:Variables/vpf:var[./@id=&apos;SysId&apos;]/@value"/>
      <xsl:template match="/">
      <Msg xmlns="urn:com.sap.b1i.vplatform:entity">
      <xsl:copy-of select="/vpf:Msg/@*"/>
      <xsl:copy-of select="/vpf:Msg/vpf:Header"/>
      <Body>
      <xsl:copy-of select="/vpf:Msg/vpf:Body/*"/>
      <Payload Role="X" id="{$atom}">
      <xsl:call-template name="transform"/>
      </Payload>
      </Body>
      </Msg>
      </xsl:template>
      <xsl:template name="transform">
      <Value xmlns="">
      <xsl:value-of select="$msg2/DocEntry"/>
      </Value>
      </xsl:template>
    </xsl:stylesheet>
    This is the inbound message on the path:
    <Msg xmlns="urn:com.sap.b1i.vplatform:entity" MessageId="14123112452456040534C0A800138613" BeginTimeStamp="20141231124524" logmsg="0000" SubMessageId="" status="success" owntst="false" test="true">
      <Header>
      <IPO Id="INB_IQ_INTQ_ASYN_QS" tid="14123109281856033321C0A80013BACE" />
      <IPO Id="PRC_QS" tid="14123109281856033506C0A8001381B0" />
      <msglog step="Default message log" always="false" b1ifactive="true" />
      <Resumption>
      <starter ipo="/vP.0010000000.in_IQ/com.sap.b1i.vplatform.runtime/INB_IQ_INTQ_ASYN_QS/INB_IQ_INTQ_ASYN_QS.ipo/proc" />
      <restart id="processing" q="Q.PRC_QS.0010000000" s="S.sap.DRFISQueuertFIS" u="14123112231756033345C0A800139613.4" />
      </Resumption>
      <ProcStream>S.sap.DRFISQueuertFIS</ProcStream>
      <Sender Id="0010000000" ObjId="sap.DetailReportFIS" />
      <Successor Id="" Mode="" />
      <Identification Ident="Queue/Stream" IdPar="n.a." />
      <nsList>
      <ns id="b1mb" ns="http://tempuri.org/" />
      </nsList>
      <ReceiverList>
      <Receiver Id="0010000000" filter="" />
      </ReceiverList>
      <Retrieval type="Handover" />
      <Outbound type="Void" channel="VOID" />
      <vBIU Id="sap.DRFISQueue" ver="1.0.0" SId="sap.Files" filter="" phase="" />
      <Variables>
      <var id="userid" value="no_authentication" />
      <var id="username" value="no_authentication" />
      <var id="SysId" value="0010000117" />
      </Variables>
      <Properties />
      <SysTypeProperties type="B1if" offline="" snd="0010000000" rcv="receiverdummy" ssystype="B1i.20" rsystype="" />
      <LocalProperties type="B1if" biu="sap.DRFISQueue" snd="0010000000" rcv="receiverdummy" sid="sap.Files" offline="" />
      <VarProperties>
      <property call="callb1obj.bfd" atom="atom3" id="SysId" value="#0010000117" />
      <property call="callsql.bfd" atom="atom36" id="SysId" value="#0010000117" />
      </VarProperties>
      </Header>
      <Body>
      <Payload Role="T" Type="Queue" add="sap.DetailReportFIS" />
      <Payload Role="S">
      <Document xmlns="">
      <row>
      <BuchungsID>47662</BuchungsID>
      <Datum>15.12.2014</Datum>
      <VertragspartnerID>61</VertragspartnerID>
      <Firmenname>Software Integrator</Firmenname>
      <KreditorenID>K123456</KreditorenID>
      <Kreditor>Intrum Justitia AG</Kreditor>
      <ForderungsID>9015</ForderungsID>
      <Rechnungsnummer>121</Rechnungsnummer>
      <Buchungstyp>DEBTCLAIM_REVOKE</Buchungstyp>
      <Buchungstext>Forderungsruecknahme</Buchungstext>
      <Waehrung>CHF</Waehrung>
      <Nettobetrag>-7560.00</Nettobetrag>
      <MwStSatz>0</MwStSatz>
      <MwStBetrag>0</MwStBetrag>
      <Bruttobetrag>-7560.00</Bruttobetrag>
      <Verrechnungsposition>n</Verrechnungsposition>
      </row>
      </Document>
      </Payload>
      <Payload Role="X" id="atom35">
      <row xmlns="">
      <Value>SELECT T0.DocNum FROM ORCT T0 WHERE T0.Canceled ='N' AND T0.DocNum IN (SELECT T1.DocNum FROM ORCT T0 INNER JOIN RCT2 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OINV T2 ON T1.DocEntry = T2.DocNum WHERE T2.DocNum = '121')</Value>
      <Value2>Update OINV set U_sapSTORNF = '1' WHERE DocEntry = '121'</Value2>
      </row>
      </Payload>
      <Payload Role="C" id="atom36" system="0010000117" mode="single" method="Automatic detection by key word(Automatic detection by key word)" plr="4" dbtype="SQL" blockExecution="false" compatibilityMode="true" delimiter=";" sql="SELECT T0.DocNum FROM ORCT T0 WHERE T0.Canceled ='N' AND T0.DocNum IN (SELECT T1.DocNum FROM ORCT T0 INNER JOIN RCT2 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OINV T2 ON T1.DocEntry = T2.DocNum WHERE T2.DocNum = '121')" disable-output-escaping="false">
      <ResultSet xmlns="urn:com.sap.b1i.adapter:jdbcadapter" rowCount="1">
      <Row>
      <DocNum>163</DocNum>
      </Row>
      </ResultSet>
      </Payload>
      <Payload Role="C" id="atom48" status="ok" input="atom35" queue="Q.INB_IQ_INTQ_ASYN_QS.0010000000" stream="sap.DRFISQueue3" />
      <Payload Role="X" id="atom33">
      <row xmlns="">
      <Value>163</Value>
      </row>
      </Payload>
      </Body>
    </Msg>

    Hello everyone,
    THis is how my stuff looks now:
    i have tried the above named solutions but i think, that as soon as i am checking the inbound parameter of the for-each it says something like that:
    - <ResultSet xmlns="urn:com.sap.b1i.adapter:jdbcadapter" rowCount="1"> 
    - <Row> 
    <DocNum>163</DocNum>  
    </Row>
    </ResultSet>
    While in the path i have got a such inbound parameter:
    the code just shows the sql call and the X Role of atom33 where i am using the personal tag
    - <Payload Role="C" id="atom36" system="0010000117" mode="single" method="Automatic detection by key word(Automatic detection by key word)" plr="4" dbtype="SQL" blockExecution="false" compatibilityMode="true" delimiter=";" sql="SELECT T0.DocNum FROM ORCT T0 WHERE T0.Canceled ='N' AND T0.DocNum IN (SELECT T1.DocNum FROM ORCT T0 INNER JOIN RCT2 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OINV T2 ON T1.DocEntry = T2.DocNum WHERE T2.DocNum = '121')" disable-output-escaping="false"> 
    - <ResultSet xmlns="urn:com.sap.b1i.adapter:jdbcadapter" rowCount="1"> 
    - <Row> 
    <DocNum>163</DocNum>  
    </Row>
    </ResultSet>
    </Payload>
    <Payload Role="C" id="atom48" status="ok" input="atom35" queue="Q.INB_IQ_INTQ_ASYN_QS.0010000000" stream="sap.DRFISQueue3" />  
    - <Payload Role="X" id="atom33"> 
    <DocId xmlns="">163</DocId>  
    </Payload>
      </Body>
    This is my call object configuration
    This message is the Key Value:
    /vpf:Msg/vpf:Body/vpf:Payload[./@Role='X' and ./@id='atom33']/DocId
    This is my atom33:
    <xsl:for-each select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role=&apos;C&apos; and ./@id=&apos;atom36&apos;]/jdbc:ResultSet/jdbc:Row">
    <DocId xmlns="">
    <xsl:value-of select="jdbc:DocNum"/>
    </DocId>
    </xsl:for-each>
    When checking the message of the join inbound it shows the following:
    So it seems that at some point i am completely losing some inbound message (such as the atom33).
    - <Msg xmlns="urn:com.sap.b1i.vplatform:entity"> 
    - <Body> 
    - <Payload Role="X" id="atom56"> 
    <DocId2 xmlns="" />  
    </Payload>
    - <Payload Role="C" id="atom55" system="0010000117"> 
    <B1CallResult status="failure" b1login="Technical User" method="Synchronous Cancel" objectid="24" payload="atom56" keyname="DocEntry" keyvalue="" />  
    </Payload>
    </Body>
    </Msg>
    This is the atom56 config, which is just a tryout. Or do I use a wrong payload in my call object?
    Help is greatly appreciated.
    Regards Simon

  • XSLT for-each within another for-each

    Hi All,
    My XSLT mapping needs to pick a field(BOL) from the Header and the using that, search the Items node for the matching BOL and generate the output accordingly.
    My current XSLT is as follows(not the entire program, just the snippet)
         <xsl:for-each select="ns0:Messages/ns0:Message1/ns1:MT_Header/Header">
                          <xsl:param name="search"><xsl:value-of select="bol"/></xsl:param>
         <xsl:for-each select="ns0:Messages/ns0:Message2/ns1:MT_Items/Item[BOL=$search]">
                  <Output>
                     <BOL_ITEM><xsl:value-of select="BOL_ITEM"/></BOL_ITEM>
                </Output>     
         </xsl:for-each>
         </xsl:for-each>
    The following code works correctly(without the outer for-each and with hardcoding)
                             <xsl:param name="search">100</xsl:param>
         <xsl:for-each select="ns0:Messages/ns0:Message2/ns1:MT_Items/Item[BOL=$search]">
                  <Output>
                     <BOL_ITEM><xsl:value-of select="BOL_ITEM"/></BOL_ITEM>
                </Output>     
         </xsl:for-each>
    So its the for-each within another for-each that does not work . Is there some syntax problem ? Or another way to achieve this in XSLT?

    Closing this thread

  • Nested for-each not working

    Hello all. I am studying XSLT in school and need some help.
    Display the following: Software titles for each operating system sorted by category. Sorting is not the problem. I am having an issue with displaying software titles for each operating system. Here is the XML and the XSLT.
    <?xml version="1.0"?>
    <!-- Note: For many of the wonders, the experts do not agree on precise dates or construction dimensions. In these cases, I chose a year or dimension in the middle of the range so all attributes could be numeric. -->
    <software_inventory>
    <software xmlns:xsi="Software.xsd">
    <title>Adobe Photoshop</title>
    <vendor>Adobe</vendor>
    <category>Graphics</category>
    <support_platforms>
    <Platform>Windows 7</Platform>
    <Platform>Windows 8</Platform>
    <Platform>Windows 8.1</Platform>
    </support_platforms>
    <Approved_Versions>
    <Version Hardware_Requirements="4GB Ram 2GB Hard Drive" Software_Requiremnts="32/64 bit" Price="399">CS 5.5</Version>
    </Approved_Versions>
    </software>
    <software>
    <title>Winzip</title>
    <vendor>Winzip International</vendor>
    <category>Utility</category>
    <support_platforms>
    <platform>Windows Vista</platform>
    <platform>Windows 7</platform>
    <platform>Windows 8</platform>
    <platform>Windows 8.1</platform>
    </support_platforms>
    <Approved_Versions>
    <Version Hardware_Requirements="2GB Ram 250MB Hard Drive" Software_Requiremnts="32/64 bit" Price="29.99">19</Version>
    </Approved_Versions>
    </software>
    There are more titles in the XML, but I didn't include them.
    Here is the XSLT
    <h1>Software Titles for each operating system, sorted by category</h1>
    <table border="1">
    <tr>
    <th>Software Title</th>
    <th>Operating System</th>
    <th>Category</th>
    </tr>
    <xsl:for-each select="software_inventory/software">
    <xsl:sort select="support_platforms/platform"/>
    <xsl:sort select="category"/>
    <tr>
    <td>
    <xsl:value-of select="title"/>
    </td>
    <td>
    <xsl:for-each select="support_platforms/platform">
    <xsl:value-of select="platform"/>
    <xsl:text>&#13;</xsl:text>
    </xsl:for-each>
    </td>
    <td>
    <xsl:value-of select="category"/>
    </td>
    </tr>
    </xsl:for-each>
    </table>
    Here is a screen shot of the output. What I would like is for each Platform / operating system to show in the same cell, so the adjacent cells will grow taller to accommodate. 
    What am I doing wrong?

    You cannot ask for "platform" when your pointer is already pointing at "platform".
    Also your input XML is inconsistent concerning capitalized and not capitalized "platform/Platform".
    Under the assumption that platform should always be "platform", try replacing:
    <td>
    <xsl:for-each select="support_platforms/platform">
    <xsl:value-of select="platform"/>
    <xsl:text>&#13;</xsl:text>
    </xsl:for-each>
    </td>
    With:
    <td>
    <xsl:for-each select="support_platforms/platform">
    <xsl:value-of select="."/>
    <xsl:text>&#13;</xsl:text>
    </xsl:for-each>
    </td>
    Morten la Cour

  • Using for-each for input into a database adapter

    As input to a Web service I have an XSD that has parent elements and two unbounded child elements. I want to use XSLT to loop through the child elements to include them as comma separated strings for use in an IN clause in the query of the database adapter. I have the following XSLT in the input to database adapter XSL:
    <db:child_elements>
      <xsl:attribute name="xsi:nil">
        <xsl:value-of select="/inp1:path/inp1:to/inp1:child_elements/@xsi:nil"/>
      </xsl:attribute>
      <xsl:for-each select="/inp1:path/inp1:to/inp1:child_elements/inpl:child_elements">
        <xsl:value-of select="."/>
        <xsl:if test="position() != last()">
          <xsl:text>,</xsl:text>
        </xsl:if>
      </xsl:for-each>
    </db:child_elements>I am getting three error:
    1) Error: Invalid Usage of <for-each> Element
    2) Error: Invalid Usage of <if> Element
    3) Error: This node is already mapped, repeating nodes not supported : "/db:databaseAdapterInput/db:child_elements"
    Any idea of what the problem is here? Are for-each loops and if statements simply not allowed in Oracle SOA Suite? Thanks in advance!

    For SQL Server 2005+ you can use the OUTPUT clause. E.g.
    DECLARE @Source TABLE ( ID INT, Payload INT );
    DECLARE @Destination TABLE
    ID INT IDENTITY ,
    Payload INT
    DECLARE @IdentityValues TABLE ( ID INT );
    INSERT INTO @Source
    VALUES ( 1, 1 ),
    ( 2, 2 ),
    ( 3, 3 );
    INSERT INTO @Destination
    ( Payload )
    VALUES ( 0 );
    INSERT INTO @Destination
    ( Payload )
    OUTPUT INSERTED.ID
    INTO @IdentityValues
    SELECT S.Payload
    FROM @Source S;
    SELECT D.ID ,
    D.Payload
    FROM @Destination D;
    SELECT IV.ID
    FROM @IdentityValues IV;

  • Split an XML File and invoke a Web Serivce for each splits using an  XSLT

    Hi,
    We Have a requirement to Split an incoming XML File into chunks based on a child element and hit the target Web Service for each and every split ( i.e no of splits = no of hits on WebService).
    Currently, the incoming XML file is getting splitted and gets appended to the SAME Payload and the WebService is hitted only once with the entire Payload.
    Is it possible to invoke a WebService within a XSLT ?
    Please find below the XSLT code used to split the file in chunks of 3
    <xsl:param name="pItemsNumber" select="3"/>
    <xsl:template match="@*|node()">
    <xsl:choose>
    <xsl:when test="count(Batch/Item) > 4">
    <ItemMaintenance>
    <xsl:for-each-group select="Batch/Item"
    group-adjacent="(position()-1) idiv $pItemsNumber">
    <xsl:result-document href="ItemsMatch\{current-grouping-key()}.xml">
    <ItemMaintenance>
    <xsl:copy-of select="current-group()"/>
    </ItemMaintenance>
    </xsl:result-document>
    </xsl:for-each-group>
    </ItemMaintenance>
    </xsl:when>
    <xsl:otherwise>
    <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>

    Hello,
    It is possible to invoke a webservice from XSLT. To achieve this you must create a custom XSLT function that does the actual webservice call. You need to write an implementation in Java for this. See my blogpost http://blog.melvinvdkuijl.nl/2010/02/custom-xslt-functions-in-oracle-soa-suite-11g/ for a simple example.
    Regards,
    Melvin

  • How to use for each loop in XSLT when my source is a multilayout file and db

    How do I use a for each loop in XSLT when my source is multilayout file and db .
    My multilayout file is basically contain 2 kind of data one for employee and another for dependent.
    Now my requirement is I want to read each line of data whether it is it is employee or dependent do a join with db and write it in my target file.
    eg :  File content
    1 RichaKumari 311289 TCS INDIA
    2 KiarnKumar 456782 BRO RichaKumari 311289 INDIA
    2 Ravi            456882 BRO RichaKumari 311289 INDIA
    eg : db Content
    311289 RichaKumari TCS INDIA Bangalore [email protected]
    Now in Final File I need something like this :
    1 RichaKumari 311289 TCS INDIA
    2 KiarnKumar RichaKumari 311289 TCS INDIA
    2 Ravi            RichaKumari 311289 TCS INDIA
    here 1 and 2 are the identifier which will decide which layout to follow .

    Hi,
    I think you'll need two nested for-each's... Something like...
    <xsl:for-each select="$root/row[layout = 1]">
    <xsl:variable name="employee" select="."/>
    ... write employee ...
    <xsl:for-each select="$root/row[layout = 2 and dependentid = $employee/id]">
    ... write dependent ...
    </xsl:for-each>
    </xsl:for-each>
    Cheers,
    Vlad

  • Issue with XSLT For each loop in B2B Mapping

    Hi All,
    I am trying to map the inbound 997 Payload into Headers and Lines Table. I am using the For Each XSLT Construct to map the Loop AK2 of 997 into the 997 Lines Collection.
    Issue I am facing is that if the Loop AK2 is repeated for 33 times then for all the 33 times only its first element's value is getting passed into the target of mapping file.
    in coming payload
    <Loop-AK2>
    <Segment-AK2>
    <Element-143>810</Element-143>
    <Element-329>0001</Element-329>
    </Segment-AK2>
    <Segment-AK5>
    <Element-717>A</Element-717>
    </Segment-AK5>
    </Loop-AK2>
    <Loop-AK2>
    <Segment-AK2>
    <Element-143>810</Element-143>
    <Element-329>0002</Element-329>
    </Segment-AK2>
    <Segment-AK5>
    <Element-717>A</Element-717>
    </Segment-AK5>
    </Loop-AK2>
    <Loop-AK2>
    <Segment-AK2>
    <Element-143>810</Element-143>
    <Element-329>0003</Element-329>
    </Segment-AK2>
    <Segment-AK5>After transformation using XSLT file the payload looks like as follows
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>33</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>
    <ns0:segmentError/>
    <ns0:trxSetAckCode>A</ns0:trxSetAckCode>
    </ns0:XxmfiEdi997_AckLines>
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>34</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>
    <ns0:segmentError/>
    <ns0:trxSetAckCode>A</ns0:trxSetAckCode>
    </ns0:XxmfiEdi997_AckLines>
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>35</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>
    <ns0:segmentError/>
    <ns0:trxSetAckCode>A</ns0:trxSetAckCode>
    </ns0:XxmfiEdi997_AckLines>
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>36</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>
    <ns0:segmentError/>
    <ns0:trxSetAckCode>A</ns0:trxSetAckCode>
    </ns0:XxmfiEdi997_AckLines>
    <ns0:XxmfiEdi997_AckLines>
    <ns0:lineId>37</ns0:lineId>
    <ns0:trxSetIdentCode>810</ns0:trxSetIdentCode>
    <ns0:trxSetControlNumber>0001</ns0:trxSetControlNumber>
    <ns0:segmentCode/>
    <ns0:segmentPosition/>the Element-329 of incoming source payload is mapped to trxSetControlNumber of target payload, the issue is obvious from the above XML data that trxSetControlNumber is always having the value 0001 for every occurence where as its expected to fetch the value of the element of its corresponding occurence not the first elements value.
    Please find below the xslt file code i used for mapping
    <ns0:XxmfiEdi997_AckHeadersCollection>
          <ns0:XxmfiEdi997_AckHeaders>
            <ns0:headerId>
              <xsl:value-of select='oraext:sequence-next-val("XXMFI_EDI_997_ACK_HEADERS_S","jdbc/MTSI-apps")'/>
            </ns0:headerId>
            <ns0:processFlag>
              <xsl:text disable-output-escaping="no">I</xsl:text>
            </ns0:processFlag>
             <ns0:xxmfiEdi997_AckLinesCollection>
              <xsl:for-each select="/ns1:Transaction-997/ns1:Loop-AK2">
                <ns0:XxmfiEdi997_AckLines>
                  <ns0:lineId>
                    <xsl:value-of select='oraext:sequence-next-val("XXMFI_EDI_997_ACK_LINES_S","jdbc/MTSI-apps")'/>
                  </ns0:lineId>
                  <ns0:trxSetIdentCode>
                    <xsl:value-of select="/ns1:Transaction-997/ns1:Loop-AK2/ns1:Segment-AK2/ns1:Element-143"/>
                  </ns0:trxSetIdentCode>
                  <ns0:trxSetControlNumber>
                    <xsl:value-of select="ns1:Segment-AK2/ns1:Element-329"/>
                  </ns0:trxSetControlNumber>
                  <ns0:segmentError>
                    <xsl:value-of select="/ns1:Transaction-997/ns1:Loop-AK2/ns1:Loop-AK3/ns1:Segment-AK3/ns1:Element-720"/>
                  </ns0:segmentError>
                  <ns0:trxSetAckCode>
                    <xsl:value-of select="/ns1:Transaction-997/ns1:Loop-AK2/ns1:Segment-AK5/ns1:Element-717"/>
                  </ns0:trxSetAckCode>
                </ns0:XxmfiEdi997_AckLines>
              </xsl:for-each>
            </ns0:xxmfiEdi997_AckLinesCollection>
          </ns0:XxmfiEdi997_AckHeaders>Is there something I am doing wrong in mapping or am I missing something here. Please suggest .
    Thanks in advance
    ~TK.

    Hi,
    In your xslt code within the for loop, for the trxSetIdentCode why are you using the xpath "/ns1:Transaction-997/ns1:Loop-AK2/ns1:Segment-AK2/ns1:Element-143"? It should be just "ns1:Segment-AK2/ns1:Element-143". Similar changes for segmentError and trxSetAckCode also should be done. Remove the '/ns1:Transaction-997/ns1:Loop-AK2/' part from your xpath expressions inside the for loop and try it.
    Sahay

  • For Each function for a Concat Value

    Hi:
    The scenario is, we need to concat two unbounded elements and map it to a target element using for each functionality.
    For example
    <BookStore>
    <Books>
    <Name>NAME1</Name>
    <Author>AUTHOR1</Author>
    <BookId>1</BookId>
    <Quantity>2</Quantity>
    <Price></Price>
    <Status></Status>
    <Books>
    <Books>
    <Name>NAME2</Name>
    <Author>AUTHOR2</Author>
    <BookId>2</BookId>
    <Quantity>2</Quantity>
    <Price></Price>
    <Status></Status>
    <Books>
    </BookStore>
    I need to concat "Name" and "Author" which is under the unbounded element "BookStore" and map it to a single element called "Sample" on the Target side.
    I am not able to use the "for-each" XSLT function to get the multiple value of Name and Author since concat function is used. Is there any other way to concat and get the multiple values of the element "Name" and "Author"?
    Regards
    RK

    Hi Vlad:
    Ok i use for-each function in my XSLT to get the vlaues of unbounded elements
    eg:
    <xsl:for-each select="/BookStore/Books/Name">
    <request:Sample>
    <xsl:value-of select="/BookStore/Books/Name"/>
    </request:Sample>
    </xsl:for-each>
    This works perfectly fine and whenever there is a multiple vlaue for Name it is mapped to Sample and output comes as expected
    <Sample>NAME1</Sample>
    <Sample>NAME2</Sample>
    Now i need to concat the Name and Author and pass the value to element on the target. Since name and author occuring multiple times, i am not sure how to pass the values to the element on the target

Maybe you are looking for