[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Merge Similar data nodes using XSL
Hi All, I have posted this after a bit of research and being new to XSLT. There were similar clarifications in the past(FAQ) that helped me to move however I would appreciate if any one can suggest me if I am heading in the right direction. 1. Here is the XML sampple <Contribution> <AccountID>100</AccountID> <AccountIDPub>173</AccountIDPub> <EmployeeSurname>XXXX</EmployeeSurname> <EmployeeFirstName>Sharon</EmployeeFirstName> <EmployeeDOB>07/12/1955</EmployeeDOB> <DateLastPaidTo>02/01/2009</DateLastPaidTo> <ContributionType>Comp Emp</ContributionType> <ContributionAmount>400.0</ContributionAmount> </Contribution> <Contribution> <AccountID>100</AccountID> <AccountIDPub>173</AccountIDPub> <EmployeeSurname>XXXX</EmployeeSurname> <EmployeeFirstName>Sharon</EmployeeFirstName> <EmployeeDOB>07/12/1955</EmployeeDOB> <DateLastPaidTo>02/01/2009</DateLastPaidTo> <ContributionType>Personal</ContributionType> <ContributionAmount>200.0</ContributionAmount> </Contribution> 2. Key is <AccountIDPub> in the above nodes 3. The <ContributionType> can have 5 variations value(1,2,3,4,5) The XML shows only 2 <ContributionType> it can have uptil 5. The other I set them 0 for display (please see below) The XSL I have written at the moment displays this as follows AcNo. Name DOB Comp Emp Volu Salary Personal Spouse Total ------------------------------------------------------------------------ 173 Sharon 07/12/1955 400.0 0 0 0 0 400.0 173 Sharon 07/12/1955 0 0 0 200.0 0 200.0 What would be the ideal way to get an output in a single row? (Including adding the total) AcNo. Name DOB Comp Emp Volu Salary Personal Spouse Total ------------------------------------------------------------------------- 173 Sharon 07/12/1962 400.0 0 0 200.0 0 600.0 1. Should this be merged into a single XML first and then displayed in a loop I guess I might need to do this in 2 passes...? I understand that I can use a key (AcNo) and iterate, wasn't sure if there were cleaner approach. Any pointers appreciated.... Regards Sunder Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out more
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|