Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Help with strategy for a peculiar muenchian grouping problem

From: mike.renwick@--.-----------------.---
To: NULL
Date: 6/1/2006 5:36:00 AM

Hi all,

I've got a bit of a head scratcher here.

Basically I've got an XML file with items in it like so

<item>
  <name>Valuable1_a</name>
  <amount>10</amount>
</item>
<item>
  <name>Valuable1_b</name>
  <amount>10</amount>
</item>
<item>
  <name>Valuable2</name>
  <amount>10</amount>
</item>
<item>
  <name>Valuable2_a</name>
  <amount>10</amount>
</item>

And I'm trying to roll up the amounts to leave me with
Valuable1 20
Valuable2 20

Basically I'd need to do a "group by" on unique names (excluding any
suffixes if there are any).

I've tried various ways
-Creating a temp tree and setting up a muenchian group on that
  -can't seem to do this in MSXML

-Setting up to groups, one for items with second last character "_",
one for everything else

<xsl:key name="ikey1"
match="item[substring(name,string-length(name)-1,1)='_']"
use="substring(name,1,string-length(name)-2)"/>

<xsl:variable name = "unq"
select="item[generate-id(.)=generate-id(key('ikey1',substring(name,1,string-length(name)-2)))]/name\"/>\n"

and then the same but this time where the second last character != "_"

But it creates duplicates.
I can't work out how to do this given
-You can't create a muenchian group on a calculated bit of xml
-You can't seem to do a conditional i.e. (condition) ? (if true) : (if
false) type statement in the key setup
-I don't know how to combine two unique lists to create a single unique
list if there are possibly things in common between them?

Thoughts on a strategy anyone?

-Most confused Mike.



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent