ドキュメント全体ではなく、ノード内でグループ化する Muenchian Grouping を見てきましたが、うまくいきません。Muenchian の方法だけでは、私にとってもそれはできません。
XSLT 1.0: grouping and remove duplicateも見ましたが、完全にはフォローできません。
次の XML があります。
<?xml version="1.0" encoding="UTF-8"?>
<MT_MATERIALDATA>
<items item="475053">
<Recordset>
<CodeBusinessUnit>99</CodeBusinessUnit>
<PriceValue>250</PriceValue>
</Recordset>
<Recordset>
<CodeBusinessUnit>1</CodeBusinessUnit>
<PriceValue>250</PriceValue>
</Recordset>
</items>
<items item="475054">
<Recordset>
<CodeBusinessUnit>1</CodeBusinessUnit>
<PriceValue>255.34</PriceValue>
</Recordset>
<Recordset>
<CodeBusinessUnit>10</CodeBusinessUnit>
<PriceValue>299</PriceValue>
</Recordset>
</items>
</MT_MATERIALDATA>
結果は次のようになります。
<?xml version="1.0" encoding="UTF-8"?>
<MT_MATERIALDATA>
<Mi item="475053">
<PriceList>
<Prices>
<Price Value="250"/>
<PriceConfig>
<Stores>99,1</Stores>
</PriceConfig>
</Prices>
</PriceList>
</Mi>
<Mi item="475054">
<PriceList>
<Prices>
<Price Value="255.34"/>
<PriceConfig>
<Stores>1</Stores>
</PriceConfig>
</Prices>
<Prices>
<Price Value="299"/>
<PriceConfig>
<Stores>10</Stores>
</PriceConfig>
</Prices>
</PriceList>
</Mi>
</MT_MATERIALDATA>
したがって、 の<PriceValue>
要素を一致させるには<Recordset>
、それぞれのすべて<CodeBusinessUnits>
を にリストする必要があります<Stores>
。そうでない場合は、追加の<Prices>
ノードを作成する必要があります。
何時間も試してみましたが、店舗番号が常に重複しているか、PriceValue が同じであっても集計されません。