Changes

Jump to navigation Jump to search
96 bytes removed ,  18:35, 1 December 2023
m
Text replacement - "<syntaxhighlight lang="xquery">" to "<pre lang='xquery'>"
|'''Examples'''
|Invokes the declared functions and returns their values:<br/>
<syntaxhighlight pre lang="'xquery"'>
declare %private function local:one() { 12 };
declare %private function local:two() { 34 };
</syntaxhighlight>
Compiles all functions in {{Code|code.xqm}} and invokes the function named {{Code|run}}:
<syntaxhighlight pre lang="'xquery"'>
let $uri := 'code.xqm'
let $name := 'run'
|
* Returns the static base URI (same as {{Code|static-base-uri()}}):
<syntaxhighlight pre lang="'xquery"'>
inspect:static-context((), 'base-uri')
</syntaxhighlight>
* Returns a map with all namespaces that are statically known in the module of the specified function:
<syntaxhighlight pre lang="'xquery"'>
import module namespace data = 'data.xqm';
inspect:static-context(data:get#1, 'namespaces')
</syntaxhighlight>
The function…
<syntaxhighlight pre lang="'xquery"'>
(:~
: This function simply returns the specified integer.
| '''Examples'''
|Evaluate all user-defined functions with zero arguments in the query context:<br/>
<syntaxhighlight pre lang="'xquery"'>
inspect:context()/function ! function-lookup(QName(@uri, @name), 0) ! .()
</syntaxhighlight>
Return the names of all private functions in the current context:
<syntaxhighlight pre lang="'xquery"'>
for $f in inspect:context()/function
where $f/annotation/@name = 'private'
This is the {{Code|sample.xqm}} library module:
<syntaxhighlight pre lang="'xquery"'>
(:~
: This module provides some sample functions to demonstrate
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu