User-defined functions

By analogy with the use of xsl:function under the XSLT QLBs, user-defined XQuery functions are supported by XQS. These will be included for use in the (evaluated or compiled) schema when placed before the patterns, using element function in the XQuery namespace,, e.g.

  <sch:ns prefix='myfunc' uri='xyz'/>
  <function xmlns=''>
  declare function myfunc:test($arg as xs:string) as xs:string{$arg};
    <sch:rule context="/">
      <sch:report test="root"><sch:value-of select='myfunc:test(name(root))'/></sch:report>