Subject: [xsl] Grouping the same set by multiple criteria From: Erika Marlow <EMarlow@xxxxxxxxxxxxxx> Date: Wed, 28 May 2003 09:49:04 -0500 |
Hello. I'm trying to group a set of transactions by date then site then payer. Then I have to count how many are in each group, i.e., how many total transactions by date, how many in a date group are from a specific site, and how many in a date/site group are the same payer. I have used the Muenchian technique to find the unique groups, but I am stuck on how to get the counts for the different groupings. I can find how many unique dates there are, but not how many transactions are in a given date group. Is this possible with XSL? Given xml data: <log> <transaction> <original_request> <inquiry date='20030128'> <site>0000</site> <payer>00003</payer <blah>Random bit</blah> . . . </inquiry> </original_request> </transaction> <transaction> <original_request> <inquiry date='20030528'> <site>0000</site> <payer>00003</payer <blah>Random bit</blah> . . . </inquiry> </original_request> </transaction> <transaction> <original_request> <inquiry date='20030528'> <site>2222</site> <payer>00223</payer <blah>Random bit</blah> . . . </inquiry> </original_request> </transaction> </log> I am looking for the following output: 01/2003 Site: 0000 transactions: 1 Payer: 00003 transactions: 1 Payer : 00223 transactions : 0 Total: 1 05/2003 Site: 0000 transactions: 1 Payer: 00003 transactions: 1 Payer: 00223 transactions: 0 Site: 2222 transactions: 1 Payer 00003 transactions : 0 Payer 00223 transactions : 1 Total: 2 And so on. The XSL I have so far is: <xsl:key name="datekey" match="//log/transaction/original_request/inquiry" use="substring(@date, 1, 6)" /> <xsl:key name="sitekey" match="//log/transaction/original_request/inquiry" use="site" /> <xsl:key name="payerkey" match="//log/transaction/original_request/inquiry" use="payer" /> <xsl:variable name="dateset" select="//log/transaction/original_request/inquiry[generate-id(.) = generate-id(key('datekey', .))]" /> <xsl:variable name="date_siteset" select="$dateset/site[generate-id(.) = generate-id(key('sitekey', .))]" /> <xsl:variable name="date_site_payerset" select="$date_siteset/payer[generate-id(.) = generate-id(key('payerkey', .))]" /> Where do I go from here? Thanks, Erika Marlow Web Developer Gateway EDI, Inc. 314.961.2720 | 800.969.3666 ext. 273 www.gatewayedi.com end ------------ Gateway EDI, Inc. --------------------------------------------------------------------------------------------------- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended addressee, or the person responsible for delivering it to them, you may not copy, forward, disclose or otherwise use it or any part of it in any way. To do so may be unlawful. If you receive this email by mistake, please advise the sender immediately and destroy all copies of the original message. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] merging readings with chi, James Cummings | Thread | Re: [xsl] Grouping the same set by , G. Ken Holman |
Re: [xsl] repetition, abbouh | Date | Re: [xsl] Actual Date, Alan Gardner |
Month |