The xtpxlib-container component contains the following support (pipelines and/or libraries) for XProc 3.0:
Module/Pipeline | Description |
---|---|
container-to-disk.xpl | Writes an xtpxlib (3) container structure to disk. A base path must be provided, either as option $href-target path or as /*/@href-target . |
container-to-zip.xpl | Writes an xtpxlib (3) container structure to a zip file. A name for the output zip can be specified in either option $href-target-zip or on the container in /*/@href-target-zip . |
directory-to-container.xpl | Loads a directory (with optional sub-directories) into an xtpxlib (3) container structure. |
load-for-container.xpl | Local support step that loads a single file from a zip or file, and performs all the necessary container loading handling. The result will be a single container entry. |
load-from-container.xpl | Step that loads the files, as specified by a container, that need to be written to disk: |
report-error.xpl | Creates a standard error message for errors occurring in the container pipelines. |
zip-to-container.xpl | Loads the contents of a zip file (directory depth can be set) into an xtpxlib (3) container structure. |
container-to-disk.xpl
File: xpl3mod/container-to-disk/container-to-disk.xpl
Type: xtlcon:container-to-disk
Writes an xtpxlib (3) container structure to disk. A base path must be provided, either as option $href-target
path or as /*/@href-target
.
Port | Type | Primary? | Description |
---|---|---|---|
source | in | yes | The container to process. |
result | out | yes | The input container structure with additional shadow attributes filled. |
Option | Type | Rq? | Default | Description |
---|---|---|---|---|
href-target-path | xs:string? | () | Base path where to write the container. When you specify this it will have precedence over a /*/@href-target-path. | |
remove-target | xs:boolean | true() | Whether to attempt to remove the target directory before writing. |
container-to-zip.xpl
File: xpl3mod/container-to-zip/container-to-zip.xpl
Type: xtlcon:container-to-zip
Writes an xtpxlib (3) container structure to a zip file. A name for the output zip can be specified in either option $href-target-zip
or on the container in /*/@href-target-zip
.
Port | Type | Primary? | Description |
---|---|---|---|
source | in | yes | The container to process. |
result | out | yes | The input container structure with additional shadow attributes filled. |
Option | Type | Rq? | Default | Description |
---|---|---|---|---|
href-target-zip | xs:string? | () | Name of the zip file to write. When you specify this it will have precedence over a /*/@href-target-zip . |
directory-to-container.xpl
File: xpl3mod/directory-to-container/directory-to-container.xpl
Type: xtlcon:directory-to-container
Loads a directory (with optional sub-directories) into an xtpxlib (3) container structure.
Port | Type | Primary? | Description |
---|---|---|---|
result | out | yes | The resulting container structure. |
Option | Type | Rq? | Default | Description |
---|---|---|---|---|
add-document-target-paths | xs:boolean | false() | Copies the relative source path as the target path @target-path for the individual documents.The idea behind this is that in some cases you want to write almost the same structure back to disk. Recording the relative source path as the target path makes this easier: you don't have to set it explicitly. | |
depth | xs:integer | -1 | The sub-directory depth to go. When lt 0 , all sub-directories are processed. | |
exclude-filter | xs:string* | '\.git/' | Optional regular expression exclude filters. By default, .git directories are excluded. | |
href-source-directory | xs:string | yes |
| URI of the directory to read. |
href-target-path | xs:string? | () | Optional target path to record on the container. The idea behind this is that this makes it easier to write the container back to another location on disk, the target path is already there. | |
include-filter | xs:string* | () | Optional regular expression include filters. | |
json-as-xml | xs:boolean | false() | When JSON files are loaded (option $load-json is true ): whether to add them to the container as XML or as JSON text. It will set the entry's content type to application/json+xml . | |
load-html | xs:boolean | false() | Whether to load HTML files. | |
load-json | xs:boolean | false() | Whether to load JSON files. | |
load-text | xs:boolean | false() | Whether to load text files. | |
override-content-types | array(array(xs:string))? | () | Override content types specification (see description of p:directory-list ). |
load-for-container.xpl
File: xpl3mod/local/load-for-container.xpl
Type: xtlcon:load-for-container
Local support step that loads a single file from a zip or file, and performs all the necessary container loading handling. The result will be a single container entry.
Port | Type | Primary? | Description |
---|---|---|---|
result | out | yes | The resulting container entry |
Option | Type | Rq? | Default | Description |
---|---|---|---|---|
add-document-target-paths | xs:boolean | yes |
| If true, copies the relative source path as the target path @target-path for the individual documents. |
content-type | xs:string? | yes |
| Expected content-type of the entry. |
href-source-abs | xs:string? | () | Absolute filename of the file to load from the file system. Ignored when loading from zip. | |
href-source-rel | xs:string | yes |
| Relative filename of the file to load. Used when loading files from a zip and recorded as @href-source on the entry. |
href-zip | xs:string? | () | Name of the zip file to use. If (), load from the file system. | |
json-as-xml | xs:boolean | yes |
| When json files are loaded (option $load-json is true ): whether to add them to the container as XML or as JSON text. It will set the entry's content type to application/json+xml . |
load-html | xs:boolean | yes |
| Whether to load HTML files. |
load-json | xs:boolean | yes |
| Whether to load JSON files. |
load-text | xs:boolean | yes |
| Whether to load text files. |
load-from-container.xpl
File: xpl3mod/local/load-from-container.xpl
Type: xtlcon:load-from-container
Step that loads the files, as specified by a container, that need to be written to disk:
Only loads the documents for which an href-target
is there
For every document loaded, it adds the following additional properties:
href-target: The actual target URI for the document (absolute for writing to disk, relative for writing to zips)s
href-target-original: The original value as set by @href-target
base-uri: Something unique (necessary for creating the zip since we need to address the loaded files as unique by their base-uris). Not reflects anything in the real world!
For documents stated in the container, it sets the property:
serialization: The serialization options for this document (including, most importantly, method and media-type)
External documents are always loaded as application/octet-stream.
Provides an additional output port "container" that outputs the original container, supplemented with all the appropriate shadow attributes (starting with _).
Port | Type | Primary? | Description |
---|---|---|---|
source | in | yes | The container to load |
result | out | yes | The resulting documents with some additional document properties (see pipeline description). |
container | out | The original container, supplemented with additional shadow attributes for the paths and filenames. |
Option | Type | Rq? | Default | Description |
---|---|---|---|---|
do-container-paths-for-zip | xs:boolean | yes |
| Set to true for container-to-zip, false otherwise. |
href-target-path | xs:string? | () | Base path where to write the documents, used for computing the target locations. When you specify this it will have precedence over a /*/@href-target-path. | |
href-target-zip | xs:string? | () | Zip file location. When you specify this it will have precedence over a /*/@href-target-zip. | |
main-pipeline-static-base-uri | xs:string | yes |
| The static-base-uri() of the calling pipeline. |
report-error.xpl
File: xpl3mod/local/report-error.xpl
Type: xtlcon:report-error
Creates a standard error message for errors occurring in the container pipelines.
Port | Type | Primary? | Description |
---|---|---|---|
source | in | yes | The original error document (c:errors element). |
result | out | yes | This output port is just here for convenience. No document will ever appear on it because the step always fails. |
Option | Type | Rq? | Default | Description |
---|---|---|---|---|
error-code | xs:QName | yes |
| |
href-target | xs:string? | () | ||
message | xs:string | yes |
|
zip-to-container.xpl
File: xpl3mod/zip-to-container/zip-to-container.xpl
Type: xtlcon:zip-to-container
Loads the contents of a zip file (directory depth can be set) into an xtpxlib (3) container structure.
Port | Type | Primary? | Description |
---|---|---|---|
result | out | yes | The resulting container structure |
Option | Type | Rq? | Default | Description |
---|---|---|---|---|
add-document-target-paths | xs:boolean | false() | Copies the relative source path as the target path @target-path for the individual documents.The idea behind this is that in some cases you want to write almost the same structure back to disk or zip. Recording the relative source path as the target path makes this easier: you don't have to set it explicitly. | |
depth | xs:integer | -1 | The sub-directory depth to go. When lt 0 , all sub-directories are processed. | |
exclude-filter | xs:string* | '\.git/' | Optional regular expression exclude filters. By default, .git directories are excluded. | |
href-source-zip | xs:string | yes |
| URI of the zip file to read. |
href-target-path | xs:string? | () | Optional target path to record on the container. The idea behind this is that this makes it easier to write the container back to another location on disk, the target path is already there. | |
include-filter | xs:string* |
| Optional regular expression include filters. | |
json-as-xml | xs:boolean | false() | When JSON files are loaded (option $load-json is true ): whether to add them to the container as XML or as JSON text. It will set the entry's content type to application/json+xml . | |
load-html | xs:boolean | false() | Whether to load HTML files. | |
load-json | xs:boolean | false() | Whether to load JSON files. | |
load-text | xs:boolean | false() | Whether to load text files. | |
override-content-types | array(array(xs:string))? | () | Override content types specification (see description of p:archive-manifest ). |