Subject: [xsl] Sort, group, flatten, consecutive data From: "Midnit" <midnit@xxxxxxxxxxxxxxxxx> Date: Tue, 28 Jun 2005 17:01:18 -0400 |
This is my first post here; I apologize if it's inappropriate. I'm attempting to flatten and consolidate this XML document. In short I would sort by DETAIL_ID and PRODUCTIONDAY, then group up based on the RATE, outputting BEGINDAY and ENDDAY to represent the date range the RATE covered. Though not shown in this example of data, there will be a record for every day in the month so sorting by PRODUCTIONDAY will always produce consecutive rows. I have no problem flattening the data but the attempts I've made at grouping the data have failed miserably. All the examples I have found use preceding-sibling and following-sibling which doesn't apply for my data, at least that's my assumption. I have also tried using keys but I have run into similar problems. I am using XSLT 1.0. Any suggestions would be greatly appreciated. What is the equiv of following-sibling for my DETAIL_ID's? <?xml version='1.0'?> <BUSINESSASSOCIATE> <ID>116</ID> <SUPPLYCONTRACTS> <CONTRACT number='555'> <ID>351</ID> <DAYS> <DATE> <DAY>3/5/2004</DAY> <VERSIONS> <VERSION> <DETAILS> <DETAIL> <DETAIL_ID>570</DETAIL_ID> <PRODUCTIONDAY>5</PRODUCTIONDAY> <PRODUCTIONDATE>3/5/2004</PRODUCTIONDATE> <RESERVATION> <RATE>0.01</RATE> </RESERVATION> </DETAIL> </DETAILS> </VERSION> </VERSIONS> </DATE> <DATE> <DAY>3/4/2004</DAY> <VERSIONS> <VERSION> <DETAILS> <DETAIL> <DETAIL_ID>570</DETAIL_ID> <PRODUCTIONDAY>4</PRODUCTIONDAY> <PRODUCTIONDATE>3/4/2004</PRODUCTIONDATE> <RESERVATION> <RATE>0.01</RATE> </RESERVATION> </DETAIL> </DETAILS> </VERSION> </VERSIONS> </DATE> <DATE> <DAY>3/3/2004</DAY> <VERSIONS> <VERSION> <DETAILS> <DETAIL> <DETAIL_ID>570</DETAIL_ID> <PRODUCTIONDAY>3</PRODUCTIONDAY> <PRODUCTIONDATE>3/3/2004</PRODUCTIONDATE> <RESERVATION> <RATE>0.01</RATE> </RESERVATION> </DETAIL> </DETAILS> </VERSION> </VERSIONS> </DATE> <DATE> <DAY>3/2/2004</DAY> <VERSIONS> <VERSION> <DETAILS> <DETAIL> <DETAIL_ID>570</DETAIL_ID> <PRODUCTIONDAY>2</PRODUCTIONDAY> <PRODUCTIONDATE>3/2/2004</PRODUCTIONDATE> <RESERVATION> <RATE>0.02</RATE> </RESERVATION> </DETAIL> </DETAILS> </VERSION> </VERSIONS> </DATE> <DATE> <DAY>3/1/2004</DAY> <VERSIONS> <VERSION> <DETAILS> <DETAIL> <DETAIL_ID>570</DETAIL_ID> <PRODUCTIONDAY>1</PRODUCTIONDAY> <PRODUCTIONDATE>3/1/2004</PRODUCTIONDATE> <RESERVATION> <RATE>0.02</RATE> </RESERVATION> </DETAIL> </DETAILS> </VERSION> </VERSIONS> </DATE> </DAYS> </CONTRACT> </SUPPLYCONTRACTS> </BUSINESSASSOCIATE> Rough example of output: <ROWS> <ROW CONTRACT_ID="351" CONTRACT_NUMBER="555" DETAIL_ID="570" BEGINDAY="3/1/2004" ENDDAY="3/2/2004" RATE="0.02"/> <ROW CONTRACT_ID="351" CONTRACT_NUMBER="555" DETAIL_ID="570" BEGINDAY="3/3/2004" ENDDAY="3/5/2004" RATE="0.01"/> </ROWS> -Robert
Current Thread |
---|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Multiple file XSL convers, tomas.vanek | Thread | Re: [xsl] Sort, group, flatten, con, JBryant |
Re: [xsl] Multiple file XSL convers, JBryant | Date | Re: [xsl] Sort, group, flatten, con, JBryant |
Month |