Name

cx:xpath — Evalute XPath expressions.

Synopsis

This step applies an XPath expression to the sequence of documents provided on the source port.

Input portPrimarySequenceContent types
source✔ ✔ any 
xpath  text 
Output portPrimarySequenceContent types
result✔ ✔ any 
Option nameTypeDefault value
parametersmap(xs:QName,item()*)?()
versionxs:string?()
This is an extension step; to use it, your pipeline must include its declaration. For example, by including the extension library with an import at the top of your pipeline:
<p:import href="https://xmlcalabash.com/ext/library/xpath.xpl"/>
Declaration
 1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc">
   |   <p:input port="source"
   |            content-types="any"
   |            sequence="true"
 5 |            primary="true"/>
   |   <p:input port="xpath" content-types="text"/>
   |   <p:output port="result" sequence="true" content-types="any"/>
   |   <p:option name="parameters" as="map(xs:QName,item()*)?"/>
   |   <p:option name="version" as="xs:string?"/>
10 |</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.