There are multiple factories in inventory. We need to compute & transform data by factory, Product and Price Change.
Let say Product Code ‘5’ have the price change from 1.00 to 1.10.so we need sum the quantity of Price 1.0 as a one row and sum of quantity of price 1.10.
In above example Product code 5 and Price 1.0 contains two rows (i.e. Quantity 30+quantity 10).Total Qty is 40 for product code 5 in Factory 1000
Similarly Product code 5 and Price 1.10 contains 2 rows (i.e. Quantity 10+quantity 10). Total Qty is 20 for product code 5 in Factory 1000.
Last Transaction of each Product code/site TransdateTime to be change like Date ddmmyyyy
And Time ‘235959’
We want to implement below requirement using custom xslt.Can you please help how to do using XSLT
Sample Input XML Structure
<Factory> <!—Repeated Factory Details>
<FactoryID>100</FactoryID>
<Transaction>
<ProductCode>5</ProductCode>
<Quantity>30.000</Quantity>
<UnitPrice>1.000</UnitPrice>
<Amount>30.00</Amount>
<DateTime>2016-08-10T14:38:38</DateTime>
</Transaction>
<Transaction>
<ProductCode>29</ProductCode>
<Quantity>990.000</Quantity>
<UnitPrice>1.211</UnitPrice>
<Amount>1198.89</Amount>
<DateTime>2016-08-10T15:38:38</DateTime>
</Transaction>
<Factory>
FactoryID | ProductCode | Quantity | UnitPrice | Amount | TransDateTime |
00140201 | 5 | 30.000 | 1.000 | 30.000 | 2016-08-10T14:38:38 |
00140201 | 29 | 990.000 | 1.211 | 1198.890 | 2016-08-10T14:51:22 |
00140201 | 5 | 30.000 | 1.000 | 30.000 | 2016-08-10T15:38:38 |
00140201 | 29 | 30.000 | 1.211 | 36.330 | 2016-08-10T15:51:22 |
00140201 | 5 | 10.000 | 1.050 | 10.500 | 2016-08-10T15:51:22 |
00140201 | 5 | 10.000 | 1.120 | 11.200 | 2016-08-10T16:38:38 |
00140201 | 5 | 20.000 | 1.120 | 22.400 | 2016-08-10T18:38:38 |
00140201 | 29 | 30.000 | 1.150 | 34.500 | 2016-08-10T19:51:22 |
00335001 | 3 | 75.000 | 1.119 | 83.925 | 2016-08-10T14:38:38 |
00335001 | 5 | 75.000 | 1.300 | 97.500 | 2016-08-10T15:38:38 |
00335001 | 3 | 75.000 | 1.119 | 83.925 | 2016-08-10T15:38:39 |
00335001 | 5 | 10.000 | 1.300 | 13.000 | 2016-08-10T15:50:38 |
00335001 | 5 | 10.000 | 1.100 | 11.000 | 2016-08-10T16:05:38 |
Expected Output data:
Record Tag | FactoryID | Item ID | ddmmyyyy - Date | Time(hhmmss) | volume Usage | Price Break |
R | 00140201 | 5 | 10082016 | 153838 | 60.000 | 1.000 |
R | 00140201 | 5 | 10082016 | 155122 | 10.000 | 1.050 |
R | 00140201 | 5 | 10082016 | 235959 | 30.000 | 1.120 |
R | 00140201 | 29 | 10082016 | 155122 | 1020.000 | 1.211 |
R | 00140201 | 29 | 10082016 | 235959 | 30.000 | 1.150 |
R | 00335001 | 3 | 10082016 | 235959 | 150.000 | 1.119 |
R | 00335001 | 5 | 10082016 | 155038 | 85.000 | 1.300 |
R | 00335001 | 5 | 10082016 | 235959 | 10.000 | 1.100 |