on 03-13-2008 8:16 PM
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>
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.