tr:dynamic-transformation-pipeline dtp
cascade/xpl/dynamic-transformation-pipeline.xpl
Import URI: http://transpect.io/cascade/xpl/dynamic-transformation-pipeline.xpl
This encapsulates the dynamic loading of an XSLT stylesheet and an XPL pipeline and execution of the pipeline. Dynamic loading means that the most specific (specificity tr: work, series, publisher, common) XSL and XPL files will be loaded. The pipeline usually consists of transformations with the same dynamically loaded stylesheet in different modes, according to the dynamically loaded pipeline (that consists of tr:xslt-mode steps). The pipeline may have multiple documents on the source and result ports. The transformation will be applied to each document in turn. Additional input files that will be passed to each transformation may be sent to the additional-input port. They must be wrapped in cx:document with the appropriate port name of the dynamically executed pipeline. Even if you don’t have additional inputs, make sure to always include the additional-inputs port when invoking tr:dynamic-transformation-pipeline. Connect it to p:empty by default. Please note the difference between a sequence of source documents (will be transformed one by one) and a sequence of additional files (will be available to the dynamically loaded pipeline and will typically be used as additional input documents for some of the tr:xslt-mode steps therein, thus making it available via the default collection in each transformation). There is a limitation that additional inputs are limited to single documents per port. If you have a sequence, you’ll have to wrap it into a custom element before wrapping it in the cx:document. There is also an options port. You may submit options in a cx:options document with cx:option entries (with name and value attributes). These options will be merged with the debug and debug-dir-uri options and passed on to the dynamically loaded pipeline. Before preparing a cx:options document, check whether the options can be read in the dynamically invoked pipeline from the primary parameter port.
Input Ports
Name | Documentation | Connections |
---|---|---|
sourceⓅⓈ | ||
additional-inputsⓈ | Additional cx:document(s) whose port attribute(s) designate(s) the input port(s) of the dynamically evaluated XProc step | |
optionsⓈ | Options that will be passed to the pipeline, in a cx:options document | |
pathsⓅ |
Output Ports
Name | Documentation | Connections |
---|---|---|
resultⓅⓈ | A sequence of documents |
Options
Name | Documentation | Default |
---|---|---|
load | The base name of the .xsl and .xpl files to load, e.g., foo2bar/foo2bar, where foo2bar is the name of directories in the customization folders for publisher, series, etc. | |
fallback-xsl | Fallback URI to 'default' stylesheet file. Will be loaded when no customization is available in the customization folders for publisher, series, etc. You have to use the URI located in [code repo]/xmlcatalog/catalog.xml together wie the path to the stylesheet. Example (evolve-hub): http://transpect.io/evolve-hub/xsl/evolve-hub.xsl | '' |
fallback-xpl | Fallback URI to 'default' pipeline file. Leave it empty when no .xpl exists. | '' |
debug | 'no' | |
debug-dir-uri | 'debug' |
Subpipeline
Step | Inputs | Outputs | Options | ||
---|---|---|---|---|---|
p:parameters consolidate-params | result | ||||
p:wrap d101e50 |
| result | wrapper = 'cx:document' match = '/' | ||
p:add-attribute parameters | result | attribute-name = 'port' attribute-value = 'parameters' match = '/*' | |||
p:sink d101e58 |
| ||||
tr:load-cascaded load-stylesheet |
| result | filename = concat($load, '.xsl') fallback = $fallback-xsl debug = $debug debug-dir-uri = $debug-dir-uri | ||
p:sink d101e74 |
| ||||
p:wrap d101e75 |
| result | wrapper = 'cx:document' match = '/' | ||
p:add-attribute stylesheet | result | attribute-name = 'port' attribute-value = 'stylesheet' match = '/*' | |||
p:sink d101e85 |
| ||||
tr:load-cascaded pipeline |
| result | filename = concat($load, '.xpl') fallback = $fallback-xpl debug = $debug debug-dir-uri = $debug-dir-uri | ||
p:try validate-pipeline | |||||
p:group d101e99 | |||||
p:validate-with-relax-ng d101e101 |
| result | assert-valid = 'true' | ||
p:sink d101e114 | |||||
p:catch failed | error | ||||
cx:message d101e119 | result | message = concat('Invalid dynamic transformation pipeline (or no pipeline present): ', base-uri(/*), ' Please look for error messages in ', resolve-uri('dynamic-transformation-pipeline.error.xml', $debug-dir-uri)) | |||
p:store d101e127 | result | href = resolve-uri('dynamic-transformation-pipeline.error.xml', $debug-dir-uri) | |||
p:store d101e137 | result | href = resolve-uri(concat('dynamic-transformation-pipeline.error_', replace(base-uri(/*), '^.+/', '')), $debug-dir-uri) | |||
p:xslt options |
| result | template-name = 'main' | ||
p:sink d101e190 | |||||
p:for-each iteration | |||||
p:wrap d101e198 | result | wrapper = 'cx:document' match = '/' | |||
p:add-attribute source | result | attribute-name = 'port' attribute-value = 'source' match = '/*' | |||
p:sink d101e208 | |||||
cx:eval eval |
| detailed = 'true' | |||
p:unwrap d101e235 |
| result | match = '/cx:document[@port eq 'result']' |