Topic - Error executing XQuery function
Topic - Error executing XQuery function Topic - Error executing XQuery function
from forum 1060 Forum
 forum index   my profile   search 
 new topic  post reply 
moderators: pjr tab
Error executing XQuery function
Joined: 9-March-2008
Posts: 1
Posted: 9-March-2008 08:55
Hi,

When trying to operate the xqeury function as shown in the tutorial (http://localhost:1060/book/developerreference/doc_ura_xquery)
I get the following error:

net.sf.saxon.trans.StaticError
XQuery static error in #....lear.xml") return ;#: Cannot use the document() function in a non-XSLT context
use doc() instead of document()
Joined: 14-March-2005
Posts: 60
Location: Amsterdam, The Netherlands
Posted: 9-March-2008 09:50
Yes, there an error in the example on that page. The document() function is a XSLT2 specific wrapper around the general XPath2 doc() function, see

http://www.w3.org/TR/xslt20/#document

XQuery doesn't have a special wrapper function, but you just use the doc() function:

http://www.w3.org/TR/xpath-functions/#func-doc

So the example on

http://www.w3.org/TR/xpath-functions/#func-doc

should be


<xquery>  let $operand := doc("ffcpl:/lear.xml")/PLAY/ACT[1]/SCENE[1] return &lt;SPEECHES&gt; {$operand//SPEECH[SPEAKER='GLOUCESTER']} &lt;/SPEECHES&gt; </xquery>


Hope this helps,

Menzo

PS: By the way, this section of the forum is meant for discussion on the forum application. The 'Solutions Developer' section of the forum would be a better place to post these kind of questions.
Joined: 14-March-2005
Posts: 60
Location: Amsterdam, The Netherlands
Posted: 9-March-2008 09:58
Oops, copy and paste error :-( Of course that should've been the example on

http://docs.1060.org/docs/3.3.0/book/developerreference/doc_ura_xquery.html
 new topic  post reply  To find out about new replies to this post as they occur
please subscribe to one of these feeds:
AtomRSS moderate 
© 2003-2006, 1060 Research Limited. 1060 registered trademark, NetKernel trademark of 1060 Research Limited.