I have got this XML document. Is there way how to sort the nodes by ascending time and by brand and then count how many cars (samples), true and false was in this time from start time (always the lowest time in the group)?
<?xml version="1.0" encoding="UTF-8"?>
<trade>
<car time="1950" brand="audi" trend="true">
</car>
<car time="1200" brand="renault" trend="true">
</car>
<car time="1000" brand="audi" trend="true">
</car>
<car time="2800" brand="renault" trend="true">
</car>
<car time="2000" brand="audi" trend="true">
</car>
<car time="1500" brand="renault" trend="true">
</car>
<car time="1900" brand="audi" trend="false">
</car>
<car time="2300" brand="audi" trend="false">
</car>
<car time="2100" brand="renault" trend="false">
</car>
</trade>
Wanted result in HTML
Consider to include what you have got next time in the question text. If you already know how to group and how to sort you can then easily process the sorted sequence and take the subsequence until each item and check the count of the items with a certain trend as follows:
https://xsltfiddle.liberty-development.net/nc4NzQ1