我要像下表組織了一個結果:執行「集團通過」用SUM函數在XSLT 1.0
**Costc 1000**
Product code Quantity Total amount
SALESCOST 1 120.04
LEASINGRENT 1 59.90
**Costc 2000**
Product code Quantity Total amount
SALESCOST 1 118.94
LEASINGCOST 1 513.34
**Costc 3000**
Product code Quantity Total amount
LEASINGCOST 1 658.24
LEASINGRENT 2 100.80
和輸入文件我有這個樣子。
<?xml version="1.0" encoding="iso-8859-1"?>
<Details>
<Detail>
<LineNo>1</LineNo>
<Products>
<ProductCode>SALESCOST</ProductCode>
<ProductDescr>Sales amount asset:997000000000</ProductDescr>
<Quantity>1.00</Quantity>
</Products>
<Costc>
<Value>2000</Value>
</Costc>
<TotAmount>118.94</TotAmount>
</Detail>
<Detail>
<LineNo>2</LineNo>
<Products>
<ProductCode>LEASINGCOST</ProductCode>
<ProductDescr>Leasing cost asset:997000000003</ProductDescr>
</Products>
<Costc>
<Value>2000</Value>
</Costc>
<Quantity>1.00</Quantity>
<TotAmount>513.34</TotAmount>
</Detail>
<Detail>
<LineNo>3</LineNo>
<Products>
<ProductCode>SALESCOST</ProductCode>
<ProductDescr>Sales amount asset:997000000001</ProductDescr>
</Products>
<Costc>
<Value>1000</Value>
</Costc>
<Quantity>1.00</Quantity>
<TotAmount>120.04</TotAmount>
</Detail>
<Detail>
<LineNo>4</LineNo>
<Products>
<ProductCode>LEASINGCOST</ProductCode>
<ProductDescr>Leasing cost asset:997000000002</ProductDescr>
</Products>
<Costc>
<Value>3000</Value>
</Costc>
<Quantity>1.00</Quantity>
<TotAmount>658.24</TotAmount>
</Detail>
<Detail>
<LineNo>5</LineNo>
<Products>
<ProductCode>LEASINGRENT</ProductCode>
<ProductDescr>Leasing interest asset:997000000001</ProductDescr>
</Products>
<Costc>
<Value>3000</Value>
</Costc>
<Quantity>1.00</Quantity>
<TotAmount>48.90</TotAmount>
</Detail>
<Detail>
<LineNo>6</LineNo>
<Products>
<ProductCode>LEASINGRENT</ProductCode>
<ProductDescr>Leasing interest asset:997000000002</ProductDescr>
</Products>
<Costc>
<Value>3000</Value>
</Costc>
<Quantity>1.00</Quantity>
<TotAmount>51.90</TotAmount>
</Detail>
<Detail>
<LineNo>7</LineNo>
<Products>
<ProductCode>LEASINGRENT</ProductCode>
<ProductDescr>Leasing interest asset:997000000002</ProductDescr>
</Products>
<Costc>
<Value>1000</Value>
</Costc>
<Quantity>1.00</Quantity>
<TotAmount>59.90</TotAmount>
</Detail>
如何才能做到這一點? 它的多級組合由此也算和計數函數,對我來說太複雜了。 非常感謝
如果數量確實可以在兩個層次上,然後設置蒂姆考慮到第二級(產品內),必須調整XSLT 1.0解決方案(請參閱結果,其中2000/SALESCOST的質量爲0)。請注意,Lukasz已經在兩個層面上總結了數量。 – Maestro13 2012-02-10 06:39:27
我已經調整了我的答案以應對兩種不同級別的數量。 – 2012-02-10 07:23:18