[xquery-talk] node comparison based on qualified name

Andrew Welch andrew.j.welch at gmail.com
Thu Jun 23 05:00:43 PDT 2011


On 23 June 2011 12:32, Kunal Chauhan <mail4ck at gmail.com> wrote:
> Hi,
>
> I have two different sequences of elements and I want to compare those two.
> How can I compare these two sequences based on their qualified name.
>  attributes,content values doesn't matter.
>
> for example,
>
> let $seq1 :=
>        <author>
>       <afName>aaa</afName>
>       <alName>aaa</alName>
>        </author>
>
> let $seq2 :=
>      <author>
>       <afName>bbb</afName>
>       <alName>bbb</alName>
>        </author>
>
> let $seq3 :=
>
>      <author>
>       <afName>ddd</afName>
>       </author>
>
> When I compare $seq1 and $seq2 it should not return any element, but when I
> compare $seq1 and $seq3 it should return <alName>aaa</alName>
> How can I achieve this ?

The basic comparison is:

$seq1/*[not(name() = $seq3/*/name())]




-- 
Andrew Welch
http://andrewjwelch.com



More information about the talk mailing list