Subject: Re: [xsl] Identity Transform Grouping Question From: Anton Triest <anton@xxxxxxxx> Date: Fri, 22 Oct 2004 00:55:08 +0200 |
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:That's correct.
<xsl:key name="offices" match="office" use="concat(ancestor::country/@name,'-',cities/city,'-',names/name[@lang='en'])"/>
and changing the city and office templates as follows: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")
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]">
<xsl:sort select="names/name[@lang='en']"/>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.
office:
<xsl:apply-templates select="key('offices',concat(ancestor::country/@name,'-',
cities/city=current(),'-',names/name[@lang='en']))" mode="location"/>
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Identity Transform Groupi, ethan.kalfus | Thread | Re: [xsl] Identity Transform Groupi, ethan.kalfus |
[xsl] String length question, Márcio Ferreira | Date | Re: [xsl] String length question, Anton Triest |
Month |