Re: [xsl] HST's answers Re: [xsl] Efficient way to check sequence membership -

Subject: Re: [xsl] HST's answers Re: [xsl] Efficient way to check sequence membership -
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 3 Mar 2011 05:33:18 -0800
On Thu, Mar 3, 2011 at 2:50 AM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>
>> It seems the following expression can do checks based on node identity
>> (I inferred this meaning from Dave's requirement... the "member()"
>> function),
>>
>> some $x in $seq satisfies ($x is $item)
>>
>>
>
> DP's requirement statement could be read that way, but he also said the aim
> was to solve HT's problem, which doesn't involve nodes or node identity.
>
> But for completeness, if you want to do this for node identity, you can use
>
> test="$item intersect $seq"

There are ways in XPath 3.0 to build new data structure and I have
used these in building the Binary Search Tree and the Set (based on
BST) data structures (I am wondering if it's right to call them
"datatypes", as we really don't have a type definition facility in
XPath 3.0 (even not a type-aliasing facility yet).

But, of course, there is the set:member() function:

http://dnovatchev.wordpress.com/2011/02/20/the-set-datatype-implemented-in-xpath-3-0/


While the currently implemented set data structure is only for value -
types that are ORDERED (once again, we don't have any facility at the
moment to express such kinds of type-constraints) and the operations
can become very inefficient if the underlying BST becomes severely
imbalanced), there are other data structures on which a set can be
based, that do not have these problems -- and I am having fun with
these now :)

To put it in few words: it is quite probable that you may find some
sweet feature in FXSL 3, that didn't make it in XPath 3.0.

-- 
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
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
Facts do not cease to exist because they are ignored.

Current Thread