This site is work in progress and does not yet describe all available steps.

 p:compress (3.0) 

Compresses a document.

Summary

<p:declare-step type="p:compress">
  <input port="source" primary="true" content-types="any" sequence="false"/>
  <output port="result" primary="true" content-types="any" sequence="false"/>
  <option name="format" as="xs:QName" required="false" select="'gzip'"/>
  <option name="parameters" as="map(xs:QName, item()*)?" required="false" select="()"/>
  <option name="serialization" as="map(xs:QName,item()*)?" required="false" select="()"/>
</p:declare-step>

The p:compress step serializes the document appearing on its source port and outputs a compressed version of this on its result port.

Ports:

Type

Port

Primary?

Content types

Seq?

Description

input

source

true

any

false

The document to compress.

output

result

true

any

false

The resulting compressed document

Options:

Name

Type

Req?

Default

Description

format

xs:QName

false

gzip

Specifies the format of the source document. The value gzip (default) results in a document compressed using the GZIP format.

Support for any other compression format is implementation-defined and therefore dependent on the XProc processor used.

parameters

map(xs:QName, item()*)?

false

()

Parameters controlling the compression. Keys, values and their meaning depend on the value of the method option and the XProc processor used.

serialization

map(xs:QName,item()*)?

false

()

Before the document is compressed, it is first serialized (as if written to disk). This option can supply a map with serialization properties, controlling this serialization.

If the source document has a serialization document-property, the two sets of serialization properties are merged (properties in the document-property have precedence).

Description

The p:compress step first serializes the document appearing on its source. It then compresses the outcome of this serialization using the format as specified in the format option. The result, usually a binary document, appears on its result port.

The only compression format that must be supported is GZIP. Support for any other compression format is implementation-defined and therefore dependent on the XProc processor used.

The reverse uncompress operation is supported by the p:uncompress step.

Additional details

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

    Exceptions are the content-type document-property which is updated accordingly and the serialization document-property which is removed.

Errors raised

Error code

Description

XC0079

It is a dynamic error if the map parameters contains an entry whose key is defined by the implementation and whose value is not valid for that key.

XC0202

It is a dynamic error if the compression format cannot be understood, determined and/or processed.

Reference information

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

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

The p:compress step is part of categories:

The p:compress step is also present in version: 3.1.