[F&O] 15.2.1 fn:deep-equal

I have commented on previous drafts that this function is unlikely to be
much use in practice as it has far too many arbitrary choices of what
constitutes equality and it ought to be moved to appendix C.

However assuming that it stays here the current definition appears to
have problems with document nodes.

Currently this clause is commented out

  (: if ($parameter1 instance of document-node() and not ($parameter2
  instance of document-node())) then fn:false() else :)


which means that if the first param is a document node and the second a
comment, they will return true if their string values are equal,
however if the same two parameters are given in the other order it will
return false due to
  if ($parameter1 instance of comment() and not ($parameter2 instance of
  comment())) then fn:false() else


so deep-equal isn't symmetric.

Even if that clause is restored, it appears that if both arguments are
document nodes then the test will fall through to:

  else  (: Must be a namespace node by elimination :)
   fn:compare (fn:string($parameter1), fn:string($parameter2)) ne 0

and so the string values of the documents will be compared, which
probably isn't what was intended.


David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Received on Monday, 17 November 2003 11:35:34 UTC