Name

cx:javascript — Evaluate steps implemented in JavaScript.

Synopsis

This step runs a JavaScript program as the implementation of a step.

Input portPrimarySequenceContent typesDefault binding
source✔ ✔  p:empty
program  text 
Output portPrimarySequenceContent typesDefault binding
result✔   
Option nameTypeDefault value
argsxs:string*()
cwdxs:string?()
optionsmap(xs:string,xs:string)?()
parametersmap(xs:QName,item()?)?()
result-content-typexs:string?()
variablesmap(xs:string,item()?)?()
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://exproc.org/library/polyglot.xpl"/>
Declaration
 1 |<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
   |                xmlns:p="http://www.w3.org/ns/xproc"
   |                type="cx:javascript">
   |   <p:input port="source" primary="true" sequence="true">
 5 |      <p:empty/>
   |   </p:input>
   |   <p:input port="program" content-types="text"/>
   |   <p:output port="result"/>
   |   <p:option name="cwd" as="xs:string?"/>
10 |   <p:option name="args" as="xs:string*"/>
   |   <p:option name="result-content-type" as="xs:string?"/>
   |   <p:option name="variables" as="map(xs:string,item()?)?"/>
   |   <p:option name="parameters" as="map(xs:QName,item()?)?"/>
   |   <p:option name="options" as="map(xs:string,xs:string)?"/>
15 |</p:declare-step>

Installation

The cx:javascript step is not included in the standard XML Calabash release. You must obtain it separately and install it on your classpath before you can use this step. See cx:polyglot for more details.

Description

The cx:javascript step runs a JavaScript program as the implementation of a step.

For more information, see cx:polyglot.