Custom functions have access to the current context node
of the map using the standard "this” variable. There are three cases
for contexts:
- If the node itself does not repeat and none of its ancestors repeat,
the context is the root of the document.
- If the node itself repeats, the context is the node itself,
- If the node itself does not repeat but it has a repeating ancestor
(that is, it is within a repeating structure), the context node is
the nearest recurring ancestor.
In a custom function, the following object properties are
available with current context:
- this.current - the current context node.
- this.nodeList - the current context node set.
- this.nodeListLength - the size of the current context (number
of nodes).
- this.nodeListPosition - the position of the current context node
within the current context node set.
The Mapping Editor does not currently support the this.nodeList
property for the current context during run time. Maps that call custom JavaScript functions that
access the this.nodeList property run in the Integration Appliance
but not using the test feature of the Mapping Editor.
You can
also access the common node properties of the current context in your
custom functions. For more information, see Object Properties for Nodes in Custom Functions.