[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Help with multiple deletes

Martin Probst mail at martin-probst.com
Sat Aug 29 17:47:16 PDT 2009


  Help with multiple deletes
> After I spent a nice chunk of time testing this in stylus studio, I took the
> concept and ported it into our application.  Only to discover that the
> implementation we are using, MXQuery 0.6.0, does not support ancestor!
> Argh..  =)  So if anyone thinks it can possibly be rewritten without using
> ancestor (or any other axes I’m guessing), please share your thoughts.  But
> I think we are going to end up using an XSLT for this operation.

You could simply transform twice, which might be less efficient, but
its certainly simpler to write:

copy $x := doc("tree.xml")
     modify (
         delete node $x//tree[@ID = 1] /branch[@ID = 2] /branch[@ID =
13] /branch[@ID = 65] /branch[@ID = 15] /leaf[@ID = 25]
     )
return
  copy $y := $x
  modify (
         delete node $x//tree//branch[count(.//leaf) = 0]
                ,
         delete node $x//tree[count(.//branch) = 0]
  )
  return $y

Martin



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.