Using a Custom Transformation
- Last Updated: April 14, 2026
- 2 minute read
- MarkLogic Server
- Version 12.0
- Documentation
Once you install a custom transformation function on MarkLogic Server, you can apply it to your mlcp import or copy job using the following options:
-
-transform_module- The path to the module containing your transformation. Required. -
-transform_namespace- The namespace of your transformation function. If omitted, no namespace is assumed. -
-transform_function- The local name of your transformation function. If omitted, the nametransformis assumed. -
-transform_param- Optional additional string data to be passed through to your transformation function.
Take note of the following limitations:
-
When
-fastloadis in effect, your transform function runs in the scope of a single forest (the forest mlcp determines is the appropriate destination for the file being inserted). This means if you change the document URI as part of your transform, you can end up creating documents with duplicate URIs. -
When you use a transform function, all the documents in each batch are transformed and inserted into the database as a single statement. This means, for example, that if the (transformed) batch contain more than one document with the same URI, you will get an
XDMP-CONFLICTINGUPDATESerror.
The following example command assumes you previously installed a transform module with path /example/mlcp-transform.xqy, and that the function implements a transform function (the default function) in the namespace http://marklogic.com/example. The function expects a user-defined parameter value, supplied using the -transform_param option.
# Windows users, see Modifying the Example Commands for Windows
$ mlcp.sh import -mode local -host mlhost -port 8000 \
-username user -password password \
-input_file_path /space/mlcp-test/data \
-transform_module /example/mlcp-transform.xqy \
-transform_namespace "http://marklogic.com/example" \
-transform_param "my-value"
For a complete example, see Example: Server-Side Content Transformation.