W3C home > Mailing lists > Public > www-ql@w3.org > July to September 2007

RE: XQuery Update to return values

From: Wu, Emma <Emma.Wu@ddytech.com>
Date: Fri, 27 Jul 2007 10:22:02 -0600
Message-ID: <FFB747021C6AB34AABE44A21B8753460FE14EB@MAIL1.malibu.ads>
To: "Carmelo Montanez" <carmelo@nist.gov>, <www-ql@w3.org>

The query below does not change the original document. Only the copied var $newVar is updated.
I need the $var to be updated and return the updated $var as well. Any idea? Thanks.

Emma


-----Original Message-----
From: Carmelo Montanez [mailto:carmelo@nist.gov]
Sent: Fri 7/27/2007 9:41 AM
To: Wu, Emma; www-ql@w3.org
Subject: Re: XQuery Update to return values
 
Emma:

If I am not mistaken, you can use a Transform expression, which will 
return a value back.
Something like this:

let $var := fn:doc("works-mod.xml")/works[1]/employee[1]
let $var1 := <pnum>P1-1</pnum>
return
  transform
   copy $newVar := $var
   modify do replace $newVar/pnum[1] with $var1
   return $newVar

Thanks,
Carmelo


At 02:02 PM 7/26/2007, Wu, Emma wrote:
>Hi,
>
>The problem I am trying to solve is that with XQuery Update 
>faicility, I will update an element and at the same time, I want the 
>same element to be returned. Something like the following:
>
>1. update a book element's author
>2. return the updated book element
>
>Is there a way to do it in one query instead of two separate 
>queries? And it looks like update expression does not return anything
>
>Thanks,
>Emma
>
>
>
>
Received on Friday, 27 July 2007 16:23:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 27 July 2007 16:23:41 GMT