Skip to content

Instantly share code, notes, and snippets.

@robbypelssers
Created March 18, 2013 15:53
Show Gist options
  • Save robbypelssers/5188190 to your computer and use it in GitHub Desktop.
Save robbypelssers/5188190 to your computer and use it in GitHub Desktop.
XQuery3.0: Partial function example
xquery version "3.0";
declare function local:increase($nums as xs:integer*, $by as xs:integer) as xs:integer* {
$nums ! (. + $by)
};
let $numbers := (2,3,6,8,12,14)
let $increaseByThree := local:increase(?, 3)
let $increaseByFour := local:increase(?, 4)
return
<result>
<test1>{$increaseByThree($numbers)}</test1>
<test2>{$increaseByFour($numbers)}</test2>
</result>
(:
**********************************************
XQuery output:
**********************************************
<result>
<test1>5 6 9 11 15 17</test1>
<test2>6 7 10 12 16 18</test2>
</result>
:)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment