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

Similar Messages

  • How to use For-Each Structure with Multiple node XML structure

    Hi,
      How to use for-each (BPEL 2.0) construct for Multinode XML structure.
    Here is the easy case: I have list of suppliers specified by supplier
    <supplierList>
    <supplier>1</supplier>
    <supplier>2</supplier>
    <supplier>3</supplier>
    </supplierList>
    Now there is a web service http://hostname/getsupplierdetails/wsdl which accepts one supplier at a time.
    like
    <supplier>1</supplier>
    reponse object is
    <message> notfound/found </message>
    But how can I use for each of XML node to call this service and collect the result like
    <supplierList1>
         <Suppinfo>
            <supplier>1</supplier>
            <message> not found</message>
    </suppinfo>
        <suppinfo>
            <supplier>1</supplier>
            <message> not found</message>
    </suppinfo>
    </supplierlist1>
    Thanks

    For looping you use foreach loop and , loop for the number of occurences and when constructing response, adding a new element you have to use bpelx:append.  Good sample at Enterprise Integration: Oracle SOA Suite 11g: Populating a list or an array in BPEL without using XSLT.

  • Loading accdb file using for each loop in to single target table

    I have 3 accdb file as below in single folder, in control flow I have created a for each loop to loop through all the below file.  In dataflow task I have created oledb source using connection manager to point to first file a1.accdb. I am trying
    to load all the file into single below mentioned target table, here It is only loading first file it is not looping through other two file.
    This I have tried to load .txt files and csv files it is working perfectly but similarly when I try to load access db file table it is not working, can any one of you help me?
    1. a1.accdb contains only one table  a1tab ( col1 col2 col3 )  
    2. a2.accdb  contains only one table  a2tab  ( col1 col2 col3 )
    3. a3.accdb  contains only one table  a3tab   ( col1 col2 col3 )
    I have a target table with similar structure as source
    Target table <TargetTable> Col1 Col2 Col3
    aak

    Thanks Arthur, please find below response
    How do you handle the different table names?  Cant we handle it in a similar manner, how we handle the .csv/.txt files with different name and similar structure for sources(multiple files) and target (single table)
    Is it good to drop the idea of for each loop and create a separate task for each accdb file? to be loaded to same target table( performance wise etc.. any justification would be helpful)
    You must handle the connection string dynamically?
    Can you help me with the logic for handling connection string dynamically
    aak

  • How to use 'for-each' in transform

    Hi
    I have created a BPEL process which transforms '.csv' to '.xml'
    The input .csv looks like this
    1,09042008,1263,80019.5,HC_D
    2,01011030,J100246,00051779J1002460903,30032008,46.20,LUTON PRIME
    3,01011030,SE1320/4431,46.20,00051779Payment,0.00,2
    2,01011030,J100246,00051779J1002461603,30032008,46.20,LUTON PRIME
    3,01011030,SE1320/4431,46.20,00051779Payment,0.00,2
    2,01011030,J100246,00051779J1002462303,30032008,46.20,LUTON PRIME
    3,01011030,SE1320/4431,46.20,00051779Payment,0.00,2
    so the line which starts with '1' is the header
    the line which starts with '2' is the voucher
    the line which starts with '3' is the detail
    and the input.xsd file looks like this
    <xsd:element name="Root-Element">
    <xsd:complexType>
    <xsd:choice minOccurs="1" maxOccurs="unbounded" nxsd:choiceCondition="terminated" nxsd:terminatedBy=",">
    <xsd:element name="Header" nxsd:conditionValue="1">
    <xsd:complexType>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="Voucher" nxsd:conditionValue="2">
    <xsd:complexType>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="Detail" nxsd:conditionValue="3">
    <xsd:complexType>
    </xsd:complexType>
    </xsd:element>
    </xsd:choice>
    </xsd:complexType>
    </xsd:element>
    I am facing problem when I use transform activity and transform this input .csv to .xml file having i/p and o/p xsd as same type of xsds.
    Using for-each on Root-element copies the entire i/p and using for-each on Individual elements does loop individually.
    Can anyone please help me
    thanks
    Iswarya

    Hi,
    Can you explain in detail, where exactly your stucked?
    Umesh

  • How to use For Each execution in OSB

    hi all,
    I'm confused about the 'For Each' action in OSB. Now, I have a variable('max') which equals to 3 , and I wanna to use For Each action to perform a loop execution, something like for(1 to 3)--
    The code is like below:
    For Each variable 'value' of variable 'max' ,
    Do{
    Assign value to variable tempMsg;
    Service Callout to PS with tempMsg
    What I think is the 'value' should be increased from 1 to 3 itself, and the service callout should be performed by 3 times with '1', '2', '3'. However, it's not, the service callout action was performed once with the value of 3, just like the 1 and 2 were overwritten.
    Any idea?

    Using 'For Each' activity in OSB
    Thanks,
    Vijay

  • For-each loop in OSB

    Hi,
    I have a senario where i have a varied length XMl is coming to me in response of a service callout, and I need to iterate over it to get the fieldvalue of a particular tag based on its fieldName(e.g FUNCTION_CODE) and assign to a tag of another xml for example
    THE XML Coming as response of service callout is
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
    <getDefaultValueResponse xmlns="http://data.transformation.nab.cz.fc.ofss.com">
    <getDefaultValueReturn>
    <fieldDefaultValue>F</fieldDefaultValue>
    <fieldName>FUNCTION_CODE</fieldName>
    </getDefaultValueReturn>
    <getDefaultValueReturn>
    <fieldDefaultValue xsi:nil="true"/>
    <fieldName>PAYMENT_TRANSACTION_ID</fieldName>
    </getDefaultValueReturn>
    <getDefaultValueReturn>
    <fieldDefaultValue xsi:nil="true"/>
    <fieldName>CHANNEL_ID</fieldName>
    </getDefaultValueReturn>
    <getDefaultValueReturn>
    <fieldDefaultValue>CR</fieldDefaultValue>
    <fieldName>CREDIT_DEBIT_FLAG</fieldName>
    </getDefaultValueReturn>
    <getDefaultValueReturn>
    <fieldDefaultValue xsi:nil="true"/>
    <fieldName>BRAND</fieldName>
    </getDefaultValueReturn>
    <getDefaultValueReturn>
    <fieldDefaultValue>001</fieldDefaultValue>
    <fieldName>ACCOUNT_STATUS</fieldName>
    </getDefaultValueReturn>
    <getDefaultValueReturn>
    <fieldDefaultValue>Mr</fieldDefaultValue>
    <fieldName>NAME_TITLE</fieldName>
    </getDefaultValueReturn>
    <getDefaultValueReturn>
    <fieldDefaultValue>Y</fieldDefaultValue>
    <fieldName>MAIL_RETURN_INDICATOR</fieldName>
    </getDefaultValueReturn>
    <getDefaultValueReturn>
    <fieldDefaultValue xsi:nil="true"/>
    <fieldName>ENTITY</fieldName>
    </getDefaultValueReturn>
    <getDefaultValueReturn>
    <fieldDefaultValue xsi:nil="true"/>
    <fieldName>TRANSACTION_CURRENCY</fieldName>
    </getDefaultValueReturn>
    <getDefaultValueReturn>
    <fieldDefaultValue xsi:nil="true"/>
    <fieldName>VERSION</fieldName>
    </getDefaultValueReturn>
    <getDefaultValueReturn>
    <fieldDefaultValue xsi:nil="true"/>
    <fieldName>TRANSACTION_RATE</fieldName>
    </getDefaultValueReturn>
    </getDefaultValueResponse>
    </soapenv:Body>
    </soapenv:Envelope>
    and i want to assign that value to transactionType tag of
    <?xml version="1.0" encoding="UTF-8"?>
    <tns:sandstonetns xmlns:tns="http://sandstone.response.transactionHistory.app.nab.cz.fc.ofss.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://sandstone.response.transactionHistory.app.nab.cz.fc.ofss.com Sandstone_Data_Transaction_History_Response.xsd ">
    <tns:listOfTransactions>
    <tns:transactions>
    <tns:clients>
    <tns:clientID>tns:clientID</tns:clientID>
    </tns:clients>
    <tns:timestamp>2001-12-31T12:00:00</tns:timestamp>
    <tns:sequenceNumber>tns:sequenceNumber</tns:sequenceNumber>
    <tns:description>tns:description</tns:description>
    <tns:amount>0</tns:amount>
    <tns:accountNumber>tns:accountNumber</tns:accountNumber>
    <tns:debitOrCreditFlag>tns:debitOrCreditFlag</tns:debitOrCreditFlag>
    <tns:*transactionType*>tns:transactionType</tns:transactionType>
    </tns:transactions>
    </tns:listOfTransactions>
    <tns:returnResponse>
    <tns:returnCode>0</tns:returnCode>
    <tns:returnDescription>tns:returnDescription</tns:returnDescription>
    </tns:returnResponse>
    </tns:sandstonetns>
    I want to achieve this using for-each loop...kindly help me as I dont have any idea about how to use for-each loop...

    i want to select a the tag fieldValue based on the data in tag fieldName for eg if i iterate over the whole response XML searching for fieldName=FUNCTION_CODE then I whuold get the value 'F' and then I would assign this value 'F' to the transactionType tag of the XML
    <?xml version="1.0" encoding="UTF-8"?>
    <tns:sandstonetns xmlns:tns="http://sandstone.response.transactionHistory.app.nab.cz.fc.ofss.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://sandstone.response.transactionHistory.app.nab.cz.fc.ofss.com Sandstone_Data_Transaction_History_Response.xsd ">
    <tns:listOfTransactions>
    <tns:transactions>
    <tns:clients>
    <tns:clientID>tns:clientID</tns:clientID>
    </tns:clients>
    <tns:timestamp>2001-12-31T12:00:00</tns:timestamp>
    <tns:sequenceNumber>tns:sequenceNumber</tns:sequenceNumber>
    <tns:description>tns:description</tns:description>
    <tns:amount>0</tns:amount>
    <tns:accountNumber>tns:accountNumber</tns:accountNumber>
    <tns:debitOrCreditFlag>tns:debitOrCreditFlag</tns:debitOrCreditFlag>
    *<tns:transactionType>tns:transactionType</tns:transactionType>*
    </tns:transactions>
    </tns:listOfTransactions>
    <tns:returnResponse>
    <tns:returnCode>0</tns:returnCode>
    <tns:returnDescription>tns:returnDescription</tns:returnDescription>
    </tns:returnResponse>
    </tns:sandstonetns>

  • How can I enable for-each loop in Creator update 1?

    I try to use for-each loop, but I got error message from compiler is
    " for-each loops are not supported in -source 1.4. (try -source 1.5 to enable for-each loops)"
    How can I switch my source to 1.5.. I am using jdk 1.5. Confusing.
    Thanks .
    Richard

    Hi!
    Actually Sun Java Studio Creator doesn't support Java EE 5 projects. If You want to create Java EE 5 project, try to use NetBeans with Visual Web Pack installed.
    Thanks,
    Roman.

  • For-each loops

    while working in jbuilder2005 i want to use for-each loops i see following error;
    " for-each loops are not supported in -source 1.2 (try -source 1.5 to enable for-each loops) "
    i configured the jdk libraries source to jdk1.5 even then i found problem
    do any body know
    Message was edited by:
    citymodel

    What it says: Java 1.2 does not have for-each loops. You configured it to use 1.5, but you also configured the compiler to check for 1.2-code compliance. Read the JBuilder manual or help about how to find and change the setting. It's probably somewhere in the project settings.

  • Excel Sheet Looping: For each loop from variable Enumerator

    Hi,
    Is it possible to do excel sheets looping using For each loop Enumerator as "For Each loop from Variable enumerator" ? If yes, please help.
    Also,
    I have an excel file with 10 sheets, but want to loop only 5 sheets. Please help..how can i achieve this. 
    Actually i tried with
    1> stored the 5 sheets name into a variable (say 'SheetsName') of type string using script task
    2> For each loop container
       enumerator - 'For each ADO Schema Rowset enumerator'
       connection: ADO
       schema: 'Tables'
       variable mapping: 'User::SheetsName'
    3> Within For each loop container added a data flow task
    4> Inside DFT - excel source - 
       Data access Mode: 'Table Name or view name variable'
       Variable Name: 'SheetsName'
    but this loops through all the 10 sheets irrespective of only 5 sheets names stored in the variable "SheetsName".
    Please help...
    Please Mark as Answer if my post solved your problem or Vote As Helpful if this helps. Blogs: www.sqlserver2005forum.blogspot.com

    >> Is it possible to do excel sheets looping using For each loop Enumerator as "For Each loop from Variable enumerator" ? If yes, please help.
    I don't think so. To loop through all worksheets of Excel For ADO.NET Schema Rowset Enumerator is the only option.
    Please refer:
    https://msdn.microsoft.com/en-us/library/ms345182(v=sql.110).aspx
    >> I have an excel file with 10 sheets, but want to loop only 5 sheets
    So you have configured For Each loop container which loops throgh all sheets and returns you sheet name to variable "SheetName".
    Drag and drop one Sequence Container inside ForEach Loop Container and connect it to Data Flow Task.
    Right click on connector and use expression: (which will check if current sheet is one of 5 required sheets)
    @User::SheetName == "FirstSheet" ||  @User::SheetName == "SecondSheet" || .....
    Below blog demonstrates kind of simillar steps:
    http://www.bidn.com/blogs/MikeDavis/ssis/559/ssis-skip-certain-files-in-a-for-each-loop 
    -Vaibhav Chaudhari

  • After reopening Firefox does not remember which desktop was used for each window. Can you help, please.

    I'm using two displays and several desktops on my Mac (OS X 10.9.4).
    When I need to restart Firefox, it remembers to open windows from last session in correct display, but does not remember which desktop was used for each window. So when the application starts, it opens all windows on a desktop which is currently active instead of reopening them on desktops used during the last session. How to fix the issue?

    Hi Nerva,
    Thank you for your question, there is a add on I have been recommended to custom set up of opening windows in new monitors. It's called [https://addons.mozilla.org/en-US/firefox/addon/monitor-master/ Monitor Master].
    However, in regards to the session remembering which monitor the window was open in, in the profile folder there is a file that stores window positions and dimensions. It is called localstore.rdf.
    Please stay tuned for more investigation, as there are definitely bugs on file for similar issues. Pinpointing it is the hard part.

  • SSIS For Each Loop Container

    Hello All,
    I have some files within sub folders. Below is the layout 
    C:\Source\01012015\Sample_1.csv
    C:\Source\01012015\Sample_2.csv
    C:\Source\02012015\Sample_1.csv
    C:\Source\02012015\Sample_2.csv
    C:\Source\03012015\Sample_1.csv
    C:\Source\03012015\Sample_2.csv
    I want
    to copy entire folder contents from source to destination including the sub folders and the files
    I am using for each loop container which reads the files form 01012015 folder, is there any way to read
    all the files from each and every folder(01012015, 02012015,03012015)?
    The destination should be like this. 
    C:\Archive\01012015\Sample_1.csv
    C:\Archive\01012015\Sample_2.csv
    C:\Archive\02012015\Sample_1.csv
    C:\Archive\02012015\Sample_2.csv
    C:\Archive\03012015\Sample_1.csv
    C:\Archive\03012015\Sample_2.csv
    Thanks, Shyam.

    Hi Shyam,
    According to your description, you want to copy entire folder contents including the sub folders and the files from source to destination.
    Based on my research, we should use Foreach File Container together with File System Task to achieve your requirement. For more details, please refer to the following links:
    https://social.msdn.microsoft.com/forums/sqlserver/en-US/4d99ebef-df43-44ad-9794-1d729cbf52e9/ssis-foreach-loop-copy-within-subfolders
    http://www.sql-programmers.com/for-each-loop-container.aspx
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Studio Creator 2 for-each loop error

    Hi,
    I am using Studio Creator 2 early Access 2. The JDK is using 1.5. But when I use for-each loop. There is an error - source 1.4 for-each loop is not support, try -source 1.5.
    Why ?
    Thanks
    Wilson

    Hi Wilson,
    Please take a look at the following threads in the EA forum at the Feedback Programs Portal.
    https://feedbackprograms.sun.com/project/forum/thread.html?cap={3F4DA363-16D3-4D4C-920C-992ECB054B6D}&forid={CC6B8562-F896-4A44-ACB6-4684BDD05E19}&topid={8D824969-544E-407A-8D4A-C375CC577169}
    https://feedbackprograms.sun.com/project/forum/thread.html?cap={3F4DA363-16D3-4D4C-920C-992ECB054B6D}&forid={CC6B8562-F896-4A44-ACB6-4684BDD05E19}&topid={C124D2B1-562A-4638-AD52-A6954A2112E0}
    As youcan see JDK 1.5 is not completely supported and the engineers are aware of this and are working hard on the issue.
    We also request you to post Creator 2 EA 2 related queries at the Feedback Programs Portal for which the URL is:
    https://feedbackprograms.sun.com/login.html
    Cheers
    Giri

  • Is there any way to use a For Each Loop for each property of an User Defined Type?

    Is there any way to use a For Each Loop for each property of an User Defined Type? That would be very handy!
    Jorge Barbi Martins ([email protected])

    Alas, no, not in VBA.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • Using IF in a for each loop which is grouped by two fields

    Hi ,
    My requirement is to filter the Payment records ,based on the parameter input date and also group by based on two of the Fields and calculate the sum of the payment Amounts.
    I have created a for each loop with the group by first on one field and then the other field.
    My question is where should I put my IF condition based on parameter dates ?
    If condition would be if Created = Date Parameter .CAn anybody help where I should insert the IF condition in the below code.
    Ex:
    <?for-each-group:Payments;./Created?>
    Display Date : Created
    <?for-each-group:current-group();./CreatedByName?>
    Table      :      CreatedByName     count of Payments           Sum of Amount
    <?end for-each-group?>
    <?end for-each-group?>
    thanks.

    Hi ,
    I got the result by putting the filter in [ ]
    Ex:
    <?for-each-group:Payments[PaymentStatus != 'New';./CreatedDate?>
    here I am filtering the records based on [Payment Status != New] and then group by Created Date .
    Similarly I can new another condition as well in the same statement
    <?for-each-group:Payments[PaymentStatus != 'New'][PaymentMethod != 'Cash'];./CreatedDate?>
    Regards.

  • For Each Loop for XML Task

    Hello Everyone,
    Please assist with a step by step guide on how to setup a For Each Loop for XML Task
    I'm trying to convert XML to XSLT
    I have tried more than 10 times and i just do not know what i am doing wrong - no error, my package just runs for a few seconds but nothing happens
    Thanks in advance
    Dee

    I managed to get my XML to XSLT to work but now when i run my package to import the data into SQL table,
    it stops after a few records, i get the following error: 
    [XML Source [1]] Error: The component "XML Source" (1) was unable to process the XML data. The element "Errors" cannot contain a child element. Content model is text only.
    Please assist
    Check this:
    http://social.msdn.microsoft.com/Forums/en-US/80726e0c-9e85-43ca-87bc-7cf90fd7fb31/xml-source-data-flow-throws-cannot-contain-a-child-element-content-model-is-text-only-error?forum=sqlintegrationservices
    Chaos isn’t a pit. Chaos is a ladder. Many who try to climb it fail and never get to try again. The fall breaks them. And some are given a chance to climb, but they refuse. They cling to the realm, or the gods, or love. Illusions. Only the ladder is real.
    The climb is all there is.

Maybe you are looking for