I am new to Stack Overflow and to XSLT. I have a problem with removing duplicate entries from the output, based on some child element conditions.
Here is an example of XML that I have:
<partyorders>
<order>
<day>12</day>
<month>05</month>
<year>2000</year>
<amount>5000.00</amount>
<decision>pending</decision>
</order>
<order>
<day>19</day>
<month>04</month>
<year>2000</year>
<amount>2000.00</amount>
<decision>pending</decision>
</order>
<order>
<day>19</day>
<month>04</month>
<year>2000</year>
<amount>2000.00</amount>
<decision>reserved</decision>
</order>
<order>
<day>05</day>
<month>04</month>
<year>2000</year>
<amount>1000.00</amount>
<decision>pending</decision>
</order>
<order>
<day>05</day>
<month>04</month>
<year>2000</year>
<amount>1000.00</amount>
<decision>reserved</decision>
</order>
<order>
....
</order>
</partyorders>
....
represents more orders of same as above
I need to get the output as:
- only one order with pending/approved status.
- if there are two orders with only different in status, i want to display reserved order only after confirming by comparing elements
<day>
,<month>
,<year>
,<amount>
I want the following output based on <day>
, <month>
, <year>
, <amount>
and <decision>
tags:
<restrntpartyorders>
<restrntorder>
<partyday>12</partyday>
<partymonth>05</partymonth>
<partyyear>2000</partyyear>
<partyamount>5000.00</partyamount>
<partydecision>pending</partydecision>
</restrntorder>
<restrntorder>
<partyday>19</partyday>
<partymonth>04</partymonth>
<partyyear>2000</partyyear>
<partyamount>2000.00</partyamount>
<partydecision>reserved</partydecision>
</restrntorder>
<restrntorder>
<partyday>05</partyday>
<partymonth>04</partymonth>
<partyyear>2000</partyyear>
<partyamount>1000.00</partyamount>
<partydecision>reserved</partydecision>
</restrntorder>
<restrntorder>
....
</restrntorder>
</restrntpartyorders>
Can someone help me out in getting the solution using XSLT 1.0?