Re: [xsl] Using node-set variables in predicates (another node comparison question)

Subject: Re: [xsl] Using node-set variables in predicates (another node comparison question)
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 2 Jan 2022 23:12:09 -0000
On Sun, Jan 2, 2022 at 2:42 PM Chris Papademetrious
christopher.papademetrious@xxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Thanks Michael, Martin! This list is great.
>
>
>
> Given the many articles on the various ways of comparing identicality in
> XSLT 2+, I was surprised not to find the answer to this one.
>
>
>
>    - Chris
>
>
Following the proposals for "Functions that determine the equality of two
sequences or the equality of two arrays" (
https://github.com/qt4cg/qtspecs/issues/99), and the proposals "Functions
that determine if a given sequence starts with another sequence or ends
with another sequence"  (https://github.com/qt4cg/qtspecs/issues/96),  and
"Functions that determine if a given sequence is a subsequence of another
sequence" (https://github.com/qt4cg/qtspecs/issues/94), it seems only
logical to introduce in XPath 4.0 another overload of fn:index-of(), that
accepts as argument a compare() function.

Also, due to its frequent use, we need a standard id-equal() function (the
same as the proposed fn:ops("is")) that will compare two nodes for identity,

Thus, checking if a given node $n belongs to a sequence of nodes $seq (and
using this in scenarios where we want to preserve the original order of
nodes in the sequence) would be as simple as:

exists(index-of($seq, $n, id-equal#2))

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.

Current Thread