Subject: [xsl] XSL Trnasfromation - Is it possible to do a bottom up transformation? From: "Raghu Narayan Koratagere" <raghu.k.n@xxxxxxxxx> Date: Mon, 19 Nov 2007 12:42:29 +0530 |
Note: The below question was earlier posted under the subject "XSL support of Bottom up transformations? ", reposting with more details as I had only digest subscription earlier and could not reply to the digest. Requirement in Abstract: A recursive product tree is to be tansformed. The product at the top level element whose value is a derived value which is based similarly caluclated element value. Hence the issue of bottom nodes need to be calculated before the top nodes. The source XML document is an Order Detail tree (Contains details of 1 order). There can be multiple Order line and each line represent an Product. The Item line itself is recursive in the sense that one product can be made up of multiple lines. Each line is defined as below: ===================== <orderline> <linenum>1</linenum> <productName>15' Monitor</productName> <netPrice>100</netPrice> <itemTypeCode>1</itemTypeCode> <untiPrice> To be caluclated </unitPrice> <orderline></orderline> <orderline></orderline> <orderline></orderline> <orderline></orderline> <orderline></orderline> </orderline> I need to calculate a new element called unitPrice based on the below logic: 1. If the itemTypeCode of the current Item is '1' then unitPrice is netPrice 2. If the itemTypeCode of the current Item is '2' then unitPrice is sum of all the (unitPrice/quantity) of all the child lines 3. If the itemTypeCode of the current Item is '3' then unitPrice is Sum of unitPrice of only the first level child elements The above defn should be applied at all levels where unitPrice is calculated. And this is where I say I need to calculate the bottom value first and then arrive at parent's value. These transformations are required along with other simple transformations on other attributes. Pls. let me know what is he best way out here. Thanks, Raghu
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Newbie problem: namespace, Robert Carter | Thread | Re: [xsl] XSL Trnasfromation - Is i, Abel Braaksma |
Re: [xsl] How Remove or Hide Blank , Florent Georges | Date | Re: [xsl] XSL Trnasfromation - Is i, Abel Braaksma |
Month |