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

Re: Identity Transform Grouping Question

Subject: Re: Identity Transform Grouping Question
From: Anton Triest <anton@xxxxxxxx>
Date: Fri, 22 Oct 2004 00:55:08 +0200
Re:  Identity Transform Grouping Question
Hi Ethan,

Unfortunately, that fixed the previous problem, but I've now noticed the opposite effect -- offices with the same name in different cities are being grouped together.

Yes, I assumed that all offices with a certain name would be located in the same city... (wrong assumption:)

I think the problem is that the "offices" key needs to include the <city> node to form the proper grouping (office within city within country). I tried changing the key as follows:
<xsl:key name="offices" match="office" use="concat(ancestor::country/@name,'-',cities/city,'-',names/name[@lang='en'])"/>


That's correct.

and changing the city and office templates as follows:
city:
<xsl:apply-templates select="ancestor::offices/office[cities/city=current() and count(.|key('offices',concat(ancestor::country/@name,'-',cities/city=current(),
'-',names/name[@lang='en']))[1])=1]">


That's not: in the third argument for concat, you pass "cities/city=current()" which produces a boolean value true() or false(). (I think this will put a "1" or "0" in the key string like "England-1-Branch 4")

<xsl:sort select="names/name[@lang='en']"/>

office:
<xsl:apply-templates select="key('offices',concat(ancestor::country/@name,'-',
cities/city=current(),'-',names/name[@lang='en']))" mode="location"/>


Idem: in both cases, you'll want to remove "=current()". That should give the correct grouping, and bring back the <address> and <phone> nodes as well.

Good luck,
Anton


These changes seemed to fix my above problem, except that the result tree is missing all of the <address> and <phone> nodes. I'm not sure how my changes affected this.

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.