XQuery Update

Issues related to W3C XQuery.
AE2012
Posts: 3
Joined: Wed Jan 25, 2012 1:24 pm

XQuery Update

Post 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?
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: XQuery Update

Post 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
AE2012
Posts: 3
Joined: Wed Jan 25, 2012 1:24 pm

Re: XQuery Update

Post by AE2012 »

Thanks a lot!! Now it's working fine!
There really should be a hint on that issue!!
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: XQuery Update

Post 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
cmcenearney
Posts: 6
Joined: Thu Dec 01, 2011 6:44 pm

Re: XQuery Update

Post 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
ojeulin
Posts: 17
Joined: Mon Mar 15, 2010 8:35 pm
Location: Paris, France

Re: XQuery Update

Post 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?
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: XQuery Update

Post 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
ojeulin
Posts: 17
Joined: Mon Mar 15, 2010 8:35 pm
Location: Paris, France

Re: XQuery Update

Post 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".
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: XQuery Update

Post 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply