Re: [xsl] XPath to find duplicate elements

Subject: Re: [xsl] XPath to find duplicate elements
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 5 Apr 2018 21:16:54 -0000
Hi Leo,

To clarify, this idea is not directly aimed at solving your particular
problem -- it is only an idea how to make processing that involves
calling deep-equal() more efficient.


Cheers,
Dimitre

On Thu, Apr 5, 2018 at 1:37 PM, Dimitre Novatchev dnovatchev@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> Leo,
>
>> Dimitre, I am not sure whether I understand your two centsb&
>> For each node you read, you have to compare all following nodes. How would
>> you like to do that in the initial reading?
>
> The initial loading will not compare any nodes -- it will establish
> the value that is the same if two elements are deep-equal.
>
> This value will be part of the data maintained for every node.
>
> Then, whenever deep-equal comparison is needed, only the values stored
> in the two nodes' data will be compared.
>
> Is it clear now?
>
>
> Cheers,
> Dimitre
>
>
>
> On Thu, Apr 5, 2018 at 1:13 PM, Leo Studer leo.studer@xxxxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>> Dimitre, I am not sure whether I understand your two centsb&
>> For each node you read, you have to compare all following nodes. How would
>> you like to do that in the initial reading?
>>
>> Yours
>> Leo
>>
>>
>> On 5 Apr 2018, at 20:15, Dimitre Novatchev dnovatchev@xxxxxxxxx
>> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>>
>> Just a thought on this.
>>
>> If we can implement deep-equal($n1, $n2)  as calculating some
>> ValueIdentity (VI) for each of the nodes and returning
>>
>>     VI1 eq VI2 ...
>>
>> Then the VIs for each node can be calculated on the initial reading of
>> the XML document (even in streaming mode) with almost no additional
>> effort. If these VIs are made properties of the nodes, then we could
>> just compare the VIs of the nodes and avoid any repeated zip-like
>> comparison of the subtrees that are topped by these nodes. And this
>> also seems more declarative/functional.
>>
>> Just my 2c.
>>
>> Cheers,
>> Dimitre
>>
>>
>> let $xml := <a>
>>                 <b>
>>                     <c>1</c>
>>                     <d>1</d>
>>                     <d>2</d>
>>                 </b>
>>                 <b>
>>                     <c>2</c>
>>                     <d>1</d>
>>                     <d>3</d>
>>                 </b>
>>                 <b>
>>                     <c>3</c>
>>                     <d>2</d>
>>                     <d>3</d>
>>                 </b>
>>                 <b>
>>                     <c>3</c>
>>                     <d>2</d>
>>                     <d>3</d>
>>                 </b>
>>             </a>
>>             return
>>
>> XSL-List info and archive
>> EasyUnsubscribe (by email)
>
>
>
> --
> Cheers,
> Dimitre Novatchev
> ---------------------------------------
> Truly great madness cannot be achieved without significant intelligence.
> ---------------------------------------
> To invent, you need a good imagination and a pile of junk
> -------------------------------------
> Never fight an inanimate object
> -------------------------------------
> To avoid situations in which you might make mistakes may be the
> biggest mistake of all
> ------------------------------------
> Quality means doing it right when no one is looking.
> -------------------------------------
> You've achieved success in your field when you don't know whether what
> you're doing is work or play
> -------------------------------------
> To achieve the impossible dream, try going to sleep.
> -------------------------------------
> Facts do not cease to exist because they are ignored.
> -------------------------------------
> Typing monkeys will write all Shakespeare's works in 200yrs.Will they
> write all patents, too? :)
> -------------------------------------
> Sanity is madness put to good use.
> -------------------------------------
> I finally figured out the only reason to be alive is to enjoy it.
>



--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

Current Thread