3.1 XProc (1.0) library: common.mod.xpl
File: xplmod/common.mod/common.mod.xpl
XProc (1.0) library with generic steps.
Prefix | Namespace URI |
---|
xtlc | http://www.xtpxlib.nl/ns/common |
Step | Description |
---|
xtlc:copy-directory | Copies a full directory structure. |
xtlc:copy-file | Copies a file, if necessary from inside a zip file. |
xtlc:log | Writes a message to a log file. |
xtlc:recursive-directory-list | Returns the contents of a directory, going into sub-directories recursively. When the requested directory does not exist, it returns only a c:directory root element with an error="true" attribute. |
xtlc:remove-dir | Removes a full directory When the directory does not exist, everything continues without error. |
xtlc:tee | Tees the input to a file and passes it unchanged (like the Unix tee command). |
xtlc:zip-directory | Zips a directory and its sub-directories into a single zip file. |
3.1.1 Step: xtlc:copy-directory
Copies a full directory structure.
Port | Type | Primary? | Description |
---|
source | in | yes | Input, will be passed unchanged. |
result | out | yes | The input unchanged. |
Option | Rq? | Default | Description |
---|
href-source-dir | yes |
| Reference to the directory to copy from (must have a leading file:/ specifier!). |
href-target-dir | yes |
| Reference to the directory to copy to (must have a leading file:/ specifier!). If it does not exist the step will try to create it. |
3.1.2 Step: xtlc:copy-file
Copies a file, if necessary from inside a zip file.
Port | Type | Primary? | Description |
---|
source | in | yes | Input, will be passed unchanged. |
result | out | yes | The input unchanged. |
Option | Rq? | Default | Description |
---|
enable | | true() | Whether the copying is done at all. |
href-source | yes |
| Reference to the source file to copy (must have a leading file:/ specifier!). |
href-source-zip | | '' | Document reference to a zip file (must have a leading file:/ specifier!). When filled, $href-source is assumed to be a path inside this zip. |
href-target | yes |
| Reference to the target. |
3.1.3 Step: xtlc:log
Writes a message to a log file.
Port | Type | Primary? | Description |
---|
source | in | yes | Input to the logging, will be passed unchanged to the output |
result | out | yes | The input unchanged. |
Option | Rq? | Default | Description |
---|
enable | | true() | Whether the logging will be done at all. |
href-log | yes |
| Name of the file to write the log messages to (must have a leading file:/ specifier!). |
keep-messages | | 100 | The number of messages to keep in the logfile. If le 0 , all messages are kept. Set by default to 100 to prevent overflowing files… |
message | yes |
| The actual log message to write. |
status | | 'ok' | Status of the message. Must be ok , warning , error or debug . |
3.1.4 Step: xtlc:recursive-directory-list
Returns the contents of a directory, going into sub-directories recursively. When the requested directory does not exist, it returns only a c:directory
root element with an error="true"
attribute.
Adapted from Norman Walsh's example code.
Port | Type | Primary? | Description |
---|
result | out | yes | The resulting directory structure listing in XML format. |
Option | Rq? | Default | Description |
---|
depth | | -1 | The sub-directory depth to go. When le 0 , all sub-directories are processed. |
exclude-filter | |
| An optional regular expression exclude filter. |
flatten | | false() | When true , the list will be "flattened": All c:file children will be direct children of the root's c:directory element. These c:file elements get a @name , @href-abs (absolute filename) and @href-rel (relative filename) attribute. |
include-filter | |
| An optional regular expression include filter. |
path | yes |
| The path to get the directory listing from. |
3.1.5 Step: xtlc:remove-dir
Removes a full directory When the directory does not exist, everything continues without error.
Port | Type | Primary? | Description |
---|
source | in | yes | Input, will be passed unchanged. |
result | out | yes | The input unchanged. |
Option | Rq? | Default | Description |
---|
enable | | true() | Whether the removal is done at all. |
href-dir | yes |
| Reference to the directory to remove (must have a leading file:/ specifier!). |
3.1.6 Step: xtlc:tee
Tees the input to a file and passes it unchanged (like the Unix tee command).
Port | Type | Primary? | Description |
---|
source | in | yes | Input to the tee. |
result | out | yes | The input unchanged (unless a $root-attribute-href was specified). |
Option | Rq? | Default | Description |
---|
enable | | true() | Whether to actually do the write. When false , nothing happens. |
href | yes |
| Name of the file to write to (must have a leading file:/ specifier!) |
indent | | true() | Whether or not to indent the tee-d output. |
root-attribute-href | | '' | If filled, $href is recorded as an attribute with this name on the root element of the original input. Must be a valid attribute name. |
3.1.7 Step: xtlc:zip-directory
Zips a directory and its sub-directories into a single zip file.
Port | Type | Primary? | Description |
---|
result | out | yes | The output of the actual zip step, listing all the files that went in. |
Option | Rq? | Default | Description |
---|
base-path | yes |
| Directory which contents will be stored in the zip (must have a leading file:/ specifier!) |
href-target-zip | yes |
| Document reference for the zip file to produce (must have a leading file:/ specifier!) |
include-base | | true() | When true, the last part of $base-path (e.g. a/b/c ==> c ) is used as the root directory in the zip file. |