p:uncompress (3.1) 

Uncompresses a document.

Summary

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

The p:uncompress step expects on its source port a compressed (usually binary) document. It outputs an uncompressed version of this document on its result port.

Ports:

Port

Type

Primary?

Content types

Seq?

Description

source

input

true

any

false

The document to uncompress

result

output

true

any

false

The resulting uncompressed document.

Options:

Name

Type

Req?

Default

Description

content-type

xs:string

false

application/octet-stream

Specifies the media type for the resulting uncompressed document that appears on the result port (and therefore the value of its content-type document-property).

If not specified, this media type will become application/octet-stream (the generic media type for “any binary document”).

format

xs:QName?

false

()

Specifies the compression format of the source document:

  • If its value is the empty sequence (default), p:uncompress tries to guess this format by inspecting the document’s content-type document-property and/or inspecting its contents. How this is done is implementation-defined and therefore dependent on the XProc processor used. A GZIP compressed document should be recognized. Whether any other format is recognized is also implementation-defined.

  • If its value is gzip the step expects a document compressed according to the GZIP specification.

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

parameters

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

false

()

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

Description

The p:uncompress step uncompresses the document appearing on its source port.

To do this it first determines the compression format (see the description of the format option). Usually this will be GZIP, the only compression format an XProc processor is required to support.

After the uncompression, the result is interpreted according to the value of the step’s content-type option. If nothing is specified, the resulting document will just flow out as a generic binary document (media type application/octet-stream). However, if an explicit media type is specified, for instance text/xml, the result is interpreted as such and cast to this type. Of course this must be possible, if not error XC0201 is raised.

Additional details

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

    Exception is the content-type document-property which is updated accordingly.

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.

XC0201

It is a dynamic error if the <p:uncompress> step cannot perform the requested content-type cast.

XC0202

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

XD0079

It is a dynamic error if a supplied content-type is not a valid media type of the form “type/subtype+ext” or “type/subtype”.

Reference information

This description of the p:uncompress 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:uncompress step can be found here.

The p:uncompress step is part of categories:

The p:uncompress step is also present in version: 3.0.