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

Conditional Grouping Problem

Subject: Conditional Grouping Problem
From: Jonathan Kart <jkart@xxxxxxxxxxxx>
Date: Tue, 25 May 2004 19:52:14 -0700
conditional grouping
Hi all,

I have an interesting grouping issue. I have xml like:

<product>
	<buyer>John Q. Public</buyer>
	<name>Our Best Widget</name>
</product>
<product>
	<buyer>John Dow</buyer>
	<name>Our Best Widget</name>
</product>
<product>
	<buyer>John Q. Public</buyer>
	<name>Our Worst Widget</name>
</product>
<product>
	<buyer>Jane Doe</buyer>
	<name>Our Best Widget</name>
</product>
<product>
	<buyer>Jill Doe</buyer>
	<name>Our Worst Widget</name>
</product>


I am trying to to group in 2 sections. section 1: by product name section 2: by product buyer

Here's the rub, section 1 is for all buyers who only purchased 1 product. Section 2 is for all buyers who buy multiple products. The final output should look like:
<!-- single buyers by product name -->
<name>Our Best Widget</name>
<buyer>Jane Doe</buyer>
<buyer>John Doe</buyer>
<name> Our Worst Widget</name>
<buyer>Jill Doe</buyer>


<!-- multiple buyers by buyer -->
<buyer>John Q. Public</buyer>
	<name>Our Best Widget</name>
	<name>Our Worst Widget</name>


If we focus on section 1 for now, I'm using the Muenchian Method with a key like:
<xsl:key name="product-by-name" match="Product" use="name" />
How can I modify this key to match only products which are part of a single order (the Product's buyer only bought 1 item)?
I'm stretching my xsl knowledge here..


I assume if i can figure this out i can use the same method for section 2.
Thanks for any help,
-jonathan


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.