私は次のアイテムのリストを持っています。
<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>
上記が Type1(x1)、Type2(x2)、Type3(x4) のグループで表示されるように、必要な XSLT を理解するのに問題があります。ここで、カウントは括弧内の数字以下です。言い換えると、目標は繰り返しパターンを作成することです: Type1 の次のアイテムが残っている場合は、次に Type2 の次の 2 つ以下のアイテムが残っている場合は 2 つ未満であり、次に Type3 の次の 4 つ以下のアイテムが少ない場合はそれ以下です。 4つ以上残っています。
したがって、目的の出力は次のようになります。
<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>
上記の出力から、順序が変更されていることがわかります。つまり、<=1 の Type 1 があり、その後に <=2 の Type2 が続き、その後に <=4 の Type3 が続き、このパターンが繰り返されます。項目を説明したパターンにグループ化し、項目が使い果たされた場合は完全なリストになるまで繰り返す必要があると思います。私が理にかなっていることを願っています。
誰でも必要な XSLT またはいくつかのポインターを提供できますか?
ありがとう、ジョン。