[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSL Trnasfromation - Is it possible to do a bottom up

Subject: 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
 XSL Trnasfromation - Is it possible to do a bottom up
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.