2015-01-16 88 views
0

騾ESB的DataMapper的聚合:字段有條件的字段類型的聚合騾ESB DataMapper的:字段有條件的字段類型

我具有以下結構:

晶格結構答:

<itemlist> 
    <item> 
    <id>123</id> 
    <price>1</price> 
    <quantity>1</quantity> 
    <type>AAA</type> 
    </item> 
    <item> 
    <id>124</id> 
    <price>2</price> 
    <quantity>1</quantity> 
    <type>BBB</type> 
    </item> 
    <item> 
    <id>125</id> 
    <price>3</price> 
    <quantity>1</quantity> 
    <type>BBB</type> 
    </item> 
<itemlist> 

結構B:

<totals> 
    <total> 
    <totalPrice>3</totalPrice> 
    </total> 
</totals> 

如果我想對所有字段進行sumation,但是onl對於具有「BBB」的結構,y 。

我可以在Mule ESB中做到這一點,如果是的話,我會怎麼做?

感謝

回答

2

使用規則,就像在你前面的問題描述,但使用以下XPath:sum(//price[../type='BBB'])