This discussion is archived
5 Replies Latest reply: Jan 6, 2013 9:54 PM by 801667 RSS

Handling Nested for loops in transformation XSLT

801667 Newbie
Currently Being Moderated
Hi,
I want to handle nested for each loops inside the transformation sheet.
I have two source collections and one target collection.
I have to Lookup the key value in source1 in source2 and if the key is found, i have to map value to target and if the key is not found, i want to may the key itself to target.

Below are the sample input and expected outputs from the transformation sheet. Please help in transforming to the required format.

Input
----------------------
------------------------
<Source1Collection>
<Group1>
<Key> a </Key>
<Value> i </Value>
</Group1>
<Group2>
<Key> b </Key>
<Value> ii </Value>
</Group2>
<Group3>
<Key> c </Key>
<Value> iii </Value>
</Group3>
</Source1Collection>
---------------------------------------
<Source2Collection>
<Feild1> z </Feild1>
<Feild1> x </Feild1>
<Feild1> c </Feild1>
<Feild1> v </Feild1>
<Feild1> b </Feild1>
</Source2Collection>
----------------------------------------

Output
--------------------------------------
--------------------------------------
<TargetCollection>
<Field1>a</Feild1>
<Field1>b</Feild1>
<Field1>iii</Feild1>
</TargetCollection>

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points