| XQUERY/XSLT API DOCUMENTATION 4.2 |
All XQuery & XSLT Functions MarkLogic Built-In Functions Admin (xdmp:) AppServer (xdmp:) Classifier (cts:) Debug (dbg:) Document Conversion (xdmp:) Extension (xdmp:) Documents, Directories, Properties, and Locks Functions Extension Functions Function Values Functions HTTP Functions JSON Functions MarkLogic Server Functions Search Functions XML Functions XQuery Context Functions XSLT Functions map (map:) Math (math:) Profile (prof:) Search (cts:) cts:query Constructors Functions Geospatial Functions Geospatial Lexicon Functions Lexicon Functions Search Functions Search Clustering Functions Security (xdmp:) Server Monitoring (xdmp:) Spell (spell:) Update (xdmp:) XQuery Library Modules Admin Library (admin:) Actions Functions Appserver Functions Database Functions Forest Functions Group Functions Host Functions Mimetypes Functions Scheduler Functions Alerting (alert:) Elastic Compute Cloud (ec2:) Entity Enrichment (entity:) Flexible Replication (flexrep:) Geospatial Supporting Functions GEO Functions GeoRSS Functions GML Functions KML Functions MCGM Functions Information Studio (info:) Information Studio Developer (infodev:) Library Services (dls:) cts:query Constructor Functions Document Management Functions Document Update Functions Retention Policy Functions XInclude Functions Modular Documents XInclude Functions XPointer Functions PKI (pki:) Plugin (plugin:) Search (search:) Security-sec (sec:) Spelling Dictionary Management (spell:) Thesaurus (thsr:) Triggers (trgr:) Triggers Library (trgr:) WordProcessingML (ooxml:) ZIP Package (ooxml:) CPF Functions Content Processing Framework (cpf:) CSS Conversion (css:) DocBook Conversion (dbk:) Domains (dom:) Excel Conversion (excel:) Generic Conversion (cvt:) Links (lnk:) MSWord Conversion (msword:) PDF Conversion (pdf:) Pipelines (p:) Powerpoint Conversion (ppt:) XHTML Conversion (xhtml:) W3C-Standard Functions Accessor (fn:) AnyURI (fn:) Boolean (fn:) Context (fn:) DurationDateTime (fn:) Error and Trace (fn:) Node (fn:) Numeric (fn:) QName (fn:) Sequence (fn:) String (fn:) XSLT (fn:) W3C XQuery/XSLT Reference W3C XQuery Functions W3C XQuery Language W3C XSLT Language
This page was generated September 12, 2012 5:59 AM | XQuery & XSLT Built-In & Modules Function Reference
Built-In: Extension - Function Values Functions
The function values functions allow you to pass a function value as a parameter to another function. You can also pass in the location of the implementation of a function, allowing the caller to specify a different version of a function to use in the context of making that function.
Function Summary
xdmp:apply | Applies an xdmp:function with the given parameters.
xdmp:function | Returns a function value as an xdmp:function type.
xdmp:function-module | Returns the module location (if any) that the xdmp:function value refers to.
xdmp:function-name | Returns the QName of the function(s) that the xdmp:function refers to.
Function Detail
xdmp:apply(
| $function as xdmp:function,
| [$params-1-to-N as item()*]
) as item()*
Summary: Applies an `xdmp:function` with the given parameters.
Parameters:
$function : The xdmp:function value to be applied.
$params-1-to-N (optional): The parameters to pass into the specified function value. Specify one parameter for each parameter that the specified function takes, with the first parameter corresponding to the first parameter in the specified function's signature, the second parameter corresponding to the second, and so on. Omit this parameter if the specified function takes no parameters.
Example:
      let $function := xdmp:function(xs:QName("fn:empty"))
      return
        xdmp:apply($function, ())

      => true
Example:
      let $function := xdmp:function(xs:QName("fn:concat"))
      return
        xdmp:apply($function, "hello", " world")

      => hello world
Example:
      let $function := xdmp:function(xs:QName("fn:current-date"))
      return
        xdmp:apply($function)

      => 2009-02-14-08:00  (or whatever is the current date)
xdmp:function(
| $function as xs:QName,
| [$module-path as xs:string?]
) as xdmp:function
Summary: Returns a function value as an `xdmp:function` type. You can return an `xdmp:function` from an expression or a function. You can execute the function referred to by an `xdmp:function` by passing the `xdmp:function` value to `xdmp:apply`.
Parameters:
$function : The function QName, which includes its local name and namespace. If the function is not found in the current query context or in the module specified in the second parameter, then an exception is thrown.
$module-path (optional): The optional path to the module where the function specified in the first parameter is defined. If the module-path is not supplied, the function QName must be in-scope in the query context. If the empty sequence is supplied, the function behaves as if the parameter is not supplied (that is, it uses the in-scope query context).
Example:
    xquery version "1.0-ml";

    xdmp:function(xs:QName("fn:empty"))
Example:
    xquery version "1.0-ml";

    declare namespace admin="http://marklogic.com/xdmp/admin";

    xdmp:function(xs:QName("admin:get-configuration"),
          "/MarkLogic/admin.xqy")
Example:
    xquery version "1.0-ml";

    let $function := xdmp:function(xs:QName("fn:concat"))
    return
       xdmp:apply($function, "hello", " world")

    => hello world
xdmp:function-module(
| $function as xdmp:function
) as xs:string
Summary: Returns the module location (if any) that the xdmp:function value refers to.
Parameters:
$function : The function value.
Example:
      let $fn := xdmp:function(xs:QName("admin:get-configuration"),"/MarkLogic/admin.xqy")
      return
        xdmp:function-module($fn)
      ==> "/MarkLogic/admin.xqy"
xdmp:function-name(
| $function as xdmp:function
) as xs:QName
Summary: Returns the QName of the function(s) that the xdmp:function refers to.
Parameters:
$function : The xdmp:function value.
Example:
      let $fn := xdmp:function(xs:QName("fn:empty"))
      return
        xdmp:function-name($fn)
      ==> "fn:empty"

© Copyright 2002-2012 MarkLogic Corporation. All rights reserved.