Page 1 of 1

How to Sort XML message

Posted: Fri Nov 30, 2007 8:36 am
by satishu
Hi all,


I am working as an XI developer, we are using XSLT mapping programms in XI. Now i have a requirement like I am sending from one XML message to another XML message. here my requirement is suppose I have a XML structure like bellow.

<List>
<EMID>1002</EMID>
<Ename>AAA</Ename>
<DeptID>10</DeptID>
<List>
<List>
<EMID>1003</EMID>
<Ename>BBB</Ename>
<DeptID>10</DeptID>
<List>
<List>
<EMID>1001</EMID>
<Ename>CCC</Ename>
<DeptID>10</DeptID>
<List>

I want to sort this structure with EMID wise and send to target as bellow
<List>
<EMID>1001</EMID>
<Ename>CCC</Ename>
<DeptID>10</DeptID>
<List>
<List>
<EMID>1002</EMID>
<Ename>AAA</Ename>
<DeptID>10</DeptID>
<List>
<List>
<EMID>1003</EMID>
<Ename>BBB</Ename>
<DeptID>10</DeptID>
<List>


How can I achive this requirement.


Thanks in advance,
Satish

Posted: Mon Dec 03, 2007 5:31 pm
by jkmyoung
<xsl:for-each select="List">
<xsl:sort select="EMID"/>
<xsl:copy-of select="."/>
</xsl:for-each>