Name

p:cast-content-type — The standard p:cast-content-type step.

Synopsis

The p:cast-content-type step creates a new document by changing the media type of its input. If the value of the content-type option and the current media type of the document on source port are the same, this document will appear unchanged on result port.

Input portPrimarySequenceContent types
source✔  any 
Output portPrimarySequenceContent types
result✔  any 
Option nameTypeDefault valueRequired
content-typexs:string ✔ 
parametersmap(xs:QName,item()*)?() 
Declaration
1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc">
  |   <p:input port="source" content-types="any"/>
  |   <p:output port="result" content-types="any"/>
  |   <p:option name="content-type" required="true" as="xs:string"/>
5 |   <p:option name="parameters" as="map(xs:QName,item()*)?"/>
  |</p:declare-step>
Errors
CodeDescription
err:XC0071It is a dynamic error (err:XC0071) if the p:cast-content-type step cannot perform the requested cast.
err:XC0072It is a dynamic error (err:XC0072) if the c:data contains content is not a valid base64 string.
err:XC0073It is a dynamic error (err:XC0073) if the c:data element does not have a content-type attribute.
err:XC0074It is a dynamic error (err:XC0074) if the content-type is supplied and is not the same as the content-type specified on the c:data element.
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:XD0014It is a dynamic error (err:XD0014) for any unqualified attribute names to appear on a c:param-set element.
err:XD0018It is a dynamic error (err:XD0018) if the parameter list contains any elements other than c:param.
err:XD0025It is a dynamic error (err:XD0025) if the namespace attribute is specified, the name contains a colon, and the specified namespace is not the same as the in-scope namespace binding for the specified prefix.
err:XD0049It is a dynamic error (err:XD0049) if the text value is not a well-formed XML document
err:XD0057It is a dynamic error (err:XD0057) if the text document does not conform to the JSON grammar, unless the parameter liberal is true and the processor chooses to accept the deviation.
err:XD0058It is a dynamic error (err:XD0058) if the parameter duplicates is reject and the text document contains a JSON object with duplicate keys.
err:XD0059It is a dynamic error (err:XD0059) if the parameter map contains an entry whose key is defined in the specification of fn:parse-json and whose value is not valid for that key, or if it contains an entry with the key fallback when the parameter escape with true() is also present.
err:XD0060It is a dynamic error (err:XD0060) if the text document can not be converted into the XPath data model
err:XD0079It is a dynamic error (err:XD0079) if a supplied content-type is not a valid media type of the form “type/subtype+ext” or “type/subtype”.
err:XD0081It is a dynamic error (err:XD0081) if the c:param element has a value attribute and is not empty.
err:XD0082It is a dynamic error (err:XD0082) if the c:param specifies a sequence type and the value does not satisfy that type.
Implementation defined features

Description

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