Page 1 of 1

Urgent help required

Posted: Sat May 05, 2007 11:44 pm
by chakravarthi_oruganti
I am very beginner to xsl.

I am struggling in solving the below problem.
This is very simple but I could not solve because I don't know anything in xsl.

Mine is a computer manufacturing company.

We have a Product hierarchy.

<PRODUCT>
<product_id>ALL-PRODUCTS</product_id>
<PRODUCT>
<product_id>LAPTOPS</product_id>
<parent_id>ALL PRODUCTS</parent_id>
<PRODUCT>
<product_id>LATITUDE</product_id>
<parent_id>LAPTOPS</parent_id>
</PRODUCT>

<PRODUCT>
<product_id>INSPIRON</product_id>
<parent_id>LAPTOPS</parent_id>
<PRODUCT>
........

In the same way, We have a Product hierarchy also.


<REGION>
<region_id>ALL-REGIONS</region_id>
<REGION>
<region_id>ASIA-PACIFIC</region_id>
<parent_id>ALL REGIONS</parent_id>
<REGION>
<region_id>INDIA</region_id>
<parent_id>ASIA-PACIFIC</parent_id>
</REGION>

<REGION>
<region_id>CHINA</region_id>
<parent_id>ASIA-PACIFIC</parent_id>
<CHANNELS>
........

We usually do sales forecast at any combination of product, region in any level.
The below table shows the forecasted sales.

PRODUCT REGION SALES_D1 SALES_D2 SALES_D3 SALES_D4 SALES_D5 SALES_D6 SALES_D7
________________________________________________________________________________________________________________________________
LATITUDE INDIA 30 40 60 12 56 12 60
LATITUDE CHINA 10 30 20 40 80 12 56
INSPIRON INDIA 10 30 20 40 80 12 56
INSPIRON CHINA 30 40 60 12 56 12 60

I have another table which says for which region-product combination we need to calculate forcast.

PRODUCT REGION SALES_D1 SALES_D2 SALES_D3 SALES_D4 SALES_D5 SALES_D6 SALES_D7
________________________________________________________________________________________________________________________________
LAPTOPS ALL-REGIONS
ALL-PRODUCTS ASIA-PACIFIC

I need to do rollup of the sales till the given product region combination.

For the record 1, I need to sum up the forecasted values of all the products coming under LAPTOPS for all the regions coming under ALL-REGIONS.
For the record 1, I need to sum up the forecasted values of all the products coming under ALL-PRODUCTS for all the regions coming under ASIA-PACIFIC.

The result will be

PRODUCT REGION SALES_D1 SALES_D2 SALES_D3 SALES_D4 SALES_D5 SALES_D6 SALES_D7
_________________________________________________________________________________________________________________________________________
LAPTOPS INDIA 40 70 80 52 136 24 116
ALL-PRODUCTS ALL_REGIONS 80 140 160 104 272 48 232


Please solve my problem.
Thanks in advance