Hi,
I need to do some sorting of the XML file. First, group the group_1 first and then sort those group_1 block by SORT_ID and Salary. Second, group the group_2 and then sort those group_2 block by SORT_ID.
I just try the below and it works if the XML only have group_1..........
***********************************************************
<xsl:template match="allgroup">
<xsl:apply-templates>
<xsl:sort select="SORT_ID" data-type="number"/>
<xsl:sort select="salary" data-type="number"/>
</xsl:apply-templates>
</xsl:template>
Input XML
************************************************************
<allgroup>
<group_1 id="1">
<last>Hill</last>
<first>Phil</first>
<salary>100000</salary>
<SORT_ID>1</SORT_ID>
<hireDate>04/23/1999</hireDate>
</group_1>
<group_1 id="2">
<last>Herbert</last>
<first>Johnny</first>
<salary>95000</salary>
<SORT_ID>2</SORT_ID>
<hireDate>09/01/1998</hireDate>
</group_1>
<group_2 id="5">
<last>Hill</last>
<first>Phil</first>
<salary>100000</salary>
<SORT_ID>1</SORT_ID>
<hireDate>04/23/1999</hireDate>
<role>M</role>
</group_2>
<group_1 id="3">
<last>Tony</last>
<first>Graham</first>
<salary>89000</salary>
<SORT_ID>1</SORT_ID>
<hireDate>08/20/2000</hireDate>
</group_1>
<group_1 id="4">
<last>Jack</last>
<first>Johnny</first>
<salary>100000</salary>
<SORT_ID>2</SORT_ID>
<hireDate>09/01/1998</hireDate>
</group_1>
</allgroup>
Output XML
************************************************************
<?xml version="1.0" encoding="UTF-16"?>
<allgroup>
<group_1>
<last>Tony</last><first>Graham</first><salary>89000</salary><hireDate>08/20/2000</hireDate><SORT_ID>1</SORT_ID>
</group_1>
<group_1>
<last>Hill</last><first>Phil</first><salary>100000</salary><hireDate>04/23/1999</hireDate><SORT_ID>1</SORT_ID>
</group_1>
<group_1>
<last>Herbert</last><first>Johnny</first><salary>95000</salary><hireDate>09/01/1998</hireDate><SORT_ID>2</SORT_ID>
</group_1>
<group_1>
<last>Jack</last><first>Johnny</first><salary>100000</salary><hireDate>09/01/1998</hireDate><SORT_ID>2</SORT_ID>
</group_1>
<group_2>
<role>M</role>
</group_2>
<allgroup>
Any suggestion?
Thanks.
AOTONY