Name

cx:trang-files — Convert between schema formats.

Synopsis

This step converts between DTD, RELAX NG, and XML Schema grammar formats with Trang.

Output portPrimarySequenceContent types
result✔ ✔ xml 
Option nameTypeValuesDefault valueRequired
result-schemaxs:anyURI  ✔ 
source-schemaxs:anyURI  ✔ 
namespacesmap(xs:string, xs:string)? () 
result-formatxs:string?('rng', 'rnc', 'dtd', 'xsd') () 
result-parametersmap(xs:QName, item()*)? () 
source-formatxs:string?('rng', 'rnc', 'dtd') () 
source-parametersmap(xs:QName, item()*)? () 
This is an extension step; to use it, your pipeline must include its declaration. For example, by including the extension library with an import at the top of your pipeline:
<p:import href="https://xmlcalabash.com/ext/library/trang.xpl"/>
Declaration
 1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc">
   |   <p:output port="result" sequence="true" content-types="xml"/>
   |   <p:option name="source-schema" as="xs:anyURI" required="true"/>
   |   <p:option name="result-schema" as="xs:anyURI" required="true"/>
 5 |   <p:option name="source-format" as="xs:string?" values="('rng', 'rnc', 'dtd')"/>
   |   <p:option name="result-format"
   |             as="xs:string?"
   |             values="('rng', 'rnc', 'dtd', 'xsd')"/>
   |   <p:option name="namespaces" as="map(xs:string, xs:string)?"/>
10 |   <p:option name="source-parameters" as="map(xs:QName, item()*)?"/>
   |   <p:option name="result-parameters" as="map(xs:QName, item()*)?"/>
   |</p:declare-step>
Errors
CodeDescription
cxerr:XC0031It is a dynamic error (cxerr:XC0031) if the input format is not supported.
cxerr:XC0032It is a dynamic error (cxerr:XC0032) if the result format is not supported.
cxerr:XC0033It is a dynamic error (cxerr:XC0033) if the format cannot be determined from the schema URI.

Description

Trang translates between DTD, RELAX NG, and XML Schema grammar formats on the file system. This is roughly the same as running trang on the command line.

If a source-format option is not provided, the step will attempt to determine the format by looking at the source-schema. It is a dynamic error (cxerr:XC0033) if the format cannot be determined from the schema URI. It is a dynamic error (cxerr:XC0031) if the input format is not supported.

If a result-format option is not provided, the step will attempt to determine the format by looking at the result-schema. It is a dynamic error (cxerr:XC0032) if the result format is not supported.

See cx:trang for more details about the namespaces, source-parameters, and result-parameters options.

The converted schema documents are stored on the file system. The result schema URI is provided on the result port in a c:result element.