|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Questions on User-Defined FunctionsWei, Alice J. ajwei at indiana.eduSat Feb 23 21:51:22 PST 2008
Hi, XQueriers: I have here one debugging issue here with XQuery using User-Defined Function. This is what I have now: declare function local:total($po as element(statistics)) as xs:integer { count($po) }; local:total(collection("xmldb:exist://db/my")//ad) The error I got is: Error while evaluating expression: declare function local:total($po as element(statistics)) as xs:integer { count($po) }; local:total(collection("xmldb:exist://db/cbml")//ad). The actual cardinality for parameter 1 does not match the cardinality declared in the function's signature: local:total($a as element) xs:integer. Expected cardinality: exactly one, got 517. [at line 115, column 21] In call to function: local:total(element) [5:1] The code is based on the XQuery of <statistics> {count(distinct-values(( fn:collection("xmldb:exist://db/my"))//ad))} </statistics> which brings the output of <statistics>229</statistics> What have I done wrong here? The other question I have is that since I intend to create a web application out of XQuery, whether or not I should use user-defined functions. Any suggestion is welcome. Alice ====================================================== Alice Wei MIS 2008 School of Library and Information Science Indiana University Bloomington 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! 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
|






