Re: XQuery

Frieda Shachar wrote:
> 
>         Do you know if there's a way to compute in XQuery for
>         a given path expression all it maximal matching values
>         (meaning: for a given matc of a path is maximal if there is no
>          other match for a broader pattern of that path)
>         I'll be thankfull if you can refer me to one or few examples
>         which ilustrate what I've quesioned.

Uh, it would help if *you* could provide an example of what you mean.
(I'm particularly puzzled about the phrase "a broader pattern of that path".)

Here's a possible interpretation:
For a given path expression E, the _maximal_set_ of E (with respect to some
evaluation context) is the set of nodes N such that:
   N is in the nodeset selected by E (w.r.t. that context), and
   no ancestor of N is in that nodeset.

And yes, you can compute this in XQuery. For example:

    DEFINE FUNCTION maximal( nodeset $s ) RETURNS nodeset
    {
        FOR $n IN $s
        WHERE empty( $n/ancestor::* INTERSECT $s )
        RETURN $n
    }

-Michael Dyck

Received on Thursday, 1 November 2001 04:50:59 UTC