The p:run-option element is a special case of the p:with-option element for passing options to the pipeline being run.

<p:run-option
  name = EQName
  as? = XPathSequenceType
  select = XPathExpression
  collection? = boolean
  href? = { anyURI }
  pipe? = string
  static? = boolean
  exclude-inline-prefixes? = ExcludeInlinePrefixes>
    ((p:empty |
       (p:document |
        p:pipe |
        p:inline)*) |
     anyElement*)
</p:run-option>

In terms of binding inputs and options, these elements have the same syntax and semantics as p:with-input and p:with-option. In addition, the boolean attribute primary can be used on p:run-input to declare whether the respective port of the dynamically executed pipeline is expected to be the primary input port. If the attribute is omitted, it is assumed to be “false” if there are multiple p:run-input connections and “true” if there is exactly one p:run-input connection. It is a dynamic error (err:XC0206) if the dynamically executed pipeline implicitly or explicitly declares a primary input port with a different name than implicitly or explicitly specified in the p:run invocation. Input ports of the dynamically executed pipeline that are not declared with p:run-input on the p:run invocation will receive a p:empty connection. Input ports that are declared in p:run-input but not in the dynamically executed pipeline will be silently ignored.

The context item used to evaluate expressions on p:run-option comes from the default readable port of the p:run step. Additionally, if p:run-input implicitly or explicitly identifies a primary input port, the default readable port will be connected to it if no explicit connection is provided.

Other than p:with-option, p:run-option accepts a boolean attribute static that defaults to “false”. If it is “true”, the option value will be supplied to static analysis of the executed pipeline as a static option with the same name.

Options of the dynamically executed pipeline that are not provided by a p:run-option on the p:run invocation will be defaulted in the normal way (if the option is required, the invocation will fail, for example). Options that are provided by p:run-option but not declared in the dynamically executed pipeline are silently ignored.

Each output port of the pipeline can appear as a same-named output port of the p:run step. In order for this to happen, the port needs to be explicitly declared in the p:run step. In contrast to output declarations of compound steps or of p:declare-pipeline with a subpipeline, such an output declaration may not establish a connection to any port of another step or of the pipeline to be run.

If the pipeline has an output that is not declared on the p:run step, that output is discarded, and the corresponding port on the p:run step does not exist. If the p:run step declares an output port that is not provided by the pipeline, an empty sequence appears on that port.

It is a dynamic error (err:XC0207) if the dynamically executed pipeline implicitly or explicitly declares a primary output port with a different name than implicitly or explicitly specified in the p:run invocation.