I was wondering if it is possible to have the uri of document that is being loaded to extract form an xml tag attribute in an aggregate xml ?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<trialRecordsOutput>
<serviceExecutionTime>427</serviceExecutionTime>
<Trial id="10006">...<Trial>
<Trial id="123456">...<Trial>
</trialRecordsOutput>
In the above example, I am extracting each <Trial>
as a separate document and I want the document uri_id to be the attribute id
in the <Trial>
tag is this possible ? following is sample of my mlcp options
-input_compressed
true
-input_compression_codec
gzip
-input_file_type
aggregates
-output_permissions
rest-reader,read,rest-writer,update
-output_uri_prefix
/cortellis/trial/
-output_uri_suffix
.xml
-aggregate_record_element
Trial
-uri_id
__XXXX How to specify XML attribute XXXX__
-transform_module
/com.marklogic.hub/mlcp-flow-transform.xqy
-transform_namespace
http://marklogic.com/data-hub/mlcp-flow-transform
-transform_param
"entity-name=trial,flow-name=input-trial,flow-type=input,job-id=trial_initial_load"
In the transform module(mlcp-flow-transform.xqy), you can create a uri that you want by utilizing the attribute Id.
In the return statement, put a new key with name 'uri' to $content. As we add 'value'.
let $uri := 'Your new uri'
let $value := 'Your actual content'
return (map:put($content,'uri',$uri),
map:put($content,'value',$value))
For more information refer to Chapter 4 of the MLCP user guide Importing Content Into MarkLogic Server - XQuery Implementation