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

More Problems/Confusion Grouping with Meunchian Method

Subject: More Problems/Confusion Grouping with Meunchian Method
From: "Magick, Brian" <Brian.Magick@xxxxxxxxxx>
Date: Mon, 10 Dec 2001 21:06:45 -0600
xsl meunchian group
Hi:

I'm resorting to a post on this board as a last result of literally days
of work trying to properly group a set of data with the Meunchian method
with improper results.  Hopefully my mistake is minor and someone can
quickly point me in the right direction.  I'm sure others on this list
can attest that grouping with XSLT can be a nightmare!!!  Hopefully the
next revision of XSL brings some improvements.

My XML:  basically a list of products where each product can belong to
multiple technology areas.

<PRODUCTS>
   <PRODUCT>
      <NAME>WINDOWS XP</NAME>
	<TECHNOLOGY domain="1" bookmark="xp">Desktop Operating
System</TECHNOLOGY>
	<TECHNOLOGY domain="2" bookmark="xp">Workstation OS</TECHNOLOGY>
   </PRODUCT>
   <PRODUCT>
	<NAME>Outlook</NAME>
	<TECHNOLOGY domain="2" bookmark="outlook">Desktop Email
Client</TECHNOLOGY>
   </PRODUCT>
   <PRODUCT>
	<NAME>Power Designer</NAME>
	<TECHNOLOGY domain="1" bookmark="pd">Repository Tool<TECHNOLOGY>
	<TECHNOLOGY domain="2" bookmark="pd">CASE Tools</TECHNOLOGY>
   </PRODUCT>
   <PRODUCT>
	<NAME>ERWIN</NAME>
	<TECHNOLOGY domain="2" bookmark="erwin">CASE Tools</TECHNOLOGY>
	<TECHNOLOGY domain="1" bookmark="erwin">Repository
Tool<TECHNOLOGY>
   </PRODUCT>

The list:

I want a list of each product by Technology.  Some products will need to
be displayed twice in different technology categories.  Rather than
using an "apply-templates" call that most examples of the Meunchian
Method use, I want to use a for-each loop to group each technology and
then list all of the product names that directly apply to that
technology for a given domain.

Ex:  Domain 1

Desktop Email Client
   Outlook
Desktop Operating System
   Windows XP
Repository Tool
   Power Designer

The problem:  When I create the list the filter doesn't work right
because if a product exists for a technology in Domain = 1, and also
exists in another technology Domain 1 has in its list (even if not for
Domain = 1), the product lists for each technology.  For example, ERWIN
has Domain = 1 with a technology of CASE Tool.  It also has a Domain = 2
Repository Tool.  We are not interested in this second case if we filter
by Domain = 1....BUT  Power Designer exists in Domain = 1 under
Repository Tool.  When we render the Domain = 1 Power Designer
Repository Tool listing it also renders the Repository Tool entry for
ERWIN although its Repository Tool entry ONLY applies to Domain 2.
Crystal clear, right?

My stylesheet components:

<xsl:key name="gt" match="GOVERNING_TECHNOLOGY" use="."/>
<xsl:key name="prod4gt" match="PRODUCT" use="GOVERNING_TECHNOLOGY"/>

I use the first key "gt" to match get the list of Technology items and
then list the products referencing the 2nd key:

<xsl:for-each
select="PRODUCTS/PRODUCT/GOVERNING_TECHNOLOGY[generate-id(.) =
                                            generate-id(key('gt', .)
[@domain = '1'])]">
<br/><xsl:value-of select="."/>
<xsl:for-each select="key('prod4gt',.)">
<br/><xsl:value-of select="NAME"/>
</xsl:for-each>
</xsl:for-each>

I can't recall how many variations of calling the 2nd key I've tried but
I think I need to filter the 2nd key by the Domain = 1 so that I only
get the results for the right domain.  Not quite sure if this is the
case and I've been unsuccessful trying to do this.

Any pointers are appreciated before I go crazy trying to figure this
out!!!  Thanks.


Brian Magick



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.