XML transformation issue

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
techiexavier
Participant
Posts: 39
Joined: Tue Feb 28, 2012 12:59 pm
Location: Chennai

XML transformation issue

Post 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!
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post 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
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
techiexavier
Participant
Posts: 39
Joined: Tue Feb 28, 2012 12:59 pm
Location: Chennai

Post 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.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post 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
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply