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