This is the xml
<Products><Product><ProductCode>1001</ProductCode><AvailabilityStatus>Available</AvailabilityStatus><TotalPrice>15.000</TotalPrice></Product><Product><ProductCode>1001</ProductCode><AvailabilityStatus>ON-Request</AvailabilityStatus><TotalPrice>10.000</TotalPrice></Product><Product><ProductCode>1002</ProductCode><AvailabilityStatus>ON-Request</AvailabilityStatus><TotalPrice>15.000</TotalPrice></Product><Product><ProductCode>1002</ProductCode><AvailabilityStatus>ON-Request</AvailabilityStatus><TotalPrice>10.000</TotalPrice></Product><Product><ProductCode>1003</ProductCode><AvailabilityStatus>Available</AvailabilityStatus><TotalPrice>15.000</TotalPrice></Product><Product><ProductCode>1003</ProductCode><AvailabilityStatus>Available</AvailabilityStatus><TotalPrice>10.000</TotalPrice></Product></Products>
I need out put like below
<Products><Product><ProductCode>1001</ProductCode><AvailabilityStatus>Available</AvailabilityStatus><TotalPrice>15.000</TotalPrice></Product><Product><ProductCode>1002</ProductCode><AvailabilityStatus>ON-Request</AvailabilityStatus><TotalPrice>10.000</TotalPrice></Product><Product><ProductCode>1003</ProductCode><AvailabilityStatus>Available</AvailabilityStatus><TotalPrice>10.000</TotalPrice></Product></Products>
1. Take only cheap price
2. If product <AvailabilityStatus> is 'Available', take only Available otherwise On-Request
How i write this in xsl 1.0