cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue:Hierarichal to Flat conversion

former_member184789
Active Contributor
0 Kudos

Hi,

I have a mapping issue, which doesn't seem to be resolved by node functions. The fields on source side & target are similar but heirarchy is different. In source side I have a structure like:

Header(0:1)

  Header_Details(0:unbounded)

     Item_Details(0:unbounded)

Record_Trailer(0:1)

In target I have

Header(0:1)

Header_Details(0:unbounded)

Item_Details(0:unbounded)

Record_Trailer(0:1)

Thus, If in source I get a message like:

Header(0:1)

  Header_Details(0:unbounded)

     Item_Details(0:unbounded)

Header_Details(0:unbounded)

     Item_Details(0:unbounded)

     Item_Details(0:unbounded)

Record_Trailer(0:1)

In target  i would like to have:

Header(0:1)

Header_Details(0:unbounded)

Item_Details(0:unbounded)

Header_Details(0:unbounded)

Item_Details(0:unbounded)

Item_Details(0:unbounded)

Record_Trailer(0:1)

Note how the Header_Details got populated twice but after the Item_Details. Can anyone provide the detailed solution. At present, all the two Detail_Header get populated before the three Item_Details.Please help.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Can you try as below

Header_Details-->split by value(eachvalue)-->Header_Details

  Item_Details--> Item_Details

Record_Trailer-->Record_Trailer

Regards

Venkat

Former Member
0 Kudos

Hi Adarsh,

You can try this with xslt mapping:

I tried below xsl:

input:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Header>
<HDetails>
<item/>
</HDetails>
<HDetails/>
<HDetails>
<item/>
<item/>

</HDetails>
</Header>

XSL:

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

<xsl:template match="/">
<Header>
<xsl:apply-templates  select="//HDetails"/>
</Header>
</xsl:template>

<xsl:template match="item">
<xsl:copy/>
</xsl:template>

<xsl:template match="HDetails">
<xsl:copy/>
<xsl:apply-templates  select="child::item"/>

</xsl:template>


</xsl:stylesheet>

Output:

<?xml version="1.0" encoding="UTF-8">

<Header><HDetails/><item/><HDetails/><HDetails/><item/><item/></Header>

Regards,

Beena.

former_member184789
Active Contributor
0 Kudos

Thanks Beena,

I found the answer myself.

Here it is:

http://scn.sap.com/people/karthiknarayan.kesavan2/blog/2007/08/22/file-content-conversion-for-multi-...

But thanks anyways..