XSLT For-Each Issue, how to traverse back to previous node

How to get the SupplierName(Primary) from the below payload
*+<ItemSupplier>+*
+<SupplierParty>+
+<SupplierName>SUPPLIER NAME 1</SupplierName>+
+</SupplierParty>+
+<ItemSupplierLocation>+
+<Status>1</Status>+
+<PriorityCode>N</PriorityCode>+
+</ItemSupplierLocation>+
+<ItemSupplierLocation>+
+<Status>2</Status>+
+<PriorityCode>N</PriorityCode>+
+</ItemSupplierLocation>+
*+</ItemSupplier>+*
*+<ItemSupplier>+*
+<SupplierParty>+
*+<SupplierName>SUPPLIER NAME 2</SupplierName>+*
+</SupplierParty>+
+<ItemSupplierLocation>+
+<Status>1</Status>+
+<PriorityCode>N</PriorityCode>+
+</ItemSupplierLocation>+
+<ItemSupplierLocation>+
+<Status>1</Status>+
+<PriorityCode>Y</PriorityCode>+
+</ItemSupplierLocation>+
*+</ItemSupplier>+*
The condition i need to run is as below, but as the control will be inside the <ItemSupplierLocation> how do i go back to previous node and get the value of supplier name.
+<ItemSupplier> can be n number+
<xsl:for-each select="ItemSupplier/ItemSupplierLocation">
<xsl:choose>
<xsl:when test='PriorityCode="Y" and Status="1"'>
<Supplier>
<xsl:value-of select="ItemSupplier/SupplierName"/>
</Supplier>
</xsl:when>
</xsl:choose>
</xsl:for-each>
Thanks,
Vijay

Fixed the issue with the below code
<xsl:for-each select="ItemSupplier/ItemSupplierLocation">
<xsl:choose>
<xsl:when test='PriorityCode="Y" and Status="1"'>
<Supplier>
<xsl:value-of select="../SupplierParty/SupplierName"/>
</Supplier>
</xsl:when>
</xsl:choose>
</xsl:for-each>
Thanks,
Vijay

Similar Messages

  • How can I create back up dvds for itunes and how do I back up from existing dvds?

    How can I create back up dvds for itunes and how do I back up from existing dvds?

    Recovery Mode:
    1. Turn off iPad
    2. Connect USB cable to computer; leave the other end alone
    3. Press and hold the Home button down and connect the docking end of cable to iPad
    4. Continue holding the Home button until you see the "Connect To iTune" screen
    5. Release the Home button
    6. Open iTune
    7. You should see "iTunes has detected an iPad in recovery mode"
    8. Use iTune to restore iPad
    Note: You need to be patient and repeat the above many times to recover your iPad

  • 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

  • HT201386 Since the 8.02 update I now have every photo separated into an event for each pic. how do i get it back to the way it was before the update?

    I backed up my phone and then updated to the new update 8.02. I now have my pics in a separate album for each pic with an event attached to each one. how do i set it back up to the couple albums i had previously without adding all my pics from my computer which i dont want?

    You have 10.6 on that machine, I suggest you stick with it for performance, third party hardware and software reasons as long as possible.
    Consider 10.8 (not 10.7) when it's released, because 10.7 and 10.8 will require a new investment in software and newer third party hardware as it requires newer drivers the old machines won't have. (forced upgrade because of software, really nice of them)
    http://roaringapps.com/apps:table
    Far as your Safari problem do these things until it's resolved:
    1: Software Update fully under the Apple menu.
    2: Check the status of your plug-ins and update (works for all browsers) also install Firefox and see if your problems continue. You should always have at least two browsers on the machine just in case one fails.
    https://www.mozilla.org/en-US/plugincheck/
    Flash install instructions/problem resolution here if you need it.
    How to install Flash, fix problems
    3: Install Safari again from Apple's web site
    https://www.apple.com/safari/
    4: Run through this list of fixes, stopping with #16 and report back before doing #17
    Step by Step to fix your Mac

  • XSLT For-each loop issue

    Hi All,
    I have a below requirement:
    two source nodes:
    <NODE1>
         <NODE2>
    Here node 2 is optional. i want to check if node 2 is present, if it is present then for-each value of node 2
    if not the the for each must be based on the value of the parent node which is node1.
    Can anyone help me out on this..
    Thanks in Advance!

    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

  • How to traverse back in Mapping?

    If the source delivers the data always in the same order, there's an easier way to achieve this.Within an Expression transformation, you can define variable ports which automatically are initialised to certain values. For example, a numeric variable port will always be initialised to 0 (zero), and strings will always be initialised to an empty string.Now with a small trick one can store the value of the trade ID from the first record and then simply use it from that time onward. This trick uses the fact that variable ports are always processed from top to bottom.Set up one variable port named "v_is_read" of type Integer with this expression:  TRUENow set up another variable port "v_trade_id" of the same data type as the TRADE_ID port immediately before v_is_read with this expression:  IIF( v_is_read, v_trade_id, TRADE_ID)Finally forward the value of v_trade_id as an output port ORIGINAL_ID. How does that work?When the very first record is processed, all variable ports are initialised, meaning "v_is_read" is set to 0 and "v_trade_id" is set to an empty string.Now all input ports are read from top to bottom.Next come all the variable ports. Because "v_trade_id" comes before "v_is_read", the variable port "v_is_read" still has its initialisation value of 0, so the IIF() function above will be evaluated by setting v_trade_id to the current value of the TRADE_ID port (which is the value of the very first input record).After that "v_is_read" will be set to TRUE (and will keep this value throughout the whole session run).Now for all following records the IIF() invokation will simply keep the value that's currently stored in "v_trade_id", and that is the value of the port TRADE_ID from the very first input record. This trick works perfectly with flat file sources and with relational sources which are sorted. Regards,Nico

    Hi, I have a scenario like below: Source: Has three columns as below: Trade_ID,Trade_value,Route_ID101,10,NULL102,10,101103,10,102104,10,103105,10,104...So On. My Target Has 4 columns as below: The Original ID should be the Trade ID of very first record of source. Trade_ID,Trade_value, Route_ID, Original_ID101,10,NULL,101102,10,101,101103,10,102,101104,10,103,101105,10,104,101...So On. How to implement above scenario using mapping. Is it possible to traverse back until the first record in mapping.

  • 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 issue [Solved]

    Hi.
    First of all, just started looking into xsl, so please explain things carefully.
    I need to make a master-detail form, but the xml is a bit tricky.
    I've made a demo here:
    <DATASET>
    <ROWSET1>
    <ROW>
    <ID>1</ID>
    <NAME>Harry Potter</NAME>
    </ROW>
    <ROW>
    <ID>2</ID>
    <NAME>Draco Malfoy</NAME>
    </ROW>
    </ROWSET1>
    <ROWSET2>
    <ROW_R2>
    <OWNER_ID>1</OWNER_ID>
    <PC>HP</PC>
    </ROW_R2>
    <ROW_R2>
    <OWNER_ID>1</OWNER_ID>
    <PC>Dell</PC>
    </ROW_R2>
    <ROW_R2>
    <OWNER_ID>2</OWNER_ID>
    <PC>Compaq</PC>
    </ROW_R2>
    </ROWSET2>
    </DATASET>
    Here's what I want printed:
    Harry Potter
    -HP
    -Dell
    Draco Malfoy
    -Compaq
    Here's how I've tried making my xsl and if's for joining.
    <xsl:for-each select="DATASET/ROWSET1/ROW">
    <xsl:value-of select="NAME"/>
    <xsl:for-each select="../../ROWSET2/ROW_R2">
    <xsl:if test=" ../../ROWSET1/ROW/ID = OWNER_ID">
    <xsl:text>ID: </xsl:text><xsl:value-of select="../../ROWSET1/ROW/ID"/>
    <xsl:text>OWNER_ID: </xsl:text><xsl:value-of select="OWNER_ID"/>
    <xsl:text>PC: </xsl:text><xsl:value-of select="PC"/>
    </xsl:if>
    </xsl:for-each>
    </xsl:for-each>
    This only outputs
    Harry Potter
    Draco Malfoy
    If I remove the if/end if, it outputs
    Harry Potter
    ID:1 Owner_ID:1 PC:HP
    ID:1 Owner_ID:1 PC:Dell
    ID:1 Owner_ID:2 PC:Compaq
    Draco Malfoy
    ID:1 Owner_ID:1 PC:HP
    ID:1 Owner_ID:1 PC:Dell
    ID:1 Owner_ID:2 PC:Compaq
    Obviously there's a couple of things wrong, so if anyone could help out I'd be greatful.
    I know it's a bit tacky looping through twice to find matching id vs owner_id, but with this kind of xml I don't know any other way, and I can't change the xml. Fortunately it's not that much data so it shouldn't be too slow.
    Cheers,
    Vidar
    Message was edited by:
    Vidar
    :added solved to subject

    A solution that works is to great a for-each loop table using ROWSET1 and setting a variable to the ID value. Then put a nested for-each loop inside the first using ROWSET2 and using a filter on the for-each to filter for OWNER_ID like this:
    <?for-each:/DATASET/ROWSET2/ROW_R2[xdoxslt:get_variable($_XDOCTX, 'x')=OWNER_ID]?>
    for template then looks like the following:
    inialize variable 'x'
    for-each ROWSET1
    NAME
    ID set 'x'
    for-each ROWSET2[filter]
    OWNER ID PC
    end for-each
    end for-each

  • How to go back to previous os version

    Hi,
    Could you please help to go back to previous iOs version because my mobile working dead slow...I have the following apps only
    Whatsapp,Facebook messanger,skype,online bank,candy crash game thats all remaning default application given by apple..
    Please tell me the solution for this how to work my without hang and slow process...

    retired_not_******** wrote:
    As you can't go back, purchase a new device with the old OS on it, transfer your sim and restore it with an old backup that is still the old OS and learn your lesson.
    DON'T UPDATE your device.
    That only works if there is a previous backup that is using an iOS that is the same or older as the version of the iOS on the device.  And if the OP ends up purchasing a device that, say is running iOS 6.0.1, but their backup is using 6.1.3, then they're still stuck with having to upgrade.
    It's far easier to simply accept the newer iOS, get used to it, and provide feedback to Apple about what imrovements/changes you'd like to see.  Functionally, iOS 7 is better.  Aesthetically, well, your mileage may vary.

  • How to go back to previous block?

    Hi,
    I got a problem in navigation.I want to go back to previous block if user click a button.I use the function: previous_block but it go back according to how you put inside your datablock tree.I cannot use go_block('block_name') function also because when user click that button, it can go back to different blocks according to different situtations.
    Can anyone help me what is the command to go to previous block??
    Thanks a lot.

    Create a Global variable GLOBAL.PREV_BLOCK
    Before leaving any block to go to another one (look for GO_BLOCK commands and KEY-NXTBLK triggers)
    :GLOBAL.PREV_BLOCK:=SYSTEM.CURSOR_BLOCK;
    When you wish to return to the previous block
    GO_BLOCK (:GLOBAL.PREV_BLOCK)

  • How to go back to previous page

    I have two JSP pages first.jsp and second.jsp the user starts at first.jsp and clicks the submit button which then takes the user to second.jsp where the users information is saved in a database. I want to know how to go back to first.jsp from second.jsp after the users info has been saved? I have been able to get the previous pages url information put I don't know what to do with it. I know there is a jsp:forward but don't think this can help me. PLEASE someone help me I am stuck and need to move forward.
    thank you

    Why do you think that jsp:forward will not fit your requirement? An alternative is to use sendRedirect()

  • How to go back to previous step in a sub workflow?

    We are calling a sub workflow upon approval action from a main workflow. In the child workflow we have 9 steps. If at any step in the child workflow (other than first) user does reject action, the workflow control should go back to previous step in the child workflow itself.
    We added a custom action in the exit events of all the child workflow steps. Following is the logic of exit event of Step4 of child workflow. Similar logic is there for all steps in the child workflow.
    <$if wfAction and wfAction like "REJECT"$>     
         <$wfSet("wfJumpTargetStep", "Step3@childWF")$>
         <$wfSet("wfJumpEntryNotifyOff", "0")$>
    <$endif$>
    With this code when the user is doing reject action from child workflow, it is taking us back to the main workflow and not to the previous step of child workflow.
    Is this approach correct?
    -Pratap

    1. The 3 events are Entry, Update, and Exit.
    2. Rejects happen in the Update area but you can not reliably react to it there because upon reject it immediately leaves (not going through the exit event).
    3. The rejected content goes backwards in the Workflow step by step (even going back to the main workflow from a sub workflow) until it finds a Step that has valid Editors (not just reviewers).
    4. If it does not find an Editor step it goes all the way back to the automatic Contribution step at the beginning of the Workflow and sits there in a kind of no mans land until the contributor (or an admin) goes and approves it again.
    5. To check if something has been rejected the Entry Event of an editor Step BEFORE the step where it is rejected needs to have code to check for the Reject status.
    The sub workflow should be able to capture the Reject as you desire. Are all of the steps in the child workflow (sub workflow) Review only steps? Or maybe the people in the steps do not have RW access to the document? This is what I would predict with your described symptoms.

  • I hate version 4, tell me how to get back to previous version of Firefox or I'm going to IE !!!

    Version 4 is awful, I hate it and will NOT use it.

    Firefox is highly customizable and you may be able to customize it to meet your needs.
    If you do not like the new UI, you can make Firefox 4 look and behave more like Firefox 3.6, for details see http://www.computertechtips.net/64/make-firefox-4-look-like-ff-3-6
    To downgrade to Firefox 3.6 first uninstall Firefox 4, but do not select the option to "Remove my Firefox personal data". If you select that option it will delete your bookmarks, passwords and other user data.
    You can then install the latest version of Firefox 3.6 available from http://www.mozilla.com/en-US/firefox/all-older.html - it will automatically use your current bookmarks, passwords etc.
    To avoid possible problems with downgrading, I recommend going to your profile folder and deleting the following files if they exist - extensions.cache, extensions.rdf, extensions.ini, extensions.sqlite and localstore.rdf. Deleting these files will force Firefox to rebuild the list of installed extensions, checking their compatibility, and reset toolbar customizations.
    For details of how to find your profile folder see https://support.mozilla.com/kb/Profiles

  • How to iterate to a previous node with a treemap

    I have am using a treemap with the comparable interface. an iterator can be used to go to the 'next' node. How do i go to the 'previous' node?

    [url http://forum.java.sun.com/thread.jsp?forum=31&thread=567262]Crosspost

  • I don't want new upgrade for iPhone 4 how to go back?

    My phone does not work as good as it did before the upgrade to 6  the camera is slow the screen gets stuck I want the older version or a new fix

    there is no way to revert back to older software. try to backup and restore the current software to fix any issues with the software

Maybe you are looking for

  • How to remove gaps/null values from set of columns in a row

    Im trying to implement a solution for removing null value columns from a row. Basically in below example i have five codes and corresponding id's for that codes.What im trying to achive here is if i have a null code then i have to move next not null

  • OSX Mountain Lion - piece of junk

    OSX Mountain Lion is a pice of junk! (and this is coming from a die-hard Apple enthusiast) the system crashes, the promised quicker performance is at at the cost of stability of the system, shame on you Apple! I cannot even write a review using the r

  • CF not returning results of CFIF

    I am trying to make website sections have a different appearance when selected. My code all works fine unless you click on the first item in the list "HOME", then it refused to return the results of any of the cfif's after it. Attached is the code an

  • SQL Loader: refer datafile name in the control file

    Hi All: Database: 10GR2 I have a table as following: test ( filename varchar2(100), mydata varchar2(1000) I am using sql loader to populate data for this table. I also need store the datafile name to column test.filename as part of dataload. How to r

  • How to compile a LabVIEW VI into a standalone .exe programme? (LV8.5.1 student edition)

    Hi, I have LabVIEW 8.5.1 Student Edition and am not sure how to compile my VI into a standalone executable (.exe file) that can run without LabVIEW being installed on the computer (no data cards are being read, the VI is providing a simulation of an