Name
cx:xpath — Evaluate XPath expressions.
Synopsis
This step applies an XPath expression to the sequence of documents provided on the source port.
| Input port | Primary | Sequence | Content types |
|---|---|---|---|
| source | ✔ | ✔ | any |
| xpath | text |
| Output port | Primary | Sequence | Content types |
|---|---|---|---|
| result | ✔ | ✔ | any |
| Option name | Type | Default value |
|---|---|---|
| parameters | map(xs:QName,item()*)? | () |
| version | xs:string? | () |
<p:import href="https://xmlcalabash.com/ext/library/xpath.xpl"/>Declaration
1 |<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
| xmlns:p="http://www.w3.org/ns/xproc"
| type="cx:xpath">
| <p:input port="source"
5 | content-types="any"
| sequence="true"
| primary="true"/>
| <p:input port="xpath" content-types="text"/>
| <p:output port="result" sequence="true" content-types="any"/>
10 | <p:option name="parameters" as="map(xs:QName,item()*)?"/>
| <p:option name="version" as="xs:string?"/>
|</p:declare-step>Description
This step is modeled on the p:xquery step, but for XPath.
The context item is set by the source port. If more than one document appears on the source port, the context item is undefined and all of the documents from that port form the default collection.
Any parameters passed are used to configure the in-scope
variables for the expression.
The version must be “3.1”, if it is specified.
Extension attributes
cx:cache-expressionIf the
cx:cache-expressionattribute istrue, and the XPath expression has a base URI, then that expression will be cached. The first time a cached expression is encountered, it is compiled and saved. Subsequent uses of that cached expression will reuse the previously compiled version.See Caching compiled resources for more details.