tags:

views:

65

answers:

1

Hi, I've implemented this in a recursive fashon but as most xml editors seem to run out of stack space I thought there should be a more efficient solution out there.

I've looked at Jenni Tenison's set difference template: http://www.exslt.org/set/functions/difference/set.difference.template.xsl

but need something slightly different. I need node equality to be defined as concat(node(.),@name).

There is a predefined set of nodes:

<a name="Adam"><!-- don't care about contents for equality purposes --></a>
<b name="Berty"><!-- don't care about contents for equality purposes --></b>
<a name="Charly"><!-- don't care about contents for equality purposes --></a>

I want to find out the subset of the below nodes that are not in the above list:

<b name="Berty"><!-- different contents --></b>
<b name="Boris"><!-- different contents --></b>

The result I'm after would be a node set of:

<b name="Boris"><!-- different contents --></b>

To complicate things I can't use Key as the nodes are in different documents (overriding imported definitions are the reason I'm trying to process this). Also this needs to be XSLT 1.0 as I need to render in IE / Firefox.

Any thoughts / suggestions / guidence wellcome!

A: 

Have you taken a look at the technique in the XSLT Cookbook?

http://books.google.com/books?id=POJkiuHIAfoC&amp;lpg=PP1&amp;pg=PA324#v=onepage&amp;q=&amp;f=false

Mr. Mangano has a recipe for set difference, and a fairly well written explanation as well. Mind you, when you are comparing two elements that seem to be the same but have two different source documents, XSLT will usually report them as different, so you must test by the value of the element, attributes, etc.

You might want to poke at the example code from the book, provided here: http://oreilly.com/catalog/9780596009748

Eddie Welker
Thanks, I've had a look at that and the value-equality is recursive which is effectivly what I'm doing already. I was wondering if there was a way to do value-equality more efficiently.
Squirrel
Not that I'm aware of. To be brutally honest, I had to take the XSLT out, and put it in a c++ backend for efficiency.
Eddie Welker