Subject: Re: [xsl] XSL Grouping From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Mon, 12 Nov 2001 17:56:22 +0000 |
Hi David, > This is one transaction. First we group by Status, no prob. Now I > want to group by CurrencyCode within each Status group. I'm just not > seeming to get the right combo of xsl:key and key() XPath in the sub > for-each. Can someone lend a hand? Tx :) Sure. The key that you use for the second level group has to index each Transaction by a combination of its Status and its CurrencyCode. The easiest way to get such a combination value is using the concat() function, so try: <xsl:key name="TransactionsByStatusAndCurrencyCode" match="Transaction" use="concat(Status, '::', CurrencyCode)" /> [Obviously you don't have to use such a long name, I'm just doing so to make things clear.] At the point where currently you're retrieving all the Transaction elements with a particular status, you need to filter that set to include only those that have that Status *and* have a unique CurrencyCode, with something like: key('TransactionsByStatus', $status) [generate-id() = generate-id(key('TransactionsByStatusAndCurrencyCode', concat($status, '::', CurrencyCode))[1])] And once you're processing such a Transaction, you can get all the other Transaction elements with the same Status and CurrencyCode with: key('TransactionsByStatusAndCurrencyCode' concat(Status, '::', CurrencyCode)) I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSL Grouping, David B. Bitton | Thread | Re: [xsl] XSL Grouping, David B. Bitton |
Re: [xsl] namespace aware java-xpat, Jeni Tennison | Date | [xsl] msxml3.dll load crash, siyer |
Month |