Hi Everybody,
I would like to sort a XML by using multiple criteria.
<?xml version="1.0" ?>
<Exp xsi:schemaLocation="urn:com:ds:config Exp.xsd" xmlns:xsi=" xmlns="urn:com:ds:cfg">
<Expression>
<Context HolderType="Mod" HolderName="test">
<TreeSeries Type="Prd" Name="test STD">
<Tree>
<Root IsExcluded="false" Name="test STD B" Revision="5"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD" Revision="TC"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD" Revision="10"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD MTC" Revision="5"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD" Revision="1"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD" Revision="2"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD MTC" Revision="6"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD A" Revision="1"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD A" Revision="3"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD MTC" Revision="1"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD B" Revision="2"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD C" Revision="1"/>
</Tree>
</TreeSeries>
</Context>
</Expression>
</Exp>
here should be the result :
"test STD MTC" should appear first in revision order
then other "test STD xx" in alphabetical order for name and ascendant order for revision
then "test STD" order by revision knowing that "TC" need to be display always after revision 2.
test STD MTC - 1
test STD MTC - 5
test STD MTC - 6
test STD A - 1
test STD A - 3
test STD B - 2
test STD B - 5
test STD C - 1
test STD - 1
test STD - 2
test STD - TC
test STD - 10
I try to use xsl:sort but I have too many criteria to order this XML so I think I have to create multiple list to order them as I want but I don't know how to do it.
if someone has an idea ?
Thanks
I would like to sort a XML by using multiple criteria.
<?xml version="1.0" ?>
<Exp xsi:schemaLocation="urn:com:ds:config Exp.xsd" xmlns:xsi=" xmlns="urn:com:ds:cfg">
<Expression>
<Context HolderType="Mod" HolderName="test">
<TreeSeries Type="Prd" Name="test STD">
<Tree>
<Root IsExcluded="false" Name="test STD B" Revision="5"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD" Revision="TC"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD" Revision="10"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD MTC" Revision="5"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD" Revision="1"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD" Revision="2"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD MTC" Revision="6"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD A" Revision="1"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD A" Revision="3"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD MTC" Revision="1"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD B" Revision="2"/>
</Tree>
<Tree>
<Root IsExcluded="false" Name="test STD C" Revision="1"/>
</Tree>
</TreeSeries>
</Context>
</Expression>
</Exp>
here should be the result :
"test STD MTC" should appear first in revision order
then other "test STD xx" in alphabetical order for name and ascendant order for revision
then "test STD" order by revision knowing that "TC" need to be display always after revision 2.
test STD MTC - 1
test STD MTC - 5
test STD MTC - 6
test STD A - 1
test STD A - 3
test STD B - 2
test STD B - 5
test STD C - 1
test STD - 1
test STD - 2
test STD - TC
test STD - 10
I try to use xsl:sort but I have too many criteria to order this XML so I think I have to create multiple list to order them as I want but I don't know how to do it.
if someone has an idea ?
Thanks