p:sleep (3.1) 

Delays the execution of the pipeline.

Summary

<p:declare-step type="p:sleep">
  <input port="source" primary="true" content-types="any" sequence="true"/>
  <output port="result" primary="true" content-types="any" sequence="true"/>
  <option name="duration" as="xs:nonNegativeInteger" required="true"/>
</p:declare-step>

The p:sleep step delays the execution of the pipeline for a specified time. Source documents are passed unchanged (like in a p:identity step).

Ports:

Port

Type

Primary?

Content types

Seq?

Description

source

input

true

any

true

The source document(s)

result

output

true

any

true

The resulting document(s). These will be exactly the same as what appeared on the source port.

Options:

Name

Type

Req?

Description

duration

xs:nonNegativeInteger

true

The duration of the delay, expressed as either:

  • A number (an xs:double), indicating a number of seconds. For instance 1 (1 second), 2.5 (2.5 seconds) or 0.250 (250 milliseconds).

  • A string that can be interpreted as an xs:dayTimeDuration. For instance PT4H5M (4 hours and 5 minutes) or P1D (1 day).

The duration must not be negative, otherwise error XD0036 is raised.

Description

Sometimes it is useful to stop executing a pipeline for a little while, for instance when interacting with remote web servers. The p:sleep step does exactly this: it just stops executing the pipeline for the time as specified in the duration option.

Additional details

  • Some XProc processors will execute steps in parallel when the flow of documents in the pipeline makes this possible (multi-threaded implementations). The p:sleep step is guaranteed to delay the execution of the steps that depend on its output only. Whatever happens to other steps (steps that run in parallel and do not depend on the output of the p:sleep invocation) is implementation-defined and therefore depends on the XProc processor used.

  • A reasonable effort will be made to delay for the specified duration. However, this may not be entirely accurate.

  • p:sleep preserves all document-properties of the document(s) appearing on its source port.

Errors raised

Error code

Description

XD0036

It is a dynamic error if the supplied value of a variable or option cannot be converted to the required type.

Reference information

This description of the p:sleep step is for XProc version: 3.1. This is a required step (an XProc 3.1 processor must support this).

The formal specification for the p:sleep step can be found here.

The p:sleep step is part of categories: