[xsl] Recursive Search, finding duplicates + merge them

Subject: [xsl] Recursive Search, finding duplicates + merge them
From: wulfhtmlteam@xxxxxx
Date: Mon, 17 Nov 2003 21:11:28 +0100
Hi,

I have a problem designing my xsl stylesheet.
My xml file looks like this:

<root>
  <science id="cavepainting"/>

  <science id="mysticism">
    <depended on="cavepainting" minimumlevel="1"/>
  </science>

  <science id="earthelemental">
    <depended on="mysticism" minimumlevel="2"/>
    <depended on="cavepainting" minimumlevel="2"/>
  </science>

  <defense id="wallofearth">
    <depended on="earthelemental" minimumlevel="3"/>
  </defense>
</root>

As you can see to have a wallofearth, you will first need an earthelemental of level 3 which depends on mysticism level2 and so on....

Now the problem is to get ALL the dependencies for the earth wall out of the xsl.
Unfortunately you will get something like this using my current recursive traversal xsl:

wallofearth depends on:
  earthelemental >= 3
    mysticism >= 2
      cavepainting >= 1
    cavepainting >= 2

As you can see there are 2 cavepainting dependency, but I only need the greater one.. 
This would not be a problem which could not be solved by hand,
if I only had those four objects of class science and external.
Instead I got hundreds of them.


So what is it, what I want? It would be really great, if I could _write_ in my xml :

  <defense id="wallofearth">
    <depended on="earthelemental" minimumlevel="3"/>
  </defense>

and my findAllDependencies.xsl would translate to:

  <defense id="wallofearth">
    <depended on="mysticism" minimumlevel="2"/>
    <depended on="cavepainting" minimumlevel="2"/>
    <depended on="earthelemental" minimumlevel="3"/>
  </defense>

of course without duplicates and using the maximum value for the minimumlevel attribute.

Thanks for helping..
______________________________________________________________________________
WEB.DE FreeMail wird 5 Jahre jung! Feiern Sie mit uns und
nutzen Sie die neuen Funktionen http://f.web.de/features/?mc=021130


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


Current Thread