// mapping in sxpath native syntax

"Dmitry Lizorkin" <[email protected]> Fri, 3 Dec 2004 18:00:36 +0300
Newsgroups gmane.lisp.scheme.ssax-sxml
Message-ID <[email protected]>
Hello!

http://xmlhack.ru/protva/xquery/index.php/WhyNotSxTools
Oleg A. Paraschenko in his article provides 2 very illustrative examples on
SXPath improper behaviour:

((sxpath '(// name))
   '(root (@ (name "aname") (id "aid"))
     (part
      (name "part name")
      "part content")))
==>
((name "aname") (name "part name"))

((sxpath '(warning // *text*))
   '(*TOP* (warning
            (p
             "Do " (emph "NOT") " touch the switch."
             "The computer will " (emph "explode!")))))
==>
("Do " " touch the switch." "The computer will " "NOT" "explode!")

Both examples yield an unexpected result because of the '// step of sxpath
native syntax: in the sxpath function, '// is still mapped to
 (node-or
   (node-self (ntype?? '*any*))
   (node-closure (ntype?? '*any*)))
which is well-known to violate document order and select attribute nodes and
<annot-attributes> lists.

On the other hand, more than 2 years ago the
   sxml:descendant-or-self
function which handles the above things correctly was introduced in SXPath.

Anyway, the '// step of sxpath native syntax is still mapped to
   (node-or  ...)
for the mere reasons of backward compatibility.

Is it now high time to break backward compatibility and finally change the
mapping of '// to sxml:descendant-or-self in the sxpath native syntax?

Your comments, objections are very welcome

Dmitry





-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/