p:text-replace — The standard p:text-replace step.
The p:text-replace step replaces all occurrences of substrings in a text document that match a
supplied regular expression with a given replacement string.
| Input port | Primary | Sequence | Content types |
|---|
| source | ✔ | | text |
| Output port | Primary | Sequence | Content types |
|---|
| result | ✔ | | text |
| Option name | Type | Default value | Required |
|---|
| pattern | xs:string | | ✔ |
| replacement | xs:string | | ✔ |
| flags | xs:string? | () | |
Declaration
1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" type="p:text-replace">
| <p:input port="source"
| primary="true"
| sequence="false"
5 | content-types="text"/>
| <p:output port="result"
| primary="true"
| sequence="false"
| content-types="text"/>
10 | <p:option name="pattern" required="true" as="xs:string"/>
| <p:option name="replacement" required="true" as="xs:string"/>
| <p:option name="flags" as="xs:string?"/>
|</p:declare-step>
Errors
| Code | Description |
|---|
err:XC0147 | It is a dynamic error (err:XC0147) if the specified value is not
a valid XPath regular expression. |
The p:text-replace step is a
standard XProc 3.0 step.
It is also described on XProcRef.org.