| 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 6:01 AM | XQuery & XSLT Built-In & Modules Function Reference
Built-In: Context
The context built-in functions are XQuery functions defined to obtain information from the dynamic context. They are defined in XQuery 1.0 and XPath 2.0 Functions and Operators.
Function Summary
fn:current-date | Returns xs:date(fn:current-dateTime()).
fn:current-dateTime | Returns the current dateTime value (with timezone) from the dynamic context.
fn:current-time | Returns xs:time(fn:current-dateTime()).
fn:default-collation | Returns the value of the default collation property from the static context.
fn:implicit-timezone | Returns the value of the implicit timezone property from the dynamic context.
fn:last | Returns the context size from the dynamic context.
fn:position | Returns the context position from the dynamic context.
fn:static-base-uri | Returns the value of the base-uri property from the static context.
Function Detail
fn:current-date( ) as xs:date
Summary: Returns `xs:date(fn:current-dateTime())`. This is an `xs:date` (with timezone) that is current at some time during the evaluation of a query or transformation in which `fn:current-date()` is executed. This function is *stable*. The precise instant during the query or transformation represented by the value of `fn:current-date()` is *implementation dependent*.
Usage Notes: `fn:current-date()` returns an `xs:date` corresponding to the current date and time. For example, an invocation of `fn:current-date()` might return `2004-05-12+01:00`.
Example:
    fn:current-date()

    => 2006-05-25-07:00
fn:current-dateTime( ) as xs:dateTime
Summary: Returns the current dateTime value (with timezone) from the dynamic context. (See Section C.2 Dynamic Context Components[XP].) This is an `xs:dateTime` that is current at some time during the evaluation of a query or transformation in which `fn:current-dateTime()` is executed. This function is *stable*. The precise instant during the query or transformation represented by the value of `fn:current-dateTime()` is *implementation dependent*.
Usage Notes: `fn:current-dateTime()` returns an `xs:dateTime` corresponding to the current date and time. For example, an invocation of `fn:current-dateTime()` might return `2004-05-12T18:17:15.125Z` corresponding to the current time on May 12, 2004 in timezone Z.
Example:
    fn:current-dateTime()

    => 2006-05-25T18:21:24.454-07:00
fn:current-time( ) as xs:time
Summary: Returns `xs:time(fn:current-dateTime())`. This is an `xs:time` (with timezone) that is current at some time during the evaluation of a query or transformation in which `fn:current-time()` is executed. This function is *stable*. The precise instant during the query or transformation represented by the value of `fn:current-time()` is *implementation dependent*.
Usage Notes: `fn:current-time()` returns an `xs:time` corresponding to the current date and time. For example, an invocation of `fn:current-time()` might return `23:17:00.000-05:00`.
Example:
    fn:current-time()

    => 18:24:06-07:00
fn:default-collation( ) as xs:string
Summary: Returns the value of the default collation property from the static context. Components of the static context are discussed in Section C.1 Static Context Components[XP]. The default collation property can never be undefined. If it is not explicitly defined, a system defined default codepoint is used. In the `1.0` XQuery dialect, if this is not provided, the Unicode code point collation (`http://www.w3.org/2005/xpath-functions/collation/codepoint`) is used. In the `1.0-ml` and `0.9-ml` XQuery dialects, the MarkLogic-defined codepoint URI is used (`http://marklogic.com/collation/codepoint`).
Usage Notes: For details about collations in MarkLogic Server, see the "Encodings and Collations" chapter of the Developer's Guide.
Example:
    xquery version "1.0-ml";
    declare default collation "http://marklogic.com/collation/codepoint";
    fn:default-collation()

    => http://marklogic.com/collation/codepoint
Example:
    xquery version "1.0";
    declare default collation "http://marklogic.com/collation/codepoint";
    fn:default-collation()

    => http://www.w3.org/2005/xpath-functions/collation/codepoint
fn:implicit-timezone( ) as xs:dayTimeDuration
Summary: Returns the value of the implicit timezone property from the dynamic context. Components of the dynamic context are discussed in Section C.2 Dynamic Context Components[XP].
Example:
    fn:implicit-timezone()

    => -PT7H
fn:last( ) as xs:integer
Summary: Returns the context size from the dynamic context. (See Section C.2 Dynamic Context Components[XP].) If the context item is undefined, an error is raised [err:FONC0001].
Example:
    let $x := (10, 20, 30, 40, 50)
    return
    $x[last()]

    => 50, which is the last item in the sequence
fn:position( ) as xs:integer
Summary: Returns the context position from the dynamic context. (See Section C.2 Dynamic Context Components[XP].) If the context item is undefined, an error is raised [err:FONC0001].
Example:
    let $x := (10, 20, 30, 40, 50)
    return
    $x[position() eq 2]

    => 20, which is in the second position in the sequence
fn:static-base-uri( ) as xs:anyURI?
Summary: Returns the value of the base-uri property from the static context. If the base-uri property is undefined, the empty sequence is returned. Components of the static context are discussed in Section C.1 Static Context Components[XP].

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