W3C

XQuery, XSLT, and XPath Map Namespace Document

21 March 2017


1 Introduction

This document describes the namespace http://www.w3.org/2005/xpath-functions/map defined by the [XPath and XQuery Functions and Operators 3.1] and [XSLT 3.0] specifications. This namespace is conventionally identified by the namespace prefix map. This is not a pre-declared prefix in XQuery 3.1. For updated information, please refer to the latest version of the [XPath and XQuery Functions and Operators 3.1] and [XSLT 3.0] specifications.

Because XSLT 3.0 has no mandatory dependency on XPath 3.1, these functions are specified in both [XPath and XQuery Functions and Operators 3.1] and [XSLT 3.0]. The two specifications are identical.

This document describes the names that are defined in this namespace at the time of publication. The W3C reserves the right to define additional names in this namespace in the future. [XPath and XQuery Functions and Operators 3.1] and [XSLT 3.0] are the only specifications that may amend this namespace.

This document contains a directory of links to related resources, using RDDL (as defined in [Resource Directory Description Language (RDDL)]).

It is GRDDL-enabled (as defined in [Gleaning Resource Descriptions from Dialects of Languages (GRDDL)]), that is to say that a GRDDL-compliant processor can extract useful RDF (as defined in [Resource Description Framework (RDF): Concepts and Abstract Syntax]) representations of the information contained herein.

2 XQuery and XPath Map Functions

This section lists all of the functions defined by the [XPath and XQuery Functions and Operators 3.1] and [XSLT 3.0] specifications to be in the namespace reserved for certain map-related functions.

Functions are uniquely identified by the combination of namespace URI, local name, and arity (number of arguments). For the purpose of this document, functions having a common namespace URI and local name can be considered to form a function family. A function family can be uniquely identified with a URI of the form: “http://www.w3.org/2005/xpath-functions/map#name” where name is the local name of a function, such as “size”: http://www.w3.org/2005/xpath-functions/map#size.

The normative definitions of these functions are in the [XPath and XQuery Functions and Operators 3.1] specification in the case of XQuery 3.1 and XPath 3.1, and in [XSLT 3.0] in the case of XSLT 3.0. These specifications are identical. For convenience, a very brief, non-normative summary of each function is provided. For details, follow the link on the “Summary:” introductory text below each function.

contains

contains(map(*), xs:anyAtomicType) as xs:boolean

Tests whether a supplied map contains an entry for a given key

entry

entry(xs:anyAtomicType, item()*) as map(*)

Returns a map that contains a single entry (a key-value pair).

find

find(item()*, xs:anyAtomicType) as array(*)

Searches the supplied input sequence and any contained maps and arrays for a map entry with the supplied key, and returns the corresponding values.

for-each

for-each(map(*), function(xs:anyAtomicType, item()*) as item()*) as item()*

Applies a supplied function to every entry in a map, returning the concatenation of the results.

get

get(map(*), xs:anyAtomicType) as item()*

Returns the value associated with a supplied key in a given map.

keys

keys(map(*)) as xs:anyAtomicType*

Returns a sequence containing all the keys present in a map

merge

merge(map(*)*) as map(*)

merge(map(*)*, map(*)) as map(*)

Returns a map that combines the entries from a number of existing maps.

put

put(map(*), xs:anyAtomicType, item()*) as map(*)

Returns a map containing all the contents of the supplied map, but with an additional entry, which replaces any existing entry for the same key.

remove

remove(map(*), xs:anyAtomicType*) as map(*)

Returns a map containing all the entries from a supplied map, except those having a specified key.

size

size(map(*)) as xs:integer

Returns the number of entries in the supplied map.

3 Normative References

These documents describe the names that are defined in this namespace at the time of publication. The W3C reserves the right to define additional names in this namespace in the future.

XPath and XQuery Functions and Operators 3.1
XSLT 3.0

XSL Transformations (XSLT) Version 3.0 (7 February 2017 version)

4 Non-Normative References

Resource Directory Description Language (RDDL)
Gleaning Resource Descriptions from Dialects of Languages (GRDDL)
Resource Description Framework (RDF): Concepts and Abstract Syntax