Page 1 of 1

XQuery Update

Posted: Wed Jan 25, 2012 1:40 pm
by AE2012
Hello,

I've got Problems with executing XQuery Update expressions but can'f find any wrong settings. Running Oxygen Editor 13.2.

Examples:

returning "F [Saxon-EE XQuery 9.3.0.5] Updating functions are allowed only in XQuery Update"

for

Code: Select all

declare updating function
   upsert($e as element(),
          $an as xs:QName,
          $av as xs:anyAtomicType)
   {
   let $ea := $e/attribute()[fn:node-name(.) = $an]
   return
      if (fn:empty($ea))
      then insert node attribute {$an} {$av} into $e
      else replace value of node $ea with $av
   }



returning "F [Saxon-EE XQuery 9.3.0.5] Unexpected token "copy" in path expression"

for

Code: Select all

let $source := doc('juicers.xml')
let $images := doc('juicer-images.xml')

return
   for $i in $source//juicer return
          copy $j := $i
          modify
             replace node $j/image with
                  element {'image'}
                    {
                       for $j in $images//image[@id eq $j/@id]/* return
                           element {$j/name()} {data($j)}
                    }
          return $j


Any ideas?

Re: XQuery Update

Posted: Wed Jan 25, 2012 4:14 pm
by adrian
Hello,

I'm guessing you have enabled the support for XQuery 1.1 in Saxon(by default it's disabled). Please note that this causes the support for XQuery Update to be disabled. I can't seem to find a documentation page for Saxon that confirms or explains this.

In Oxygen go to Options > Preferences, XML > XSLT-FO-XQuery > XQuery > Saxon-HE/PE/EE and make sure that the option Enable XQuery 1.1 support is disabled.
Both errors should disappear after disabling this option.

Regards,
Adrian

Re: XQuery Update

Posted: Wed Jan 25, 2012 4:27 pm
by AE2012
Thanks a lot!! Now it's working fine!
There really should be a hint on that issue!!

Re: XQuery Update

Posted: Thu Jan 26, 2012 4:10 pm
by adrian
I have logged this to our issue tracking tool and this limitation of Saxon will be mentioned in the Oxygen documentation.

Regards,
Adrian

Re: XQuery Update

Posted: Thu Mar 22, 2012 6:53 pm
by cmcenearney
Hi,

Just wanted to say I had this problem as well and solved as a result of this post.

Thanks!

It was really driving me nuts as I had update queries which previously worked and couldn't figure this out.

Colin

Re: XQuery Update

Posted: Wed Jul 25, 2012 2:32 pm
by ojeulin
Hi,
using oxygen XML Editor 14.0, build 2012062215 I've got a validation error:
Fichier de validation principal: /…/Sans titre1.xquery
Nom du moteur: Saxon-EE XQuery 9.4.0.3
Gravité: fatal
Description: Unexpected token "delete nodes" in path expression
URL: http://www.w3.org/TR/xpath20/#ERRXPST0003

when I validate this code:
for $st in //stitle[following-sibling::title = .]
return delete node $st

In the configuration, I've checked the chekcbox for XQuery 3.0.
What am I missing?

Re: XQuery Update

Posted: Wed Jul 25, 2012 3:49 pm
by adrian
Hello,
ojeulin wrote:when I validate this code:
for $st in //stitle[following-sibling::title = .]
return delete node $st

In the configuration, I've checked the chekcbox for XQuery 3.0.
What am I missing?

I believe you got it wrong. You are supposed to disable the option named Enable XQuery 1.1 support. In v14.0 and later this option has been renamed to Enable XQuery 3.0 support. Disable this option, make sure you use Saxon-EE and it will work.

Regards,
Adrian

Re: XQuery Update

Posted: Thu Jul 26, 2012 12:43 pm
by ojeulin
Thanks, indeed, with the XQ 3.0 disabled it's working.
I thought "disable XQuery 1.1" == "XQ 3.0 [-qversion(1.0|3.0)] enabled".

Re: XQuery Update

Posted: Wed Aug 05, 2015 11:12 am
by adrian
Hi,

In case anyone else needs to enable XQuery Update and reads this thread, since v17.0 a separate option is available for XQuery Update in Options > Preferences, XML > XSLT-FO-XQuery > XQuery > Saxon-HE/PE/EE, Enable XQuery Update (in the Saxon-EE specific options subsection). So, it is no longer necessary to clear the option Enable XQuery 3.0 support.

Regards,
Adrian