Name
p:insert — The standard p:insert step.
Synopsis
The p:insert step inserts the
insertion port's document into the source
port's document relative to the matching elements in the
source port's document.
| Input port | Primary | Sequence | Content types |
|---|---|---|---|
| source | ✔ | xml html | |
| insertion | ✔ | text xml html |
| Output port | Primary | Sequence | Content types |
|---|---|---|---|
| result | ✔ | text xml html |
| Option name | Type | Values | Default value |
|---|---|---|---|
| match | XSLTSelectionPattern | '/*' | |
| position | xs:string | ('first-child', 'last-child', 'before', 'after') | 'after' |
Declaration
1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" type="p:insert">
| <p:input port="source" primary="true" content-types="xml html"/>
| <p:input port="insertion" sequence="true" content-types="text xml html"/>
| <p:output port="result" content-types="text xml html"/>
5 | <p:option xmlns:e="http://www.w3.org/1999/XSL/Spec/ElementSyntax"
| name="match"
| as="xs:string"
| select="'/*'"
| e:type="XSLTSelectionPattern"/>
10 | <p:option name="position"
| values="('first-child','last-child','before','after')"
| select="'after'"/>
|</p:declare-step>Errors
| Code | Description |
|---|---|
err:XC0023 | It
is a dynamic error (err:XC0023) if that pattern matches
an attribute or a namespace node. |
err:XC0024 | It is a
dynamic error (err:XC0024) if the selection pattern (err:XC0024) matches a document
node and the value of the position is “before” or
“after”. |
err:XC0025 | It is a dynamic error (err:XC0025)
if the selection pattern (err:XC0025) matches anything other than an element or a document
node and the value of the position option is
“first-child” or
“last-child”. |
Description
The p:insert step is a
standard XProc 3.0 step.
It is also described on XProcRef.org.
Additional examples
The XProc test suite contains examples of the p:insert step.