|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] functions with out parametersMartin Probst martin at x-hive.comTue Aug 15 13:18:58 PDT 2006
Hi, > Hi all, I need to design somehow xquery functions with inout > parameters. AFAIN xquery only supports input parameters. Do you > have any idea how to achieve that? Functions in XQuery have a return type, which is an excellent way of _returning_ stuff from a function ;-) If you have to return multiple values from one function call, you can either return a tuple, e.g. declare function local:square-and-cubic($bar as xs:integer) as xs:integer+ { $bar * $bar, $bar * $bar * $bar }; And then use it with indexes, e.g. $res[1] and $res[2]. Alternatively you can use XML to model your datatype: declare function local:square-and-cubic($bar as xs:integer) as element() { <result><square>{ $bar * $bar }</square><cubic>{ $bar * $bar * $bar }</cubic></result> }; In many cases you might find that you already have an XML element type for the kind of result you expect, because you use that composed type in one of your schemas. HTH, Martin Am 15.08.2006 um 11:43 schrieb Enric Jaen: > Hi all, I need to design somehow xquery functions with inout > parameters. AFAIN xquery only supports input parameters. Do you > have any idea how to achieve that? > Thanks in advance, > -Enric > > > _______________________________________________ > http://xquery.com/mailman/listinfo/talk > http://xquery.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
|






