p:json-merge — The standard p:json-merge step.
The p:json-merge step merges the sequence of appearing
on port source into a single JSON object appearing on port
result. If the sequence on
port source is empty, the empty sequence is returned on
port result.
| Input port | Primary | Sequence | Content types |
|---|
| source | ✔ | ✔ | any |
| Output port | Primary | Sequence | Content types |
|---|
| result | ✔ | | application/json |
| Option name | Type | Values | Default value |
|---|
| duplicates | xs:string | ('reject', 'use-first', 'use-last', 'use-any', 'combine') | 'use-first' |
| key | XPathExpression | | 'concat("_",$p:index)' |
Declaration
1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" type="p:json-merge">
| <p:input port="source" sequence="true" content-types="any"/>
| <p:output port="result" content-types="application/json"/>
| <p:option name="duplicates"
5 | values="('reject', 'use-first', 'use-last', 'use-any', 'combine')"
| select="'use-first'"/>
| <p:option xmlns:e="http://www.w3.org/1999/XSL/Spec/ElementSyntax"
| name="key"
| as="xs:string"
10 | select="'concat("_",$p:index)'"
| e:type="XPathExpression"/>
|</p:declare-step>
Errors
| Code | Description |
|---|
err:XC0106 | It is a dynamic error (err:XC0106) if duplicate keys are encountered and
option duplicates has value “reject”. |
err:XC0107 |
It is a dynamic error (err:XC0107) if a document of a not supported document type appears on
port source of p:json-merge. |
err:XC0110 | It is a dynamic error (err:XC0110) if the
evaluation of the XPath expression in option key for a given item returns either a
sequence, an array, a map, or a function. |
Implementation defined features
- It is implementation-defined if
p:json-merge is
able to process document types not mentioned yet, i.e. types of binary documents.