Skip to main content

Using MarkLogic Content Pump (mlcp)

Input Parameters

The table below describes the input parameters to a transform function:

Parameter

Description

$content

Data about the original input document. The map contains the following keys:

  • uri - The URI of the document being inserted into the database.

  • value - The contents of the input document, as a document node, binary node, or text node.

$context

Additional context information about the insertion, such as tranformation-specific parameter values. The map can contain the following keys when your transform function is invoked:

  • transform_param : The value passed by the client through the -transform_param option, if any. Your function is responsible for parsing and validation.

  • collections : Collection URIs specified by the -output_collections option. Value format: A sequence of strings.

  • permissions : Permissions specified by the -output_permissions option. Value format: A sequence of sec:permission elements, as produced by xdmp:permission.

  • quality : The document quality specified by the -output_quality parameter. Value format: An integer value.

  • temporalCollection : The temporal collection URI specified by the -temporal-collection parameter. Value format: A string.

The type of node your function receives in the “value” property of $content depends on the input document type, as determined by mlcp from the -document_type option or URI extension. For details, see How mlcp Determines Document Type. The type of node your function returns in the “value” property should follow the same guidelines.

The table below outlines the relationship between document type and the node type your transform function should expect.

Document Type

“value” node type

XML

document-node

JSON

document-node

BINARY

binary-node

TEXT

text-node

The collections, permissions, quality, and temporal collection metadata from the mlcp command line is made available to your function so that you can modify or replace the values. If a given metadata category is not specified on the command line, the key will not be present in the input map.