|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Unexpected token syntax error, unexpected DeclareFunction_G. Ken Holman gkholman at CraneSoftwrights.comWed Sep 30 22:53:30 PDT 2009
At 2009-09-30 18:13 -0700, Anil Shekhar wrote:
>XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error,
>unexpected DeclareFunction_
The message says that your declaration of a function is unexpected.
>in /shakespeare.xqy, on line 8 [1.0-ml]Line 8 is where I have
>defined the function.
Sure enough, that isn't an expected place for a function definition.
Reviewing: http://www.w3.org/TR/xquery/#id-function-calls
>3.1.5 Function Calls
>[Definition: The built-in functions supported by XQuery are defined
>in [XQuery 1.0 and XPath 2.0 Functions and Operators].] Additional
>functions may be declared in a Prolog, imported from a library
>module, or provided by the external environment as part of the static context.
And that is pretty explicit that functions can only be declared in the prolog.
You have:
><html>
> <head>
> <title>Shakespeare ...</title>
> </head>
> <body>
> <p>
> {
> declare function local:handle-doc(
> $doc as document-node(),
> $speeches as element(SPEECH)+
> )
.... which doesn't have the declaration in the prolog, but in the
middle of the query.
So I think the error message is quite justified.
I hope this helps.
. . . . . . . . . . Ken
--
Upcoming hands-on code list, UBL, XSLT, XQuery and XSL-FO classes.
Interested in other classes? http://www.CraneSoftwrights.com/q/i/
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman mailto:http://x-query.com/mailman/listinfo/talk
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






