Name

p:compress — The standard p:compress step.

Synopsis

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

Input portPrimarySequenceContent types
source✔  any 
Output portPrimarySequenceContent types
result✔  any 
Option nameTypeDefault value
formatxs:QName'gzip'
parametersmap(xs:QName, item()*)?()
serializationmap(xs:QName,item()*)?()
Declaration
 1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc">
   |   <p:input port="source"
   |            primary="true"
   |            content-types="any"
 5 |            sequence="false"/>
   |   <p:output port="result"
   |             primary="true"
   |             content-types="any"
   |             sequence="false"/>
10 |   <p:option name="format" as="xs:QName" select="'gzip'"/>
   |   <p:option name="serialization" as="map(xs:QName,item()*)?"/>
   |   <p:option name="parameters" as="map(xs:QName, item()*)?"/>
   |</p:declare-step>
Errors
CodeDescription
err:XC0079It is a dynamic error (err:XC0079) if the map parameters contains an entry whose key is defined by the implementation and whose value is not valid for that key.
err:XC0202It is a dynamic error (err:XC0202) if the compression format cannot be understood, determined and/or processed.
Implementation defined features

Description

The p:compress step is defined in the XProc 3.0: Standard Step Library. It is also described on XProcRef.org.

Compression is supported by the third party Apache Commons Compress™ library.

Supported formats

The following formats are supported using the Apache Commons Compress™ library version 1.27.1.

Compression algorithmFormatContent typeCommon file extensions
BZip2bzip2application/bzip2.bz2
deflatedeflateapplication/deflate.deflate
GZipgzipapplication/gzip.gz, .gzip
LZMAlzmaapplication/lzma.lzma
XZxzapplication/xz.xz

Notes

  1. You can uncompress using the Brotli and Compress algorithms with p:uncompress, but they are read-only. You cannot compress with those algorithms.

  2. Support for the LZMA and XZ algorithms require the org.tukaani:xz:1.10 package on the classpath.