I have the following list of items.
<items>
<item type="Type1">Item1</item>
<item type="Type2">Item2<item>
<item type="Type2">Item3<item>
<item type="Type3">Item4<item>
<item type="Type3">Item5<item>
<item type="Type1">Item6<item>
<item type="Type3">Item7<item>
<item type="Type1">Item8<item>
<item type="Type2">Item9<item>
<item type="Type1">Item10<item>
<items>
I'm having trouble figuring out the XSLT required so that the above are displayed in groups of Type1(x1), Type2(x2), Type3(x4), where the counts are the number in parenthesis or less. In other words, the goal is to create a repeating pattern: the next item of Type1 if any of those remain, then the next two items of Type2 or fewer if less than two remain, then the next four items of Type3 or fewer if less than four remain.
So the desired output would look something like the below:
<div class="Items">
<div class="Type1">Item1</div>
<div class="Type2">Item2</div>
<div class="Type2">Item3</div>
<div class="Type3">Item4</div>
<div class="Type3">Item5</div>
<div class="Type3">Item7</div>
<div class="Type1">Item6</div>
<div class="Type2">Item9</div>
<div class="Type1">Item8</div>
<div class="Type1">Item10</div>
</div>
From the above output, you can see that the ordering has changed. i.e. there is <=1 Type 1, followed by <=2 Type2, followed by <=4 Type3, and this pattern repeats itself. I suppose the items will need to be grouped into the pattern described and repeat itself until the full list if items are exhausted. I hope I make sense.
Can anyone provide the required XSLT or some pointers please?
Thanks, John.