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 port | Primary | Sequence | Content types |
|---|---|---|---|
| source | ✔ | any |
| Output port | Primary | Sequence | Content types |
|---|---|---|---|
| result | ✔ | any |
| Option name | Type | Default value |
|---|---|---|
| format | xs:QName | 'gzip' |
| parameters | map(xs:QName, item()*)? | () |
| serialization | map(xs:QName,item()*)? | () |
Declaration
1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" type="p:compress">
| <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
| Code | Description |
|---|---|
err:XC0079 | It 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:XC0202 | It is a dynamic error (err:XC0202) if the compression
format cannot be understood, determined and/or processed. |
Implementation defined features
- It is implementation-defined what other formats are supported.
- The semantics of the keys and the allowed values for these keys are implementation-defined.
Description
The p:compress step is a
standard XProc 3.0 step.
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 algorithm | Format | Content type | Common file extensions |
|---|---|---|---|
| BZip2 | bzip2 | application/bzip2 | .bz2 |
| deflate | deflate | application/deflate | .deflate |
| GZip | gzip | application/gzip | .gz, .gzip |
| LZMA | lzma | application/lzma | .lzma |
| XZ | xz | application/xz | .xz |
Notes
You can uncompress using the Brotli and Compress algorithms with
p:uncompress, but they are read-only. You cannot compress with those algorithms.Support for the LZMA and XZ algorithms require the
org.tukaani:xz:1.10package on the classpath.