cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT mapping

Former Member
0 Kudos

Hi Expertise,

Please give me the XSLT mapping to get the desired output for the specified input format.(to group based on the field "group")

Input:

<item>

<group>1</group>

<name>item-1<//name>

<cost>12.22</cost>

</item>

<item>

<group>2</group>

<name>item-2<//name>

<cost>12.22</cost>

</item>

<item>

<group>2</group>

<name>item-3<//name>

<cost>12.22</cost>

</item>

<item>

<group>1</group>

<name>item-4<//name>

<cost>12.22</cost>

</item>

<item>

<group>2</group>

<name>item-5<//name>

<cost>12.22</cost>

</item>

Output required:

<group>

<item>

<group>1</group>

<name>item-1<//name>

<cost>12.22</cost>

</item>

<item>

<group>1</group>

<name>item-4<//name>

<cost>12.22</cost>

</item>

</group>

<group>

<item>

<group>2</group>

<name>item-2<//name>

<cost>12.22</cost>

</item>

<item>

<group>2</group>

<name>item-3<//name>

<cost>12.22</cost>

</item>

<item>

<group>2</group>

<name>item-5<//name>

<cost>12.22</cost>

</item>

</group>

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

Saravanan,

Follow the below logic.



item -----> item

group[Change Context]------>Sort[Choose Numerical,Ascending]------> SplitByValue[EachValue]-----> group

group[Change Context] & name[Change Context]------>Sort By Key[Choose Numerical,Ascending]------> SplitByValue[EachValue]-----> Name

group[Change Context] & cost[Change Context]------>Sort By Key[Choose Numerical,Ascending]------> SplitByValue[EachValue]-----> cost

I hope it helps!

raj.

Former Member
0 Kudos

Raj,

How this can be done "group[Change Context] & name[Change Context]------>"

Former Member
0 Kudos

Saravanan,

He means right click on Group and Name and put the context to Item. (one level up).

Regards,

---Satish

justin_santhanam
Active Contributor
0 Kudos

Saravanan,

Right click on group and choos Context ---> Now choose the Parent node of item.

For example,

<MT_Input>

<Row>

<item>

<group/>

..

..

</item>

then, if you do right click on group and if you choose context, the default selected will be item, coz the item is the parent node for group. As in my example instead of item , choose it as Row.

Sort By Key expects two input. Hence in the top node give group and the bottom node give name.

Hope it helps, if not reply back.

raj.

Answers (1)

Answers (1)

justin_santhanam
Active Contributor
0 Kudos

Saravanan,

You are sorting and you are not grouping right? By the way just curiosity ,why don't you want to achieve this using Graphical Mapping?

raj.

Former Member
0 Kudos

Hi Raj,

If this can be handled in normal mapping Please give me an idea how we can do it.

the XSLT mapping can be for sorting also, even that would help me.

justin_santhanam
Active Contributor
0 Kudos

Saravanan,

This can be easily done by Sort By key functionality in mapping. I will give you the clear picture, in short while.

raj.

Former Member
0 Kudos

Raj,

But how coud i retain all other field values of the same/corresponding context