[Bug 3578] [UPDUseCases] Issues with May 8th Usecase Draft

http://www.w3.org/Bugs/Public/show_bug.cgi?id=3578





------- Comment #6 from jonathan.robie@redhat.com  2007-08-17 20:24 -------
[quote]Q3: Neither solution 1, nor solution 3 lead to the expected result.
Solution 1 doesn't delete piston, window and lock.
The recursive function is solution 2 is also incorrect, as it
deletes in "part-tree.xml" at the first call and in "part-list.xml"
at subsequent calls.[/quote]

I believe this is correct for solution 1:


for $pt in doc("part-tree.xml")//part[@name="car"]//part,
     $pl in doc("part-list.xml")//part
where $pt/@partid eq $pl/@partid
return 
   delete nodes $pl

I believe this is correct for solution 2:

declare updating function 
             local:delete-subtree($p as element(part))
  {
      for $child in doc("part-list.xml")//part
      where $p/@partid eq $child/@partof
      return (
        delete nodes $child,
        local:delete-subtree($child)
      )
  };

for $p in doc("part-list.xml")//part[@name="car"]
return 
  local:delete-subtree($p)

Received on Friday, 17 August 2007 20:24:16 UTC