[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Function Call Errors

Michael Kay mike at saxonica.com
Mon Feb 25 19:07:03 PST 2008


  Function Call Errors
You've declared a function that expects four parameters and you've called it
supplying only one.

Since sorted_result, count, and doc are the names of local variables within
the function I suspect you should just omit these parameter declarations.

Also you refer to a variable/parameter called $ad but there isn't one. I
suspect you meant $seq.

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: http://x-query.com/mailman/listinfo/talk 
> [mailto:http://x-query.com/mailman/listinfo/talk] On Behalf Of Wei, Alice J.
> Sent: 25 February 2008 18:11
> To: http://x-query.com/mailman/listinfo/talk
> Subject:  Function Call Errors
> 
> Hi, XQeriers:
> 
>    I have a piece of code here that I have modified into the 
> following function:
> 
> declare function local:distinct(
>      $seq as xs:anyAtomicType*,
>      $sorted_result as xs:integer*,
>      $count as xs:integer,
>      $doc as xs:anyAtomicType*)
>      as xs:anyAtomicType
> {
> let $sorted_result:=
> for $doc in distinct-values($ad)
> order by $doc
> return $doc
> for $r at $count in $sorted_result
> let $nodes := $ad[. = $r][1]
> return
> <ad>
> <statistics>
> Showing Result: {$count} / {count($sorted_result)} 
> </statistics> {$nodes} </ad> };
> 
> for $ad in 
> distinct-values(collection("xmldb:exist://db/my")//ad/p[contai
> ns(upper-case(.),'BOOK')])
> return
> local:distinct($ad)
> 
> This is currently, not working and keeps popping the following error:
> 
> org.exist.xquery.XPathException: Call to undeclared function: 
> local:distinct [at line 25, column 1]
> 
> This is based on the XQuery in the following:
> 
> let $ad := 
> fn:collection("xmldb:exist://db/my")//ad/p[contains(upper-case
> (.), 'BOOK')] let $sorted_result:= for $doc in 
> distinct-values($ad) order by $doc return $doc for $r at 
> $count in $sorted_result let $nodes := $ad[. = $r][1] return 
> <ad> <statistics> Showing Result: {$count} / 
> {count($sorted_result)} </statistics> {$nodes} </ad>
> 
> Can anyone please give me tips on how to fix up the query so 
> that it would generate something like
> 
> <ad>
> <statistics> Showing Result: 1 /1</statistics> <p>A business 
> so big growing so fast, you need an appointment in most auto 
> trim shops! Send for FREE MASTER PLAN, ILLUSTRATED BOOKLET on 
> learning auto upholstery and interior customizing in your 
> spare hours. No experience needed. Yet approved auto 
> upholstery institute, dept.
> <address>
> <addressLine>RMC 1205 W. Barkley,</addressLine> 
> <addressLine>Orange CA 92668</addressLine> </address> </p> </ad>
> 
> Thanks to those who can help.
> Of anyone on the list who know any resources on where I can 
> practice user-defined function call using interactive tabs 
> woulld be great.
> 
> ======================================================
> Alice Wei
> MIS 2008
> School of Library and Information Science Indiana University 
> Bloomington http://x-query.com/mailman/listinfo/talk
> 
> _______________________________________________
> http://x-query.com/mailman/listinfo/talk
> http://x-query.com/mailman/listinfo/talk



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.