xsl-list
[Top] [All Lists]

Re: [xsl] XQuery/XPath 3.1: Node List to Node Set ("distinct nodes")

2021-12-29 10:36:19
On Wed, Dec 29, 2021 at 12:21 AM Martin Honnen 
martin(_dot_)honnen(_at_)gmx(_dot_)de <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:


Am 29.12.2021 um 00:32 schrieb Dimitre Novatchev 
dnovatchev(_at_)gmail(_dot_)com:





Hit Send too early:

Do notice: this seems the only solution of all presented so far, that
preserves the original sequence order (not document order) of the nodes.

Why is the original sequence order preserved?
https://www.w3.org/TR/xpath-functions/#func-distinct-values clearly says

"The function returns the sequence that results from removing from $arg all
but one of a set of values that are considered equal to one another. [...]

The order in which the sequence of values is returned is ·
implementation-dependent·
<https://www.w3.org/TR/xpath-functions/#implementation-dependent>.

Which value of a set of values that compare equal is returned is ·
implementation-dependent·
<https://www.w3.org/TR/xpath-functions/#implementation-dependent>."


So while

   $nodes ! generate-id(.)

gives you the generated ids in the order of the nodes in $nodes after the
call to distinct-values there is no order defined, it is implementation
dependent.


@Martin Honnen <Martin(_dot_)Honnen(_at_)gmx(_dot_)de> Could you, please, give 
us an example
of an existing XPath engine whose implementation of `distinct-values()`
produces its results in any other order than their original order in the
input sequence?

Cheers,
Dimitre




XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/782854> (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.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>