Error executing XQuery function

Poster Content
nk4um User
Posts: 89
March 9, 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
nk4um User
Posts: 89
March 9, 2008 09:50use doc() instead of document()
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.
nk4um User
Posts: 1
March 9, 2008 08:55Error executing XQuery function
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