Page 1 of 1

XML transformation issue

Posted: Wed Oct 30, 2013 11:54 am
by techiexavier
Hi All,

My xml file look like below,

<Parent>
<Id>A1</Id>
<Sid>A1id</Sid>
<Group>
<lov type="time">
<id1>1</id1>
<desc>US</desc>
</lov>
<lov type="loc">
<id1>2</id1>
<desc>US</desc>
</lov>
</Group>
</Parent

<Parent>
<Id>B1</Id>
<Sid>B1id</Sid>
<Group>
<lov type="time">
<id1>11</id1>
<desc>US</desc>
</lov>
<lov type="loc">
<id1>12</id1>
<desc>US</desc>
</lov>
</Group>
</Parent


and if i take the
1. "id" as the key field (repetition element), from the lov type one is missed out. Only "time" has been take for processing. and "loc" has been dropped.
2. But if i take the "type" as the key field i am getting the id value same for all the records.

Let me know if transformations are needed.

Please help me to solve this issue.

Thanks!

Posted: Wed Oct 30, 2013 1:07 pm
by eostic
Choose id1 or desc as your repeating element. If they both appear ALL the time, it should be fine. If you fear that one or the other might not exist, uncheck "repetition element required".

Ernie

Posted: Wed Oct 30, 2013 1:09 pm
by techiexavier
One more finding,

When i keep the "id" field as the last field in the transformations it is working fine with key field as "type". Now i am getting all the "type" data and corresponding id field also populated correctly.

Before "id" was the first field in the transformation and only the first id value has been populated for all the records.

Any idea how it works. TIA.

Posted: Wed Oct 30, 2013 4:15 pm
by eostic
Hard to say. It generates xslt. Perhaps the change in order impacts the generated xslt. Either way, I always try, as a best practice, to keep the elements in the order of their placement in the hierarchy....with the most deeply nested elements and attributes at the bottom of the link column list.

Ernie